Repository navigation
57 lines (49 loc) · 2.14 KB
/
Copy pathCodeQuality.yml
File metadata and controls
57 lines (49 loc) · 2.14 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
51
52
53
54
55
56
57
name: Build & Test & SonarQube
on:
push:
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
# secrets are not available to Dependabot and to pull requests from forks; the build and the tests still run,
# only the SonarQube analysis is skipped
HAS_SONAR_TOKEN: ${{ secrets.SONAR_TOKEN != '' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'temurin'
java-version: '17'
overwrite-settings: false
- name: Setup dotnet
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: '10.0.x'
- name: Restore dependencies
run: dotnet restore uml4net.sln
- name: Install tools
run: |
dotnet tool install --global dotnet-sonarscanner
dotnet tool install --global dotnet-coverage
- name: Sonarqube Begin
if: env.HAS_SONAR_TOKEN == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_SCANNER_OPTS: "-Xmx4096m"
run: dotnet sonarscanner begin /k:"STARIONGROUP_uml4net" /o:"stariongroup" /d:sonar.token="$SONAR_TOKEN" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
- name: Build
run: dotnet build --no-restore --no-incremental /p:ContinuousIntegrationBuild=true
- name: Run Tests and Compute Coverage
run: dotnet-coverage collect "dotnet test uml4net.sln --no-restore --no-build --verbosity normal" -f xml -o "coverage.xml"
- name: Sonarqube end
if: env.HAS_SONAR_TOKEN == 'true'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN"