Skip to content
Merged
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
114 changes: 90 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,81 +14,147 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v7
- name: Set up Java
uses: actions/setup-java@v4
uses: actions/setup-java@v6
with:
distribution: "graalvm"
java-version: "21"
- name: Cache Gradle Packages
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: ~/.gradle/caches
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Build Project
run: ./gradlew assemble
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"

pmd:
name: PMD Analysis
spotless:
name: Spotless
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v7
- name: Set up Java
uses: actions/setup-java@v4
uses: actions/setup-java@v6
with:
distribution: "graalvm"
java-version: "21"
- name: Cache Gradle Packages
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: ~/.gradle/caches
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Run PMD Analysis
run: ./gradlew pmdMain
- name: Run Spotless
run: ./gradlew spotlessCheck
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"

checkstyle:
name: Checkstyle Analysis
name: Checkstyle
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v7
- name: Set up Java
uses: actions/setup-java@v4
uses: actions/setup-java@v6
with:
distribution: "graalvm"
java-version: "21"
- name: Cache Gradle Packages
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: ~/.gradle/caches
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Run Checkstyle
run: ./gradlew checkstyleMain
id: checkstyle
run: |
set +e
./gradlew checkstyleMain --continue
python3 code-analysis/ci/gitlab-code-quality.py build/reports/checkstyle/main.xml build/reports/ci/checkstyle-code-quality.json
echo "exit_code=$?" >> "$GITHUB_OUTPUT"
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- name: Write Checkstyle Summary
if: always()
run: |
python3 code-analysis/ci/report-summary.py build/reports/checkstyle/main.xml >> "$GITHUB_STEP_SUMMARY"
- name: Publish Checkstyle Report
if: always()
uses: actions/upload-artifact@v4
with:
name: checkstyle-report
path: |
build/reports/checkstyle/
build/reports/ci/checkstyle-code-quality.json
- name: Fail on Checkstyle Violations
if: steps.checkstyle.outputs.exit_code != '0'
run: exit 1

test:
name: Unit Tests
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v7
- name: Set up Java
uses: actions/setup-java@v4
uses: actions/setup-java@v6
with:
distribution: "graalvm"
java-version: "21"
- name: Cache Gradle Packages
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: ~/.gradle/caches
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Run Unit Tests
run: ./gradlew test
id: unit_tests
run: |
set +e
./gradlew test jacocoTestReport --continue
echo "exit_code=$?" >> "$GITHUB_OUTPUT"
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- name: Write Unit Test Summary
if: always()
env:
REPORT_COMMIT_SHA: ${{ github.sha }}
REPORT_BRANCH: ${{ github.head_ref || github.ref_name }}
REPORT_WORKFLOW: ${{ github.workflow }}
REPORT_RUN_NUMBER: ${{ github.run_number }}
REPORT_OS: ${{ runner.os }}
REPORT_RUNTIME: GraalVM
REPORT_RUNTIME_VERSION: "21"
REPORT_TEST_FRAMEWORK: JUnit Jupiter (Quarkus)
REPORT_TEST_EXIT_CODE: ${{ steps.unit_tests.outputs.exit_code }}
run: |
python3 code-analysis/ci/report-summary.py junit build/test-results/test \
--jacoco build/reports/jacoco/test/jacocoTestReport.xml \
>> "$GITHUB_STEP_SUMMARY"
- name: Publish Test and Coverage Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-test-report
path: |
build/reports/tests/test/
build/reports/jacoco/test/html/
build/reports/jacoco/test/jacocoTestReport.xml
- name: Fail on Test Failures
if: steps.unit_tests.outputs.exit_code != '0'
run: exit 1

docker-image-jvm:
name: Docker image JVM
Expand All @@ -97,7 +163,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v7
- name: Build and Push Image
uses: explorviz/deployment/.github/actions/build-and-deploy-quarkus-jvm@main
with:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ nb-configuration.xml
*.orig
*.rej

# Python
__pycache__/
*.py[cod]

# Local environment
.env

Expand Down
45 changes: 34 additions & 11 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default:
tags:
- exec-docker
image: ghcr.io/graalvm/graalvm-community:21
cache: # Cache modules in between jobs
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- .gradle
Expand All @@ -29,30 +29,53 @@ build:
stage: build
script: ./gradlew assemble
artifacts:
expire_in: 1 week
paths:
- build
- build/libs/

pmd:
spotless:
stage: code-analysis
script: ./gradlew pmdMain
artifacts:
paths:
- build
script: ./gradlew spotlessCheck

