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

52 lines
1.4 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:
# Explicitly specifying this results in tags being ignored, which is the goal.
branches: ["**"]
paths:
- .github/workflows/sonarcloud.yml
- sonar-project.properties
- "src/**"
- "tests/**"
env:
dotnetVersion: 8.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
# GH Runners come with Java 11, which is deprecated by Sonarcloud
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 20
java-package: jre
distribution: temurin
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.dotnetVersion }}
- name: Install Tooling
run: |
dotnet tool install --global dotnet-sonarscanner
dotnet tool install --global GitVersion.Tool
- name: Perform Scan
run: pwsh ci/RunSonarScan.ps1 -SonarToken "${{ secrets.SONAR_TOKEN }}"