Merge pull request #73 from SolaceProducts/stage-3.0.1 #85
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: Code Analysis (SpotBugs) | |
on: | |
pull_request: | |
push: | |
workflow_dispatch: | |
jobs: | |
dupe_check: | |
name: Check for Duplicate Workflow Run | |
runs-on: ubuntu-latest | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/[email protected] | |
with: | |
concurrent_skipping: same_content | |
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' | |
run-analysis: | |
name: Run SpotBugs Static Code Analysis | |
needs: | |
- dupe_check | |
if: needs.dupe_check.outputs.should_skip != 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache Gradle | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-spotbugs-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-spotbugs- | |
- name: Setup JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: zulu | |
java-version: 11 | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Run static code analysis | |
run: ./gradlew clean spotbugsMain --info | |
- name: Upload Test Artifacts | |
if: always() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Static Code Analysis Results (SpotBugs) | |
path: | | |
**/build/reports/ | |
- name: Upload SARIF file | |
if: success() || failure() | |
uses: github/codeql-action/upload-sarif@v1 | |
with: | |
sarif_file: build/reports/spotbugs/main.sarif | |
- name: Cleanup Gradle Cache | |
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. | |
# Restoring these files from a GitHub Actions cache might cause problems for future builds. | |
run: | | |
rm -f ~/.gradle/caches/modules-2/modules-2.lock | |
rm -f ~/.gradle/caches/modules-2/gc.properties |