Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: refactor code_analysis #866

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 2 additions & 38 deletions .github/workflows/code_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,7 @@ on:
- "docs/**"

jobs:
is_java_project:
runs-on: ubuntu-latest
outputs:
pom_exists: ${{ steps.check_files.outputs.files_exists }}
checkstyle_active: ${{ steps.check_checkstyle.outputs.checkstyle_active }}
spotbugs_active: ${{ steps.check_spotbugs.outputs.spotbugs_active }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v2
with:
files: "pom.xml"
- name: check_checkstyle
id: check_checkstyle
run: echo "checkstyle_active=$(if grep -q "<artifactId>maven-checkstyle-plugin</artifactId>" pom.xml; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT
- name: check_spotbugs
id: check_spotbugs
run: echo "spotbugs_active=$(if grep -q "<artifactId>spotbugs-maven-plugin</artifactId>" pom.xml; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT
run_checkstyle:
needs: [is_java_project]
if: needs.is_java_project.outputs.pom_exists == 'true' && needs.is_java_project.outputs.checkstyle_active == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -40,20 +18,6 @@ jobs:
with:
distribution: "temurin"
java-version: "17"
cache: "maven"
cache: "gradle"
- name: Run style checks
run: mvn -B checkstyle:check --file pom.xml
run_spotbugs:
needs: [is_java_project]
if: needs.is_java_project.outputs.pom_exists == 'true' && needs.is_java_project.outputs.spotbugs_active == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
cache: "maven"
- name: Run static code analysis
run: mvn -B compile spotbugs:check --file pom.xml
run: ./gradlew checkstyleMain checkstyleTest
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ allprojects {
configFile = rootProject.file("docs/dev/checkstyle/checkstyle-config.xml")
configDirectory.set(rootProject.file("docs/dev/checkstyle"))
maxErrors = 0 // does not tolerate errors
maxWarnings = 0
sourceSets = emptySet()
}

repositories {
Expand Down
Loading