-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (47 loc) · 1.48 KB
/
sonarcloud.yml
File metadata and controls
50 lines (47 loc) · 1.48 KB
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
name: SonarCloud
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
sonarcloud:
name: SonarCloud Scan
runs-on: ubuntu-latest
if: ${{ env.SONAR_TOKEN_PRESENT == 'true' || github.event_name == 'workflow_dispatch' }}
env:
SONAR_TOKEN_PRESENT: ${{ secrets.SONAR_TOKEN != '' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Install SonarScanner
run: dotnet tool install --global dotnet-sonarscanner
- name: Begin SonarCloud
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
export PATH="$PATH:$HOME/.dotnet/tools"
dotnet sonarscanner begin /k:"cce-knowledge-center" /o:"ministry-of-energy" \
/d:sonar.token="$SONAR_TOKEN" /d:sonar.host.url="https://sonarcloud.io"
- name: Build + test
run: |
dotnet build backend/CCE.sln --nologo -c Debug
dotnet test backend/CCE.sln --no-build --nologo --collect:"XPlat Code Coverage"
- name: End SonarCloud
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
export PATH="$PATH:$HOME/.dotnet/tools"
dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN"