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.
71 lines
2.0 KiB
71 lines
2.0 KiB
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
|
name: Sonarcloud
|
|
|
|
on:
|
|
# Do not run on pull-request because the required tokens
|
|
# cannot be read from there.
|
|
push:
|
|
paths:
|
|
- .github/workflows/sonarcloud.yml
|
|
- "src/**"
|
|
|
|
env:
|
|
dotnetVersion: "7.0.x"
|
|
|
|
jobs:
|
|
sonarcloud:
|
|
name: SonarCloud
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
DOTNET_ROLL_FORWARD: LatestMajor
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
steps:
|
|
- name: Get Source Code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0 # avoid shallow clone for GitVersion
|
|
|
|
- name: Setup dotnet
|
|
uses: actions/setup-dotnet@v3
|
|
with:
|
|
dotnet-version: ${{ env.dotnetVersion }}
|
|
|
|
- name: Install GitVersion
|
|
uses: gittools/actions/gitversion/setup@v0
|
|
with:
|
|
versionSpec: 5.x
|
|
|
|
- name: Determine Version
|
|
uses: gittools/actions/gitversion/execute@v0
|
|
id: gitversion
|
|
|
|
- name: Install Sonar Scanner
|
|
run: dotnet tool install --global dotnet-sonarscanner
|
|
|
|
- name: Begin Sonar Scanner
|
|
run: >
|
|
dotnet sonarscanner begin
|
|
-o:"recyclarr"
|
|
-k:"recyclarr_recyclarr"
|
|
-n:"Recyclarr"
|
|
-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 }}"
|