Skip to content

Remove continue-on-error from test step, but stop sonarcloud even aft… #1335

Remove continue-on-error from test step, but stop sonarcloud even aft…

Remove continue-on-error from test step, but stop sonarcloud even aft… #1335

Workflow file for this run

name: Build
on: [push]
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
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 versions
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
6.0.x
8.0.x
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Build
run: dotnet build --configuration Release
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Start 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 begin `
/k:"Qowaiv_Qowaiv" `
/o:"qowaiv" `
/d:sonar.token="${{ secrets.SONAR_TOKEN }}" `
/d:sonar.host.url="https://sonarcloud.io" `
/d:sonar.cs.opencover.reportsPaths="**/coverage.**.opencover.xml" `
/d:sonar.cs.vstest.reportsPaths="**/*.trx"
- name: Test
shell: powershell
run: |
dotnet test specs/Qowaiv.Specs --configuration Release `
--logger trx `
/p:CollectCoverage=true `
/p:ThresholdType=branch `
/p:CoverletOutputFormat=opencover
- name: Stop SonarCloud scanner
if: success() || failure()
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 }}"