You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/.github/workflows/sonarcloud.yml

73 lines
1.9 KiB

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Sonarcloud
on:
push:
paths-ignore:
- "wiki/**"
- "**.md"
pull_request:
paths-ignore:
- "wiki/**"
- "**.md"
env:
dotnetVersion: "6.0.x"
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
env:
DOTNET_ROLL_FORWARD: LatestMajor
GITHUB_TOKEN: ${{ secrets.PAT }}
steps:
- name: Get Source Code
uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone for GitVersion
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.dotnetVersion }}
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: 5.x
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0.9.7
id: gitversion
- name: Install Sonar Scanner
run: dotnet tool install --global dotnet-sonarscanner
- name: Begin Sonar Scanner
run: >
dotnet sonarscanner begin
-o:"rcdailey"
-k:"rcdailey_trash-updater"
-n:"Trash Updater"
-v:"${{ steps.gitversion.outputs.fullSemVer }}"
-d:sonar.login="${{ secrets.SONAR_TOKEN }}"
-d:sonar.host.url="https://sonarcloud.io"
-d:sonar.cs.opencover.reportsPaths="**/TestResults/*/coverage.opencover.xml"
# Run a full build command because if we just do the tests, it will not build everything.
- name: Build
run: dotnet build src
- name: Test
run: >
dotnet test src
--no-build
--collect:"XPLat Code Coverage"
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
- name: End Sonar Scanner
run: >
dotnet sonarscanner end
-d:sonar.login="${{ secrets.SONAR_TOKEN }}"