Skip to content

Commit aa6214e

Browse files
Update pre-integration workflow to have 2 jobs: 1 to build and test, the other for SonarCloud code analysis
1 parent 30545a2 commit aa6214e

File tree

1 file changed

+48
-11
lines changed

1 file changed

+48
-11
lines changed

.github/workflows/pre-integration.yml

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- reopened
99

1010
jobs:
11-
dotnet-build:
11+
dotnet-test:
1212
strategy:
1313
matrix:
1414
os: [ubuntu-latest, macos-latest, windows-latest]
@@ -30,29 +30,66 @@ jobs:
3030
- name: 🔁 Restore packages
3131
run: dotnet restore
3232

33-
- name: 🛠️ Building library in release mode
34-
run: dotnet build -c Release --no-restore
33+
- name: 🧪 Run unit tests in release mode
34+
run: dotnet test -c Release --no-restore
3535

36-
dotnet-test:
37-
runs-on: ubuntu-latest
38-
needs:
39-
- dotnet-build
36+
sonar-cloud:
37+
runs-on: windows-latest
4038
steps:
4139
- name: 🛒 Checkout repository
4240
uses: actions/checkout@v2
4341
with:
4442
fetch-depth: 0
43+
token: ${{ secrets.PAT_WORKFLOWS }}
4544

46-
- name: ⚙️ Setup dotnet 6.0.x
47-
uses: actions/setup-dotnet@v1
45+
- name: ⚙️ Set up JDK 11
46+
uses: actions/setup-java@v1
4847
with:
49-
dotnet-version: '6.0.x'
48+
java-version: 1.11
49+
50+
- name: 🧹 Clean
51+
run: dotnet clean -c Release && dotnet nuget locals all --clear
5052

5153
- name: 🔁 Restore packages
5254
run: dotnet restore
5355

56+
- name: 🌩️ SonarCloud install scanner
57+
run: dotnet tool install --global dotnet-sonarscanner
58+
59+
- name: 🌩️ SonarCloud Prepare
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
63+
shell: pwsh
64+
run: |
65+
dotnet-sonarscanner begin `
66+
/k:"atc-azure-messaging" `
67+
/o:"atc-net" `
68+
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" `
69+
/d:sonar.host.url="https://sonarcloud.io" `
70+
/d:sonar.cs.vscoveragexml.reportsPaths=**/*.coveragexml
71+
5472
- name: 🛠️ Build
5573
run: dotnet build -c Release --no-restore /p:UseSourceLink=true
5674

5775
- name: 🧪 Run unit tests
58-
run: dotnet test -c Release --no-build
76+
run: dotnet test -c Release --no-build --collect "Code coverage"
77+
78+
- name: ⚙️ Setup dotnet 6.0.x
79+
uses: actions/setup-dotnet@v1
80+
with:
81+
dotnet-version: '6.0.x'
82+
83+
- name: Convert Code Coverage
84+
continue-on-error: true
85+
run: |
86+
dotnet tool update dotnet-coverageconverter --global
87+
dotnet-coverageconverter --CoverageFilesFolder . --ProcessAllFiles
88+
89+
- name: 🌩️ SonarCloud analyze
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
93+
shell: pwsh
94+
run: |
95+
dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

0 commit comments

Comments
 (0)