1- name : Analyse Code Quality
1+ name : Build and SonarQube
22on :
33 push :
44 branches :
77 types : [opened, synchronize, reopened]
88jobs :
99 build :
10- name : Build
10+ name : Build and analyze
1111 runs-on : windows-latest
1212 steps :
13- - name : Set up JDK 11
14- uses : actions/setup-java@v1
13+ - name : Set up JDK 17
14+ uses : actions/setup-java@v4
1515 with :
16- java-version : 1.11
17- - uses : actions/checkout@v2
16+ java-version : 17
17+ distribution : ' zulu' # Alternative distribution options are available.
18+ - uses : actions/checkout@v4
1819 with :
1920 fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
2021 - name : Setup .NET
21- uses : actions/setup-dotnet@v1
22+ uses : actions/setup-dotnet@v4
2223 with :
23- dotnet-version : 6 .0.x
24- include-prerelease : false
25- - name : Cache SonarCloud packages
26- uses : actions/cache@v1
24+ dotnet-version : 9 .0.x
25+ dotnet-quality : preview
26+ - name : Cache SonarQube Cloud packages
27+ uses : actions/cache@v4
2728 with :
2829 path : ~\sonar\cache
2930 key : ${{ runner.os }}-sonar
3031 restore-keys : ${{ runner.os }}-sonar
31- - name : Cache SonarCloud scanner
32+ - name : Cache SonarQube Cloud scanner
3233 id : cache-sonar-scanner
33- uses : actions/cache@v1
34+ uses : actions/cache@v4
3435 with :
3536 path : .\.sonar\scanner
3637 key : ${{ runner.os }}-sonar-scanner
3738 restore-keys : ${{ runner.os }}-sonar-scanner
38- - name : Install SonarCloud scanner
39+ - name : Install SonarQube Cloud scanner
3940 if : steps.cache-sonar-scanner.outputs.cache-hit != 'true'
4041 shell : powershell
4142 run : |
4243 New-Item -Path .\.sonar\scanner -ItemType Directory
4344 dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
4445 - name : Build and analyze
4546 env :
46- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
4747 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
48- DOTNET_ROLL_FORWARD : Major
4948 shell : powershell
5049 run : |
5150 $workingDir=pwd
52- .\.sonar\scanner\dotnet-sonarscanner begin /k:"lsolano_triplex" /o:"lsolano" /d:sonar.login ="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.dotnet.excludeTestProjects=true /d:sonar.exclusions=tests/**,src/**/GlobalUsings.cs /d:sonar.cs.opencover.reportsPaths="$workingDir/test-results/coverage.net6 .0.opencover.xml"
51+ .\.sonar\scanner\dotnet-sonarscanner begin /k:"lsolano_triplex" /o:"lsolano" /d:sonar.token ="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.dotnet.excludeTestProjects=true /d:sonar.exclusions=tests/**,src/**/GlobalUsings.cs /d:sonar.cs.opencover.reportsPaths="$workingDir/test-results/coverage.net9 .0.opencover.xml"
5352 if ("$GITHUB_REF" -ceq "refs/heads/master") {$configuration="Release"} else {$configuration="Debug"}
5453 dotnet clean -c "$configuration"
5554 dotnet build -c "$configuration"
56- dotnet test --no-restore -c "$configuration" /p:CollectCoverage=true /p:CoverletOutputFormat=json%2copencover /p:MergeWith="$workingDir/test-results/coverage.json" /p:CoverletOutput="$workingDir/test-results/"
57- .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login ="${{ secrets.SONAR_TOKEN }}"
55+ dotnet test --no-restore -c "$configuration" /p:ExcludeByAttribute=GeneratedCode /p: CollectCoverage=true /p:CoverletOutputFormat=json%2copencover /p:MergeWith="$workingDir/test-results/coverage.json" /p:CoverletOutput="$workingDir/test-results/"
56+ .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token ="${{ secrets.SONAR_TOKEN }}"
0 commit comments