X10D/.github/workflows/sonarcloud.yml

62 lines
1.8 KiB
YAML
Raw Normal View History

2023-08-27 03:21:41 +00:00
name: SonarCloud
2021-04-27 00:41:32 +00:00
on:
push:
branches:
- main
workflow_dispatch:
2021-04-27 00:41:32 +00:00
pull_request:
2023-08-27 03:21:41 +00:00
types: [ opened, synchronize, reopened ]
2021-04-27 00:41:32 +00:00
jobs:
2023-08-27 03:21:41 +00:00
sonarcloud:
name: SonarCloud Analysis
2021-04-27 00:41:32 +00:00
runs-on: windows-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
2021-04-27 00:41:32 +00:00
with:
java-version: 17
distribution: 'zulu'
2023-08-27 03:21:41 +00:00
- uses: actions/checkout@v3
2021-04-27 00:41:32 +00:00
with:
2024-02-12 01:46:16 +00:00
fetch-depth: 0
2023-08-27 03:21:41 +00:00
2021-04-27 00:41:32 +00:00
- name: Cache SonarCloud packages
uses: actions/cache@v3
2021-04-27 00:41:32 +00:00
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
2023-08-27 03:21:41 +00:00
2021-04-27 00:41:32 +00:00
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
2021-04-27 00:41:32 +00:00
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
2023-08-27 03:21:41 +00:00
2021-04-27 00:41:32 +00: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 03:21:41 +00:00
- name: Install dotCover
shell: powershell
run: |
dotnet tool install --global JetBrains.dotCover.GlobalTool
2021-04-27 00:41:32 +00:00
- name: Build and analyze
env:
2024-02-12 01:46:16 +00:00
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2021-04-27 00:41:32 +00:00
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
2024-02-12 01:46:16 +00:00
.\.sonar\scanner\dotnet-sonarscanner begin /k:"X10D" /o:"oliverbooth" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
2022-04-20 21:53:32 +00:00
dotnet build --no-incremental
2022-04-20 22:00:33 +00:00
dotnet dotcover test --dcReportType=HTML
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"