Bump actions/cache from 3 to 4 #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET Build and SonarCloud scan | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
types: [ "opened", "synchronize", "reopened", "ready_for_review" ] | |
paths: | |
- "EntityRepository/**/*" | |
- "ExtensionMethods/**/*" | |
- "test/**/*" | |
- "Sidekick.sln" | |
- "global.json" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
permissions: | |
pull-requests: read | |
jobs: | |
build-scan: | |
name: Build and scan | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
global-json-file: global.json | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Run dotnet tool restore | |
run: dotnet tool restore | |
- name: Run dotnet restore | |
run: dotnet restore Sidekick.sln | |
- name: Begin sonar scan | |
run: dotnet sonarscanner begin /k:"sogustavo_sidekick" /o:"sogustavo" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml | |
- name: Run dotnet build | |
run: dotnet build -c Release --no-restore Sidekick.sln | |
- name: End sonar scan | |
run: dotnet sonarscanner end /d:sonar.login=${{ secrets.SONAR_TOKEN }} |