99
1010jobs :
1111 build :
12- runs-on : ubuntu -latest
12+ runs-on : windows -latest
1313 name : Validate Build
1414 env :
1515 solution-path : ' ./src/NetCore.Utilities.Email.SendGrid.sln'
@@ -33,20 +33,38 @@ jobs:
3333 uses :
gittools/actions/gitversion/[email protected] 3434 with :
3535 useConfigFile : true
36-
36+ - name : Set up JDK 17
37+ uses : actions/setup-java@v4
38+ with :
39+ java-version : 17
40+ distribution : ' zulu' # Alternative distribution options are available.
41+ - name : Cache SonarQube Cloud packages
42+ uses : actions/cache@v4
43+ with :
44+ path : .\sonar\cache
45+ key : ${{ runner.os }}-sonar
46+ restore-keys : ${{ runner.os }}-sonar
47+ - name : Cache SonarQube Cloud scanner
48+ id : cache-sonar-scanner
49+ uses : actions/cache@v4
50+ with :
51+ path : .\.sonar\scanner
52+ key : ${{ runner.os }}-sonar-scanner
53+ restore-keys : ${{ runner.os }}-sonar-scanner
54+ - name : Install SonarQube Cloud scanner
55+ if : steps.cache-sonar-scanner.outputs.cache-hit != 'true'
56+ shell : powershell
57+ run : |
58+ New-Item -Path .\.sonar\scanner -ItemType Directory
59+ dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
3760 - name : Restore Packages
3861 run : dotnet restore "${{ env.solution-path }}"
39- - name : Build
40- run : dotnet build "${{ env.solution-path }}" --no-restore --configuration Release -p:version=${{ steps.gitversion.outputs.majorMinorPatch }}
41- - name : Test
42- run : dotnet test "${{ env.solution-path }}" --no-build --configuration Release --collect "XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover --logger "trx;LogFileName=unittests.trx"
43-
44- - name : Push Coverage to Codacy
45- shell : bash
62+ - name : Build and analyze
4663 env :
47- CODACY_ORGANIZATION_PROVIDER : ${{ secrets.CODACY_ORGANIZATION_PROVIDER }}
48- CODACY_USERNAME : ${{ secrets.CODACY_USERNAME }}
49- CODACY_PROJECT_NAME : ${{ secrets.CODACY_PROJECT_NAME }}
50- CODACY_API_TOKEN : ${{ secrets.CODACY_API_TOKEN }}
64+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
65+ shell : powershell
5166 run : |
52- bash <(curl -Ls https://coverage.codacy.com/get.sh) report $(find . -name '*.opencover.xml' -printf '-r %p ')
67+ .\.sonar\scanner\dotnet-sonarscanner begin /k:"IowaComputerGurus_netcore.utilities.email.sendgrid" /o:"iowacomputergurus-github" /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
68+ dotnet build "${{ env.solution-path }}" --no-restore --configuration Release -p:version=${{ steps.gitversion.outputs.majorMinorPatch }}
69+ dotnet test "${{ env.solution-path }}" --no-build --configuration Release --collect "XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover --logger "trx;LogFileName=unittests.trx"
70+ .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
0 commit comments