build(sonar-cloud): cache and install SonarCloud Scanner, ignore certain files

This commit is contained in:
Jean Gatto
2023-05-28 11:04:57 -03:00
parent ecf7baa2d1
commit 5e78cfb9da
+8 -5
View File
@@ -7,10 +7,13 @@ on:
branches: [ main ]
paths-ignore:
- "README.md"
- "docs/**"
- "**/*.md"
- "**/*.yml"
jobs:
build:
name: Build and analyze
name: Build and Analyze
runs-on: windows-latest
steps:
@@ -24,14 +27,14 @@ jobs:
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
- name: Cache SonarCloud Packages
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
- name: Cache SonarCloud Scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
@@ -39,14 +42,14 @@ jobs:
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
- 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
- name: Build and analyze
- name: Build, Teste and Analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}