1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 06:25:42 +00:00
X10D/.github/workflows/sonarcloud.yml

57 lines
1.8 KiB
YAML
Raw Normal View History

2023-08-27 04:21:41 +01:00
name: SonarCloud
2021-04-27 01:41:32 +01:00
on:
push:
branches:
- main
workflow_dispatch:
2021-04-27 01:41:32 +01:00
pull_request:
2023-08-27 04:21:41 +01:00
types: [ opened, synchronize, reopened ]
2021-04-27 01:41:32 +01:00
jobs:
2023-08-27 04:21:41 +01:00
sonarcloud:
name: SonarCloud Analysis
2021-04-27 01:41:32 +01:00
runs-on: windows-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
2021-04-27 01:41:32 +01:00
with:
java-version: 17
distribution: 'zulu'
2023-08-27 04:21:41 +01:00
- uses: actions/checkout@v3
2021-04-27 01:41:32 +01:00
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
2023-08-27 04:21:41 +01:00
2021-04-27 01:41:32 +01:00
- name: Cache SonarCloud packages
uses: actions/cache@v3
2021-04-27 01:41:32 +01:00
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
2023-08-27 04:21:41 +01:00
2021-04-27 01:41:32 +01:00
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
2021-04-27 01:41:32 +01:00
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
2023-08-27 04:21:41 +01:00
2021-04-27 01:41:32 +01:00
- 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
2023-08-27 04:21:41 +01:00
2021-04-27 01:41:32 +01:00
- name: Build and analyze
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:"oliverbooth_X10D" /o:"oliverbooth" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
2022-04-20 22:53:32 +01:00
dotnet build --no-incremental
2022-04-20 23:00:33 +01:00
dotnet dotcover test --dcReportType=HTML
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"