Skip to content

Updated AwesomeAssertions to latest stable. #179

Updated AwesomeAssertions to latest stable.

Updated AwesomeAssertions to latest stable. #179

name: Build, Test, and Analyze
on: [ push, workflow_dispatch ]
jobs:
build-test-analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Nerdbank.GitVersioning requires deep clone. Deep clone improves Sonar.
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
dotnet-quality: 'ga'
- run: dotnet tool install --global dotnet-coverage
- uses: actions/setup-java@v5 # Sonar.
with:
java-version: 17
distribution: 'zulu'
- run: dotnet tool install --global dotnet-sonarscanner
- run: dotnet restore --locked-mode
- env:
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: pwsh
run: |
$version = & nbgv get-version --variable NuGetPackageVersion
dotnet-sonarscanner begin `
/o:"northsouthsystems" `
/k:"NorthSouthSystems_NorthSouthSystems.Text" `
/v:$version `
/d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml `
/d:sonar.dotnet.excludeTestProjects=true `
/d:sonar.host.url="https://sonarcloud.io"
$beginExit = $LASTEXITCODE
dotnet build --no-restore --configuration Release
$buildExit = $LASTEXITCODE
dotnet-coverage collect `
"dotnet test --no-build --configuration Release --verbosity normal" `
-f xml -o "coverage.xml"
$coverageTestExit = $LASTEXITCODE
dotnet-sonarscanner end
$endExit = $LASTEXITCODE
$finalExit = if ($beginExit -ne 0) { $beginExit }
elseif ($buildExit -ne 0) { $buildExit }
elseif ($coverageTestExit -ne 0) { $coverageTestExit }
elseif ($endExit -ne 0) { $endExit }
else { 0 }
exit $finalExit