checkstyle:
stage: code-analysis
script: ./gradlew checkstyleMain
script:
- |
set +e
./gradlew checkstyleMain --continue
CHECKSTYLE_EXIT=$?
python3 code-analysis/ci/gitlab-code-quality.py build/reports/checkstyle/main.xml build/reports/ci/checkstyle-code-quality.json
python3 code-analysis/ci/report-summary.py build/reports/checkstyle/main.xml
exit $CHECKSTYLE_EXIT
artifacts:
when: always
expire_in: 1 week
reports:
codequality: build/reports/ci/checkstyle-code-quality.json
paths:
- build
- build/reports/checkstyle/
- build/reports/ci/checkstyle-code-quality.json

unit-test:
stage: test
script:
- ./gradlew test
- |
set +e
./gradlew test jacocoTestReport --continue
TEST_EXIT=$?
REPORT_TEST_EXIT_CODE=$TEST_EXIT \
python3 code-analysis/ci/report-summary.py junit build/test-results/test \
--jacoco build/reports/jacoco/test/jacocoTestReport.xml
exit $TEST_EXIT
artifacts:
when: always
expire_in: 1 week
reports:
junit: build/test-results/test/TEST-*.xml
paths:
- build
- build/reports/tests/test/
- build/reports/jacoco/test/html/
- build/reports/jacoco/test/jacocoTestReport.xml

.push-dockerhub-base-job:
stage: publish
Expand Down
8 changes: 0 additions & 8 deletions .pmd

This file was deleted.

5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id 'eclipse'
id "org.kordamp.gradle.jandex" version "1.1.0"
id 'antlr'
id 'com.diffplug.spotless' version '6.25.0'
}

apply from: 'buildscripts/code-analysis.gradle'
Expand Down Expand Up @@ -114,8 +115,8 @@ tasks.named('checkstyleMain') {
dependsOn 'jandex'
}

tasks.named('pmdMain') {
dependsOn 'jandex', 'compileQuarkusGeneratedSourcesJava'
tasks.named('spotlessCheck') {
dependsOn 'jandex'
}

tasks.named('compileTestJava') {
Expand Down
61 changes: 33 additions & 28 deletions buildscripts/code-analysis.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
apply plugin: 'pmd'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'

Expand All @@ -12,15 +11,6 @@ jacocoTestReport {
}
}

pmd {
// Empty ruleset is necessary for exclude-pattern
// https://stackoverflow.com/questions/32247190/pmd-exclude-pattern-with-gradle
ruleSets = []
ruleSetFiles = files("code-analysis/pmd.xml")
ignoreFailures = false
toolVersion = "6.53.0"
}

checkstyle {
configDirectory = file("code-analysis")
configFile = file("code-analysis/checkstyle.xml")
Expand All @@ -29,24 +19,39 @@ checkstyle {
toolVersion = "10.12.5"
}

def antlrCheckstyleExcludes = [
'**/TypeScriptLexerBase.java',
'**/TypeScriptParserBase.java',
'**/PythonLexerBase.java',
'**/PythonParserBase.java',
'**/PythonVersion.java',
'**/CParserBase.java',
'**/CLexerBase.java',
'**/Symbol.java',
'**/SymbolTable.java',
'**/TypeClassification.java',
'**/GoParserBase.java',
'**/CSharpLexerBase.java',
'**/CSharpParserBase.java',
'**/RustLexerBase.java',
'**/RustParserBase.java',
'**/PhpLexerBase.java',
'**/SwiftSupport.java',
'**/SwiftSupportLexer.java',
]

// Exclude ANTLR generated base classes from checkstyle (external files from ANTLR repository)
tasks.withType(Checkstyle) {
exclude '**/TypeScriptLexerBase.java'
exclude '**/TypeScriptParserBase.java'
exclude '**/PythonLexerBase.java'
exclude '**/PythonParserBase.java'
exclude '**/PythonVersion.java'
exclude '**/CParserBase.java'
exclude '**/CLexerBase.java'
exclude '**/Symbol.java'
exclude '**/SymbolTable.java'
exclude '**/TypeClassification.java'
exclude '**/GoParserBase.java'
exclude '**/CSharpLexerBase.java'
exclude '**/CSharpParserBase.java'
exclude '**/RustLexerBase.java'
exclude '**/RustParserBase.java'
exclude '**/PhpLexerBase.java'
exclude '**/SwiftSupport.java'
exclude '**/SwiftSupportLexer.java'
antlrCheckstyleExcludes.each { exclude it }
}

spotless {
java {
target 'src/*/java/**/*.java'
targetExclude antlrCheckstyleExcludes
googleJavaFormat()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}
Loading
Loading