Skip to content

Bump Microsoft.AspNetCore.Components.Authorization from 10.0.2 to 10.0.3 #85

Bump Microsoft.AspNetCore.Components.Authorization from 10.0.2 to 10.0.3

Bump Microsoft.AspNetCore.Components.Authorization from 10.0.2 to 10.0.3 #85

Workflow file for this run

name: Quality
on:
workflow_dispatch:
pull_request:
branches: [main]
paths:
- ".github/workflows/quality.yml"
- "Directory.Build.props"
- "Directory.Build.targets"
- "AdvancedDevSample.Api/**"
- "AdvancedDevSample.Application/**"
- "AdvancedDevSample.Infrastructure/**"
- "AdvancedDevSampleDomain/**"
- "AdvancedDevSample.Test/**"
- "AdvancedDevSample.Frontend/**"
- "eng/quality/**"
- "*.sln"
- "*.slnx"
push:
branches: [main]
paths:
- ".github/workflows/quality.yml"
- "Directory.Build.props"
- "Directory.Build.targets"
- "AdvancedDevSample.Api/**"
- "AdvancedDevSample.Application/**"
- "AdvancedDevSample.Infrastructure/**"
- "AdvancedDevSampleDomain/**"
- "AdvancedDevSample.Test/**"
- "AdvancedDevSample.Frontend/**"
- "eng/quality/**"
- "*.sln"
- "*.slnx"
permissions:
contents: read
concurrency:
group: quality-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
quality:
runs-on: ubuntu-latest
env:
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
SONAR_PROJECT_KEY: ${{ vars.SONAR_PROJECT_KEY }}
SONAR_ORGANIZATION: ${{ vars.SONAR_ORGANIZATION }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
NUGET_XMLDOC_MODE: skip
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
cache: true
cache-dependency-path: |
**/*.csproj
**/packages.lock.json
global.json
- name: Setup Java (required by SonarQube scanner)
if: ${{ env.SONAR_HOST_URL != '' && env.SONAR_PROJECT_KEY != '' && env.SONAR_ORGANIZATION != '' && env.SONAR_TOKEN != '' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '21'
- name: Install SonarScanner
if: ${{ env.SONAR_HOST_URL != '' && env.SONAR_PROJECT_KEY != '' && env.SONAR_ORGANIZATION != '' && env.SONAR_TOKEN != '' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
shell: bash
run: |
dotnet tool install --global dotnet-sonarscanner --version 10.*
echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
- name: Begin SonarQube analysis
if: ${{ env.SONAR_HOST_URL != '' && env.SONAR_PROJECT_KEY != '' && env.SONAR_ORGANIZATION != '' && env.SONAR_TOKEN != '' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
shell: bash
run: |
dotnet sonarscanner begin \
/o:"$SONAR_ORGANIZATION" \
/k:"$SONAR_PROJECT_KEY" \
/d:sonar.host.url="$SONAR_HOST_URL" \
/d:sonar.token="$SONAR_TOKEN" \
/d:sonar.qualitygate.wait=true \
/d:sonar.qualitygate.timeout=300 \
/d:sonar.cs.vstest.reportsPaths="**/*.trx" \
/d:sonar.cs.opencover.reportsPaths="TestResults/**/coverage.opencover.xml" \
/d:sonar.exclusions="**/wwwroot/lib/**,**/Migrations/**,**/*.Designer.cs" \
/d:sonar.coverage.exclusions="**/AdvancedDevSample.Frontend/**/*.cs,**/Program.cs,**/Migrations/**,**/*.Designer.cs,**/AdvancedDevSample.Application/DTOs/**/*.cs,**/AdvancedDevSample.Application/Interfaces/**/*.cs,**/AdvancedDevSample.Infrastructure/Persistence/Entities/**/*.cs,**/AdvancedDevSample.Infrastructure/Persistence/Mappers/**/*.cs"
- name: Restore
run: dotnet restore AdvancedDevSample.slnx
- name: Build
run: dotnet build AdvancedDevSample.slnx -c Release -nologo --no-restore
- name: Test with coverage
run: dotnet test AdvancedDevSample.slnx -c Release -nologo --no-build --collect:"XPlat Code Coverage" --settings eng/quality/coverage.runsettings --logger "trx;LogFileName=test-results.trx" --results-directory TestResults
- name: Locate Cobertura coverage report
id: coverage_cobertura
shell: bash
run: |
file="$(find TestResults -name coverage.cobertura.xml -printf '%T@ %p\n' | sort -n | tail -n 1 | cut -d' ' -f2-)"
if [[ -z "$file" ]]; then
echo "Cobertura coverage report not found." >&2
exit 1
fi
echo "file=$file" >> "$GITHUB_OUTPUT"
- name: Enforce coverage thresholds
shell: pwsh
run: |
./eng/quality/check-coverage.ps1 `
-CoverageFile "${{ steps.coverage_cobertura.outputs.file }}" `
-GlobalLineThreshold 60 `
-InfrastructureLineThreshold 45 `
-FrontendLineThreshold 8
- name: End SonarQube analysis (waits for Quality Gate)
if: ${{ always() && env.SONAR_HOST_URL != '' && env.SONAR_PROJECT_KEY != '' && env.SONAR_ORGANIZATION != '' && env.SONAR_TOKEN != '' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
shell: bash
run: dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN"
- name: Verify formatting
run: dotnet format AdvancedDevSample.slnx --verify-no-changes --severity error --verbosity minimal
- name: Install dotnet-ef
shell: bash
run: |
dotnet tool install --global dotnet-ef --version 10.*
echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
- name: Validate EF migrations are up to date
run: |
dotnet ef migrations has-pending-model-changes \
--project AdvancedDevSample.Infrastructure/AdvancedDevSample.Infrastructure.csproj \
--startup-project AdvancedDevSample.Api/AdvancedDevSample.Api.csproj \
--context AppDbContext \
--configuration Release \
--no-build