Skip to content

Commit

Permalink
Separate sonarcloud into steps
Browse files Browse the repository at this point in the history
  • Loading branch information
renzo-baasdam committed Mar 18, 2024
1 parent 656aef7 commit 28a7e19
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,14 @@ jobs:
java-version: 1.17
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup .NET core versions
uses: actions/setup-dotnet@v4
with:
dotnet-version: '3.1.x'
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
dotnet-version: |
3.1.x
6.0.x
8.0.x
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
Expand All @@ -45,9 +40,9 @@ jobs:
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Test & Analyze
- name: Start SonarCloud scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
Expand All @@ -58,11 +53,20 @@ jobs:
/d:sonar.host.url="https://sonarcloud.io" `
/d:sonar.cs.opencover.reportsPaths="**/coverage.**.opencover.xml" `
/d:sonar.cs.vstest.reportsPaths="**/*.trx"
- name: Test
continue-on-error: true
shell: powershell
run: |
dotnet test specs/Qowaiv.Specs --configuration Release `
--logger trx `
/p:CollectCoverage=true `
/p:ThresholdType=branch `
/p:CoverletOutputFormat=opencover
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
- name: Stop SonarCloud scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner end `
/d:sonar.token="${{ secrets.SONAR_TOKEN }}"

0 comments on commit 28a7e19

Please sign in to comment.