Skip to content

Merge pull request #149 from xilapa/hotfix/rule-mismatch-between-fron… #145

Merge pull request #149 from xilapa/hotfix/rule-mismatch-between-fron…

Merge pull request #149 from xilapa/hotfix/rule-mismatch-between-fron… #145

Workflow file for this run

name: back - sonar cloud
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- name: Install dotnet 3.1 (sonar dependency)
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Setup Dotnet coverage
run: |
dotnet tool update --global dotnet-coverage
- name: Install SonarCloud scanners
run: |
dotnet tool update --global dotnet-sonarscanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACK }}
run: |
dotnet-sonarscanner begin /k:"site-watcher-back-end" /o:"xilapa" /d:sonar.token="${{ secrets.SONAR_TOKEN_BACK }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage
dotnet build --no-incremental
dotnet-coverage collect dotnet test -f xml -o coverage
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN_BACK }}"