|
9 | 9 | jobs: |
10 | 10 | build: |
11 | 11 |
|
12 | | - runs-on: ubuntu-latest |
| 12 | + runs-on: windows-latest |
13 | 13 |
|
14 | 14 | strategy: |
15 | 15 | matrix: |
16 | | - dotnet: [ '6.0.x', '8.0.x' ] |
| 16 | + dotnet: [ '8.0.x' ] |
17 | 17 | name: .NET ${{ matrix.dotnet }} |
18 | 18 |
|
19 | 19 | steps: |
| 20 | + - name: Set up JDK 17 |
| 21 | + uses: actions/setup-java@v4 |
| 22 | + with: |
| 23 | + java-version: 17 |
| 24 | + distribution: 'zulu' # Alternative distribution options are available. |
20 | 25 | - uses: actions/checkout@v4 |
21 | 26 | - name: Setup .NET |
22 | 27 | uses: actions/setup-dotnet@v3 |
23 | 28 | with: |
24 | 29 | dotnet-version: ${{ matrix.dotnet }} |
| 30 | + - name: Cache SonarQube Cloud packages |
| 31 | + uses: actions/cache@v4 |
| 32 | + with: |
| 33 | + path: ~\sonar\cache |
| 34 | + key: ${{ runner.os }}-sonar |
| 35 | + restore-keys: ${{ runner.os }}-sonar |
| 36 | + - name: Cache SonarQube Cloud scanner |
| 37 | + id: cache-sonar-scanner |
| 38 | + uses: actions/cache@v4 |
| 39 | + with: |
| 40 | + path: .\.sonar\scanner |
| 41 | + key: ${{ runner.os }}-sonar-scanner |
| 42 | + restore-keys: ${{ runner.os }}-sonar-scanner |
| 43 | + - name: Install SonarQube Cloud scanner |
| 44 | + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' |
| 45 | + shell: powershell |
| 46 | + run: | |
| 47 | + New-Item -Path .\.sonar\scanner -ItemType Directory |
| 48 | + dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner |
25 | 49 | - name: Restore dependencies |
26 | 50 | run: dotnet restore |
| 51 | + - name: SonarCloudPrepare |
| 52 | + env: |
| 53 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any |
| 54 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 55 | + run: .\.sonar\scanner\dotnet-sonarscanner begin /k:"TensionDev_AutomaticIdentificationSystem" /o:"tensiondev" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.scanner.scanAll=false /d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml |
27 | 56 | - name: Build |
28 | 57 | run: dotnet build --no-restore |
29 | 58 | - name: Test |
30 | | - run: dotnet test --no-build --verbosity normal |
| 59 | + run: dotnet test --no-build --verbosity normal --collect "XPlat Code Coverage;Format=opencover" |
| 60 | + - name: SonarCloudAnalyze |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any |
| 63 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 64 | + run: .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |
0 commit comments