[Snyk] Security upgrade next from 15.2.4 to 16.1.5 #93
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 🌥️ SonarQube Cloud | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| workflow_dispatch: | |
| jobs: | |
| sonarcloud-analysis: | |
| name: Analyze .NET Code Quality | |
| runs-on: ubuntu-latest | |
| environment: SonarCloud | |
| permissions: | |
| contents: read | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - name: 🔄 Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🧰 Setup .NET SDK | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: "9.0.x" | |
| - name: ☕ Setup Java (required for SonarCloud) | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: 17 | |
| distribution: "zulu" | |
| - name: 📥 Install SonarScanner CLI for .NET | |
| run: dotnet tool install --global dotnet-sonarscanner | |
| - name: 📦 Restore project dependencies | |
| run: dotnet restore OPS.sln | |
| - name: 🚀 Start SonarCloud analysis | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: | | |
| dotnet sonarscanner begin \ | |
| /k:"Learnathon-By-Geeky-Solutions_elite-programmers" \ | |
| /o:"learnathon-by-geeky-solutions" \ | |
| /d:sonar.token="${{ secrets.SONAR_TOKEN }}" \ | |
| /d:sonar.host.url="https://sonarcloud.io" \ | |
| /d:sonar.sourceEncoding="UTF-8" \ | |
| /d:sonar.qualitygate.wait="true" \ | |
| /d:sonar.scm.provider="git" \ | |
| /d:sonar.alm.github.api.url="https://api.github.com" \ | |
| /d:sonar.language="cs" \ | |
| /d:sonar.scanner.scanAll="false" \ | |
| /d:sonar.inclusions="**/src/Api/**" \ | |
| /d:sonar.exclusions="**/Migrations/**, **/Entities/**, **/wwwroot/**" \ | |
| /d:sonar.test.inclusions="**/*Tests.cs" \ | |
| /d:sonar.coverage.exclusions="**/Dtos/**, **/OPS.Api/**, **/OPS.Domain/**, **/OPS.Infrastructure/**, **/OPS.Persistence/**" \ | |
| /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" | |
| - name: 🛠️ Build solution | |
| run: dotnet build OPS.sln --no-restore --configuration Release | |
| - name: ✅ Run tests and collect coverage | |
| run: | | |
| dotnet tool install --global dotnet-coverage | |
| dotnet-coverage collect "dotnet test OPS.sln --no-build --configuration Release" -f xml -o "coverage.xml" | |
| - name: 🧾 End SonarCloud analysis | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: | |
| dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |