Update dotnet tools #214
This file contains 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: SonarCloud Scan | |
on: | |
push: | |
branches: | |
- 'develop' | |
pull_request_target: | |
branches: | |
- 'develop' | |
workflow_dispatch: | |
env: | |
DOTNET_VERSION: '9.0.x' | |
jobs: | |
scan: | |
name: SonarCloud Scan | |
runs-on: ubuntu-latest | |
env: | |
DatabaseConfiguration__UseInMemoryDb: true | |
ASPNETCORE_ENVIRONMENT: "Development" | |
DOTNET_ENVIRONMENT: "Development" | |
steps: | |
# Setup | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Need to disable shallow clone for SonarCloud to scan properly: https://stackoverflow.com/a/62500400 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Restore Tools | |
run: | | |
cd Services/Bones.Api | |
dotnet tool restore | |
cd ../.. | |
cd Services/Bones.BackgroundService | |
dotnet tool restore | |
cd ../.. | |
cd Frontend/Bones.Api.Client | |
dotnet tool restore | |
cd ../.. | |
cd Frontend/Bones.WebUI | |
dotnet workload restore | |
cd ../.. | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: 'adopt' | |
# Test | |
- name: Test and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
dotnet tool install --global dotnet-sonarscanner | |
dotnet-sonarscanner begin /k:"CorruptComputer_Bones" /o:"corruptcomputer" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths=./Tests/*/*.UnitTests/TestResults/*/coverage.opencover.xml /d:sonar.scanner.scanAll=false | |
dotnet build --configuration Debug --no-incremental | |
dotnet test --no-build --collect:"XPlat Code Coverage;Format=opencover" | |
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |