Merge pull request #9 from EzioDEVio/dependabot/nuget/BlobScanFunctio… #24
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: SonarCloud Analysis | ||
#on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
jobs: | ||
build-and-analyze: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
- name: Setup .NET 6 | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: '6.0.x' # Make sure this matches your project's .NET version | ||
- name: Setup Java 17 # SonarScanner requires Java | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
- name: Install SonarScanner for .NET | ||
run: dotnet tool install --global dotnet-sonarscanner | ||
- name: Add SonarScanner to PATH | ||
run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH | ||
- name: Begin SonarCloud Analysis | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub for the action | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # SonarCloud token for authentication | ||
run: | | ||
export PATH="$HOME/.dotnet/tools:$PATH" | ||
dotnet sonarscanner begin \ | ||
/k:"theslash84_AzureFunctionClamavKubernetes" \ | ||
/o:"theslash84" \ | ||
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" \ | ||
/d:sonar.host.url="https://sonarcloud.io" | ||
- name: Build Project | ||
run: dotnet build | ||
- name: End SonarCloud Analysis | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
run: | | ||
export PATH="$HOME/.dotnet/tools:$PATH" | ||
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" |