-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (51 loc) · 1.71 KB
/
sonarcloud.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: SonarCloud Scan
on:
push:
branches:
- 'develop'
pull_request_target:
branches:
- 'develop'
workflow_dispatch:
env:
DOTNET_VERSION: '8.0.x'
jobs:
scan:
name: SonarCloud Scan
runs-on: ubuntu-latest
env:
DatabaseConfiguration__UseInMemoryDb: true
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 Backend/Bones.Api
dotnet tool restore
cd ../..
cd Frontend/Bones.Api.Client
dotnet tool 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 --no-incremental
dotnet test --no-build --collect:"XPlat Code Coverage;Format=opencover"
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"