ci: Move sonarcloud job into separate workflow file

pull/47/head
Robert Dailey 2 years ago
parent 340f415db1
commit e9c611ec8f

@ -130,58 +130,3 @@ jobs:
draft: false
prerelease: ${{ steps.gitversion.outputs.preReleaseTag != '' }}
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 }}"

@ -0,0 +1,72 @@
# 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 }}"
Loading…
Cancel
Save