Skip to content

chore(deps): bump actions/upload-artifact from 4 to 7 #125

chore(deps): bump actions/upload-artifact from 4 to 7

chore(deps): bump actions/upload-artifact from 4 to 7 #125

Workflow file for this run

name: SonarCloud Analysis
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud Scan
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for better analysis
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Install SonarScanner
run: |
dotnet tool install --global dotnet-sonarscanner
dotnet tool install --global dotnet-coverage
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Begin SonarCloud Analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet sonarscanner begin \
/k:"${{ vars.SONAR_PROJECT_KEY }}" \
/o:"${{ vars.SONAR_ORGANIZATION }}" \
/d:sonar.token="${{ secrets.SONAR_TOKEN }}" \
/d:sonar.host.url="https://sonarcloud.io" \
/d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" \
/d:sonar.coverage.exclusions="**/Migrations/**,**/Tests/**,**/*.Designer.cs" \
/d:sonar.exclusions="**/Migrations/**,**/wwwroot/**,**/node_modules/**" \
/d:sonar.cpd.exclusions="**/Migrations/**" \
/d:sonar.qualitygate.wait=true
- name: Build Solution
run: dotnet build auction.sln -c Release --no-incremental
- name: Run Tests with Coverage
run: |
dotnet-coverage collect \
--output-format opencover \
--output coverage.opencover.xml \
"dotnet test auction.sln --configuration Release --no-build --verbosity normal"
continue-on-error: true
- name: End SonarCloud Analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
- name: Upload Coverage Report
uses: actions/upload-artifact@v7
if: always()
with:
name: coverage-report
path: "**/coverage.opencover.xml"
retention-days: 7