Skip to content

Commit a3ed103

Browse files
author
Brian Cummings
committed
incorporated SQ into CI
1 parent 4f7eeff commit a3ed103

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/main_pathfinderhonormanager.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,53 @@ on:
77
push:
88
branches:
99
- main
10+
pull_request:
11+
types: [opened, synchronize, reopened]
1012
# workflow_dispatch:
1113

1214
jobs:
15+
sonar:
16+
name: SonarQube Analysis
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- uses: ./.github/actions/setup-dotnet
24+
25+
- name: Cache SonarQube packages
26+
uses: actions/cache@v4
27+
with:
28+
path: ~/.sonar/cache
29+
key: ${{ runner.os }}-sonar
30+
restore-keys: ${{ runner.os }}-sonar
31+
32+
- name: Cache SonarQube scanner
33+
id: cache-sonar-scanner
34+
uses: actions/cache@v4
35+
with:
36+
path: ./.sonar/scanner
37+
key: ${{ runner.os }}-sonar-scanner
38+
restore-keys: ${{ runner.os }}-sonar-scanner
39+
40+
- name: Install SonarQube scanner
41+
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
42+
run: |
43+
mkdir -p ./.sonar/scanner
44+
dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner
45+
46+
- name: Run SonarQube analysis
47+
env:
48+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
49+
run: |
50+
./.sonar/scanner/dotnet-sonarscanner begin /k:"PathfinderHonorManager_PathfinderHonorManagerAPI" /o:"pathfinderhonormanager" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
51+
dotnet build
52+
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
53+
1354
test:
1455
name: Test
56+
needs: sonar
1557
runs-on: ubuntu-latest
1658

1759
steps:
@@ -27,9 +69,16 @@ jobs:
2769
with:
2870
name: coverage-report
2971
path: TestResults
72+
73+
- name: Publish Code Coverage
74+
uses: codecov/codecov-action@v4
75+
with:
76+
files: TestResults/**/*.coverage.xml
77+
fail_ci_if_error: false
3078

3179
analyze:
3280
name: Analyze
81+
needs: test
3382
runs-on: ubuntu-latest
3483
permissions:
3584
actions: read

0 commit comments

Comments
 (0)