Skip to content

Use linux runner

Use linux runner #1337

Workflow file for this run

name: Build
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: oracle
java-version: 17
- uses: actions/checkout@v4
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@v4
with:
path: ~/sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v4
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: |
mkdir ./.sonar/scanner
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 }}
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
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 }}
run:
.\.sonar\scanner\dotnet-sonarscanner end \
/d:sonar.token="${{ secrets.SONAR_TOKEN }}"