Skip to content

Update dotnet tools #214

Update dotnet tools

Update dotnet tools #214

Workflow file for this run

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 }}"