11name : CI Build
2+
23on :
34 push :
4- branches : [ " main" ]
5+ branches : [ main ]
56 pull_request :
6- branches : [ " main" ]
7-
7+ branches : [ main ]
8+
89jobs :
910 build :
1011 if : ${{ github.actor != 'dependabot[bot]' }}
1112 name : Build and analyze
1213 runs-on : ubuntu-latest
14+ permissions :
15+ checks : write
16+ pull-requests : write
1317 steps :
14- - name : Setup .NET
15- uses : actions/setup-dotnet@v3
18+ - uses : bmazzarol/bmazzarol/.github/actions/ci-build@main
1619 with :
17- dotnet-version : |
18- 6.0.x
19- 7.0.x
20- - name : Set up JDK 17
21- uses : actions/setup-java@v3
22- with :
23- java-version : 17
24- distribution : ' zulu'
25- - uses : actions/checkout@v3
26- with :
27- fetch-depth : 0
28- - name : Cache SonarCloud packages
29- uses : actions/cache@v3
30- with :
31- path : ~\sonar\cache
32- key : ${{ runner.os }}-sonar
33- restore-keys : ${{ runner.os }}-sonar
34- - name : Cache SonarCloud scanner
35- id : cache-sonar-scanner
36- uses : actions/cache@v3
37- with :
38- path : .\.sonar\scanner
39- key : ${{ runner.os }}-sonar-scanner
40- restore-keys : ${{ runner.os }}-sonar-scanner
41- - name : Install SonarCloud scanner
42- if : steps.cache-sonar-scanner.outputs.cache-hit != 'true'
43- shell : pwsh
44- run : |
45- New-Item -Path ./.sonar/scanner -ItemType Directory
46- dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner
47- dotnet tool install JetBrains.dotCover.GlobalTool
48- - name : Build and analyze
49- env :
50- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
51- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
52- shell : pwsh
53- run : |
54- ./.sonar/scanner/dotnet-sonarscanner begin `
55- /k:"bmazzarol_Http-BuildR" `
56- /o:"bmazzarol" `
57- /d:sonar.token="${{ secrets.SONAR_TOKEN }}" `
58- /d:sonar.host.url="https://sonarcloud.io" `
59- /d:sonar.cs.dotcover.reportsPaths=dotCover.Output.html `
60- /d:sonar.cs.vstest.reportsPaths=**/test-results.trx
61-
62- dotnet dotcover test `
63- --dcReportType=HTML `
64- --dcAttributeFilters=System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute `
65- --verbosity normal `
66- --logger "trx;LogFileName=test-results.trx"
67-
68- ./.sonar/scanner/dotnet-sonarscanner end `
69- /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
70- - name : Upload Test Results
71- uses : actions/upload-artifact@v2
72- if : ${{ always() && github.event_name == 'pull_request' }}
73- with :
74- name : test-results
75- path : ' **/test-results.trx'
76- - name : Publish Test Results
77- uses : EnricoMi/publish-unit-test-result-action@v2
78- if : ${{ always() && github.event_name == 'pull_request' }}
79- with :
80- files : |
81- **/test-results.trx
20+ githubToken : ${{ secrets.GITHUB_TOKEN }}
21+ sonarToken : ${{ secrets.SONAR_TOKEN }}
22+ sonarProjectKey : bmazzarol_Http-BuildR
0 commit comments