Skip to content

Commit cd23ca6

Browse files
committed
Add Java 21 test runs
1 parent cb53400 commit cd23ca6

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
os: [ ubuntu-latest, windows-latest ]
21-
java: [ '8', '11', '17' ]
21+
java: [ '8', '11', '17', '21' ]
2222
arch: [ 'x86', 'x64' ]
2323
exclude:
2424
- os: ubuntu-latest
2525
arch: x86
26+
- os: windows-latest
27+
java: '21'
28+
arch: x86
2629

2730
name: Java ${{ matrix.java }}/${{ matrix.arch }}/${{ matrix.os }}
2831

@@ -42,14 +45,14 @@ jobs:
4245
cache: maven
4346

4447
- name: Build with Maven
45-
if: "${{ !(matrix.arch == 'x64' && matrix.os == 'ubuntu-latest' && matrix.java == '11') || github.event.pull_request.head.repo.full_name != 'dnsjava/dnsjava' }}"
48+
if: "${{ !(matrix.arch == 'x64' && matrix.os == 'ubuntu-latest' && matrix.java == '17') || github.event.pull_request.head.repo.full_name != 'dnsjava/dnsjava' }}"
4649
run: mvn verify -B -"Dgpg.skip"
4750

4851
# doesn't work with PRs from forks, see
4952
# https://portal.productboard.com/sonarsource/1-sonarcloud/c/50-sonarcloud-analyzes-external-pull-request
5053
# or https://jira.sonarsource.com/browse/MMF-1371 (not public anymore)
5154
- name: Cache Sonar plugins
52-
if: "${{ (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/') || github.event.pull_request.head.repo.full_name == 'dnsjava/dnsjava') && matrix.arch == 'x64' && matrix.os == 'ubuntu-latest' && matrix.java == '11' }}"
55+
if: "${{ (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/') || github.event.pull_request.head.repo.full_name == 'dnsjava/dnsjava') && matrix.arch == 'x64' && matrix.os == 'ubuntu-latest' && matrix.java == '17' }}"
5356
uses: actions/cache@v3
5457
with:
5558
path: ~/.sonar/cache
@@ -58,7 +61,7 @@ jobs:
5861
${{ runner.os }}-sonar
5962
6063
- name: Build with Maven and run Sonar
61-
if: "${{ (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/') || github.event.pull_request.head.repo.full_name == 'dnsjava/dnsjava') && matrix.arch == 'x64' && matrix.os == 'ubuntu-latest' && matrix.java == '11' }}"
64+
if: "${{ (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/') || github.event.pull_request.head.repo.full_name == 'dnsjava/dnsjava') && matrix.arch == 'x64' && matrix.os == 'ubuntu-latest' && matrix.java == '17' }}"
6265
env:
6366
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6467
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<target.jdk>8</target.jdk>
4949

5050
<org.junit.version>5.10.0</org.junit.version>
51+
<!-- Stay on 4.x for Java 8 compatibility. Newer versions are used for Java 11+ builds -->
5152
<mockito.version>4.11.0</mockito.version>
5253
<slf4j.version>1.7.36</slf4j.version>
5354
<lombok.version>1.18.30</lombok.version>
@@ -511,6 +512,16 @@
511512
</resources>
512513
</build>
513514
</profile>
515+
<profile>
516+
<id>java-11</id>
517+
<activation>
518+
<jdk>[11,)</jdk>
519+
</activation>
520+
521+
<properties>
522+
<mockito.version>5.7.0</mockito.version>
523+
</properties>
524+
</profile>
514525
</profiles>
515526

516527
<distributionManagement>

0 commit comments

Comments
 (0)