-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (42 loc) · 1.44 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
name: SonarCloud Scan
on:
push:
branches:
- 'develop'
pull_request_target:
branches:
- 'develop'
workflow_dispatch:
env:
DOTNET_VERSION: '8.0.x'
jobs:
test:
name: Test
runs-on: ubuntu-latest
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: 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 }}
BUILD_ENVIRONMENT: 'GitHub'
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
dotnet build --no-incremental
dotnet test --no-build --collect:"XPlat Code Coverage;Format=opencover"
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"