-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,92 @@ | ||
on: | ||
|
||
pull_request: | ||
|
||
types: [opened, synchronize, reopened] | ||
|
||
|
||
|
||
|
||
name: PR Static Code Analysis | ||
|
||
jobs: | ||
|
||
static-code-analysis: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Code Checkout | ||
|
||
uses: actions/checkout@v4 | ||
|
||
with: | ||
|
||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-dotnet@v4 | ||
|
||
with: | ||
|
||
dotnet-version: '7.0' | ||
- name: Create temporary global.json | ||
run: echo '{"sdk":{"version": "7.0.x"}}' > ./global.json | ||
|
||
- name: Install Protoc | ||
|
||
uses: arduino/setup-protoc@v3 | ||
|
||
with: | ||
|
||
version: "23.x" | ||
|
||
- name: Set up JDK 17 | ||
|
||
uses: actions/setup-java@v1 | ||
|
||
with: | ||
|
||
java-version: 17 | ||
|
||
- name: Cache SonarQube packages | ||
|
||
uses: actions/cache@v1 | ||
|
||
with: | ||
|
||
path: ~/.sonar/cache | ||
|
||
key: ${{ runner.os }}-sonar | ||
|
||
restore-keys: ${{ runner.os }}-sonar | ||
|
||
- name: Cache SonarQube scanner | ||
|
||
id: cache-sonar-scanner | ||
|
||
uses: actions/cache@v1 | ||
|
||
with: | ||
|
||
path: ./.sonar/scanner | ||
|
||
key: ${{ runner.os }}-sonar-scanner | ||
|
||
restore-keys: ${{ runner.os }}-sonar-scanner | ||
|
||
- name: Install SonarScanner for .NET | ||
|
||
run: dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner | ||
|
||
- name: Add .NET global tools to PATH | ||
|
||
run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH | ||
|
||
- name: Begin SonarQube analysis | ||
|
||
run: | | ||
./.sonar/scanner/dotnet-sonarscanner begin /k:"forest-contract" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | ||
dotnet build | ||
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |