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
26 changes: 20 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ jobs:
strategy:
matrix:
java: [ 17, 21 ]
# Custom JDK 11 configuration because some of the plugins and test dependencies don't support it anymore,
# but it is important to still test with a JDK version without Record classes
include:
# Custom JDK 11 configuration because some of the plugins and test dependencies don't support it anymore,
# but it is important to still test with a JDK version without Record classes
- java: 11
# Disable Enforcer check which (intentionally) prevents using JDK 11 for building
# Exclude 'test-graal-native-image' module because JUnit 6 requires >= Java 17
extra-mvn-args: -Denforcer.fail=false --projects '!:test-graal-native-image'
extra-mvn-args: -Denforcer.fail=false --projects '!test-graal-native-image'
- java: 25
# Disable Enforcer check which (intentionally) prevents using JDK 25 for building
# Exclude 'test-shrinker' because ProGuard does not support JDK 25 yet, see
# https://github.com/Guardsquare/proguard/issues/481 and https://github.com/Guardsquare/proguard/issues/473
# TODO: Once ProGuard supports JDK 25, also remove the corresponding 'JDK25' profile in `gson/pom.xml`
extra-mvn-args: -Denforcer.fail=false --projects '!test-shrinker'
runs-on: ubuntu-latest

steps:
Expand All @@ -39,23 +45,31 @@ jobs:
run: mvn --batch-mode --no-transfer-progress verify javadoc:jar ${{ matrix.extra-mvn-args || '' }}

native-image-test:
name: "GraalVM Native Image test"
name: "GraalVM Native Image test (JDK ${{ matrix.java }})"
strategy:
matrix:
java: [ 21 ]
include:
- java: 25
# Disable Enforcer check which (intentionally) prevents using JDK 25 for building
# TODO: Remove this once JDK 25 is fully supported for building Gson
extra-mvn-args: -Denforcer.fail=false
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: "Set up GraalVM"
uses: graalvm/setup-graalvm@7f488cf82a3629ee755e4e97342c01d6bed318fa # v1.3.5
with:
java-version: '21'
java-version: ${{ matrix.java }}
distribution: 'graalvm'
# According to documentation in graalvm/setup-graalvm this is used to avoid rate-limiting issues
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
- name: Build and run tests
# Only run tests in `test-graal-native-image` (and implicitly build and run tests in `gson`),
# everything else is covered already by regular build job above
run: mvn test --batch-mode --no-transfer-progress --activate-profiles native-image-test --projects test-graal-native-image --also-make
run: mvn test --batch-mode --no-transfer-progress --activate-profiles native-image-test --projects test-graal-native-image --also-make ${{ matrix.extra-mvn-args || '' }}

verify-reproducible-build:
name: "Verify reproducible build"
Expand Down
22 changes: 22 additions & 0 deletions gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -365,5 +365,27 @@
<excludeTestCompilation />
</properties>
</profile>
<!-- For JDK 25+ skip tests which rely on ProGuard because it does not support JDK 25 yet -->
<!-- TODO: Remove this once ProGuard supports JDK 25, and there is a solution for https://github.com/Guardsquare/proguard/issues/473 -->
<profile>
<id>JDK25</id>
<activation>
<jdk>[25,)</jdk>
</activation>
<properties>
<excludeTestCompilation>com/google/gson/functional/EnumWithObfuscatedTest.java</excludeTestCompilation>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For simplicity I reused the existing excludeTestCompilation property which we are already using for excluding JDK 17+ tests on JDK 11.

A slightly cleaner solution might be to adjust the maven-surefire-plugin configuration instead, to exclude that test. But I am not sure if that is worth it, given that hopefully soon in the future ProGuard supports JDK 25.

</properties>
<build>
<plugins>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>