Skip to content

Commit 279d5f5

Browse files
Create build.yml
1 parent c292ba8 commit 279d5f5

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: SonarQube
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
jobs:
9+
build:
10+
name: Build and analyze
11+
runs-on: windows-latest
12+
steps:
13+
- name: Set up JDK 17
14+
uses: actions/setup-java@v4
15+
with:
16+
java-version: 17
17+
distribution: 'zulu' # Alternative distribution options are available.
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
21+
- name: Cache SonarQube Cloud packages
22+
uses: actions/cache@v4
23+
with:
24+
path: ~\sonar\cache
25+
key: ${{ runner.os }}-sonar
26+
restore-keys: ${{ runner.os }}-sonar
27+
- name: Cache SonarQube Cloud scanner
28+
id: cache-sonar-scanner
29+
uses: actions/cache@v4
30+
with:
31+
path: ${{ runner.temp }}\scanner
32+
key: ${{ runner.os }}-sonar-scanner
33+
restore-keys: ${{ runner.os }}-sonar-scanner
34+
- name: Install SonarQube Cloud scanner
35+
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
36+
shell: powershell
37+
run: |
38+
New-Item -Path ${{ runner.temp }}\scanner -ItemType Directory
39+
dotnet tool update dotnet-sonarscanner --tool-path ${{ runner.temp }}\scanner
40+
- name: Build and analyze
41+
env:
42+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
43+
shell: powershell
44+
run: |
45+
${{ runner.temp }}\scanner\dotnet-sonarscanner begin /k:"JonathanTroyer_Progress-Renderer" /o:"jonathantroyer" /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
46+
dotnet build
47+
${{ runner.temp }}\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

0 commit comments

Comments
 (0)