-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (39 loc) · 1.55 KB
/
dotnet-sonar.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
name: back - sonar cloud
on:
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Setup Dotnet coverage
run: |
dotnet tool update --global dotnet-coverage
- name: Install SonarCloud scanners
run: |
dotnet tool update --global dotnet-sonarscanner
- name: Start moby-ryuk for test containers
run: |
docker run -d -v /var/run/docker.sock:/var/run/docker.sock -e RYUK_PORT=8080 -p 8080:8080 testcontainers/ryuk:0.5.1
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACK }}
run: |
dotnet-sonarscanner begin /k:"site-watcher-back-end" /o:"xilapa" /d:sonar.login="${{ secrets.SONAR_TOKEN_BACK }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
dotnet build
dotnet-coverage collect 'dotnet test' -f xml -o 'coverage.xml'
dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN_BACK }}"