GitHub Action
Push SpotBugs report
This action pushes results from SpotBugs (or FindBugs) as check run annotations. 🚀
The action can also be used for any other static analysis tools that produce reports in the SpotBugs XML format. The report itself must be generated in a former build step, for example a Maven build.
Required. A file, directory or wildcard pattern that describes where to find the reports.
Multiple files can be processed through a glob expression, for example: '**/spotbugsXml.xml'
.
Optional. Name for the check run to create. Defaults to spotbugs
.
Optional. Title for the check run to create. Defaults to SpotBugs Source Code Analyzer report
.
Optional. GitHub API access token. Defaults to ${{ github.token }}
, which is set by actions/checkout@v2
minimally.
name: Java CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn -B verify spotbugs:spotbugs
- uses: jwgmeligmeyling/spotbugs-github-action@v1
with:
path: '**/spotbugsXml.xml'
And do not forget to enable XML output for the Maven plugin:
<build>
<plugins>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.0.0</version>
<configuration>
<xmlOutput>true</xmlOutput>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>
</build>
Install the dependencies
$ npm install
Build the typescript and package it for distribution
$ npm run build && npm run pack
Run the tests ✔️
$ npm test
PASS ./index.test.js
✓ throws invalid number (3ms)
✓ wait 500 ms (504ms)
✓ test runs (95ms)
...