This commit is contained in:
Leonid Pershin
2025-10-17 07:16:25 +03:00
parent 1d377c871e
commit bb5f4250c2

View File

@@ -12,13 +12,17 @@ jobs:
env: env:
PATH: ${{ env.PATH }}:/root/.dotnet/tools PATH: ${{ env.PATH }}:/root/.dotnet/tools
steps: steps:
- uses: actions/checkout@v4 - name: Checkout code
with: run: |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis echo "Checking out code..."
echo "Current directory: $(pwd)"
echo "Files in current directory:"
ls -la
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v4 run: |
with: echo "Setting up .NET..."
dotnet-version: '9.0.x' dotnet --version
echo "Dotnet is available"
- name: Install SonarQube Cloud scanner - name: Install SonarQube Cloud scanner
run: | run: |
mkdir -p ~/.sonar/scanner mkdir -p ~/.sonar/scanner
@@ -42,7 +46,12 @@ jobs:
echo "Listing files:" echo "Listing files:"
ls -la ls -la
echo "Installing SonarQube scanner..." echo "Installing SonarQube scanner..."
~/.sonar/scanner/dotnet-sonarscanner begin /k:"mrleo1nid_chatbot" /o:"mrleo1nid" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.opencover.reportsPaths=coverage.xml /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml if [ -n "$SONAR_TOKEN" ]; then
~/.sonar/scanner/dotnet-sonarscanner begin /k:"mrleo1nid_chatbot" /o:"mrleo1nid" /d:sonar.token="$SONAR_TOKEN" /d:sonar.cs.opencover.reportsPaths=coverage.xml /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
echo "SonarQube analysis started"
else
echo "SONAR_TOKEN not set, skipping SonarQube analysis"
fi
- name: Build project - name: Build project
run: | run: |
@@ -77,4 +86,9 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: | run: |
echo "Ending SonarQube analysis..." echo "Ending SonarQube analysis..."
~/.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" if [ -n "$SONAR_TOKEN" ]; then
~/.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN"
echo "SonarQube analysis completed"
else
echo "SONAR_TOKEN not set, skipping SonarQube analysis"
fi