-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1245 from newrelic/spotbugs-test
Incorporate Spotbugs support into the agent
- Loading branch information
Showing
12 changed files
with
188 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# GHA to run Spotbugs against top level Java agent projects. Both HTML and XML files are generated for each project | ||
# and attached to the workflow run page under the "Artifacts" section. The files are downloaded as a zip (per project). | ||
# The XML file can be analyzed inside the Spotbugs GUI: https://spotbugs.readthedocs.io/en/stable/running.html | ||
name: Execute Spotbugs | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
agent-ref: | ||
description: 'The ref (branch, SHA, tag) to run spotbugs on' | ||
required: false | ||
default: 'main' | ||
type: string | ||
|
||
jobs: | ||
spotbugs: | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.agent-ref || github.ref || 'main' }} | ||
|
||
- name: Set up Java 8 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 8 | ||
|
||
- name: Save JAVA_HOME as JDK8 env variables | ||
run: | | ||
echo "Current JAVA_HOME = ${JAVA_HOME}" | ||
echo "ORG_GRADLE_PROJECT_jdk8=$JAVA_HOME" >> $GITHUB_ENV | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: setup gradle options | ||
run: echo "GRADLE_OPTIONS=-Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=ORG_GRADLE_PROJECT_jdk8" >> $GITHUB_ENV | ||
|
||
- name: set gradle.properties | ||
run: | | ||
sed -i -e "s|jdk8=8|jdk8=${JDK8}|" gradle.properties.gha | ||
mv gradle.properties.gha gradle.properties | ||
- name: Check environmental variables | ||
run: printenv | sort -f | ||
|
||
- name: Build newrelicJar | ||
env: | ||
JAVA_HOME: ${{ env.ORG_GRADLE_PROJECT_jdk8 }} | ||
run: | | ||
ls -la | ||
cat settings.gradle | ||
./gradlew $GRADLE_OPTIONS clean jar --parallel | ||
ls -la newrelic-agent/build/ | ||
- name: Execute Spotbugs | ||
env: | ||
JAVA_HOME: ${{ env.ORG_GRADLE_PROJECT_jdk8 }} | ||
run: | | ||
./gradlew $GRADLE_OPTIONS spotbugsMain --parallel | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: newrelic-agent-spotbugs-results | ||
path: 'newrelic-agent/build/spotbugs/main.*' | ||
retention-days: 5 | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: newrelic-weaver-spotbugs-results | ||
path: 'newrelic-weaver/build/spotbugs/main.*' | ||
retention-days: 5 | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: agent-bridge-spotbugs-results | ||
path: 'agent-bridge/build/spotbugs/main.*' | ||
retention-days: 5 | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: agent-bridge-datastore-spotbugs-results | ||
path: 'agent-bridge-datastore/build/spotbugs/main.*' | ||
retention-days: 5 | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: agent-model-spotbugs-results | ||
path: 'agent-model/build/spotbugs/main.*' | ||
retention-days: 5 | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: agent-interfaces-spotbugs-results | ||
path: 'agent-interfaces/build/spotbugs/main.*' | ||
retention-days: 5 | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: newrelic-api-spotbugs-results | ||
path: 'newrelic-api/build/spotbugs/main.*' | ||
retention-days: 5 |
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
apply plugin: 'com.github.spotbugs' | ||
|
||
spotbugs { | ||
ignoreFailures = true | ||
showStackTraces = true | ||
showProgress = false | ||
effort = 'default' | ||
reportLevel = 'default' | ||
reportsDir = file("$buildDir/spotbugs") | ||
maxHeapSize = '1g' | ||
includeFilter = file('../gradle/script/spotbugs-include-filter.xml') | ||
} | ||
|
||
spotbugsMain { | ||
reports { | ||
xml.enabled = true | ||
html.enabled = true | ||
} | ||
} | ||
|
||
spotbugsTest { | ||
enabled = false | ||
} |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<FindBugsFilter | ||
xmlns="https://github.com/spotbugs/filter/3.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd"> | ||
|
||
<!-- Only include high priority findings, ignoring any i18n detections --> | ||
<Match> | ||
<Priority value="1" /> | ||
<Or> | ||
<Not> | ||
<Bug pattern="DM_DEFAULT_ENCODING" /> | ||
</Not> | ||
</Or> | ||
</Match> | ||
</FindBugsFilter> |
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
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
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