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
75 changes: 67 additions & 8 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30

strategy:
matrix:
java: [11, 17, 21]
java: [17, 21]
distribution: [temurin]

steps:
- uses: actions/checkout@v5

Expand All @@ -40,11 +38,17 @@ jobs:
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
cache: 'maven'

- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-build-

- name: Build with Maven
# Java 17 is required for tests
run: ./mvnw -B clean package ${{ matrix.java >=17 && '-P run-integration-tests' || '-Dmaven.test.skip=true' }}
run: ./mvnw -B clean package -P run-integration-tests

- name: Check for uncommited changes
run: |
Expand Down Expand Up @@ -79,6 +83,31 @@ jobs:
path: ${{ env.PRIMARY_MAVEN_MODULE }}/target/screenshots
if-no-files-found: ignore

# Ensure compatibility with Java 11
# See https://github.com/xdev-software/chartjs-java-model/issues/14
build-java-11:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v5

- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 11

- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-build-java-11-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-build-java-11-

- name: Build with Maven
run: ./mvnw -B clean package -Dmaven.test.skip=true

checkstyle:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
Expand All @@ -97,7 +126,22 @@ jobs:
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
cache: 'maven'

- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-checkstyle-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-checkstyle-

- name: CheckStyle Cache
uses: actions/cache@v4
with:
path: '**/target/checkstyle-cachefile'
key: ${{ runner.os }}-checkstyle-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-checkstyle-

- name: Run Checkstyle
run: ./mvnw -B checkstyle:check -P checkstyle -T2C
Expand All @@ -120,7 +164,22 @@ jobs:
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
cache: 'maven'

- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-pmd-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-pmd-

- name: PMD Cache
uses: actions/cache@v4
with:
path: '**/target/pmd/pmd.cache'
key: ${{ runner.os }}-pmd-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pmd-

- name: Run PMD
run: ./mvnw -B test pmd:aggregate-pmd-no-fork pmd:check -P pmd -DskipTests -T2C
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ permissions:
contents: write
pull-requests: write

# DO NOT RESTORE CACHE for critical release steps to prevent a (extremely unlikely) scenario
# where a supply chain attack could be achieved due to poisoned cache
jobs:
check-code:
runs-on: ubuntu-latest
Expand All @@ -23,7 +25,15 @@ jobs:
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

# Try to reuse existing cache from check-build
- name: Try restore Maven Cache
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-build-

- name: Build with Maven
run: ./mvnw -B clean package -T2C
Expand Down Expand Up @@ -166,7 +176,15 @@ jobs:
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

# Try to reuse existing cache from check-build
- name: Try restore Maven Cache
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-build-

- name: Build site
run: ../mvnw -B compile site -DskipTests -T2C
Expand Down
1 change: 1 addition & 0 deletions chartjs-java-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@
<artifactId>maven-pmd-plugin</artifactId>
<version>3.27.0</version>
<configuration>
<analysisCache>true</analysisCache>
<includeTests>true</includeTests>
<printFailingErrors>true</printFailingErrors>
<rulesets>
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<artifactId>maven-pmd-plugin</artifactId>
<version>3.27.0</version>
<configuration>
<analysisCache>true</analysisCache>
<includeTests>true</includeTests>
<printFailingErrors>true</printFailingErrors>
<rulesets>
Expand Down