Skip to content

Commit d21ea3c

Browse files
authored
Test against multiple Java versions (#8988)
1 parent 1eeeba8 commit d21ea3c

File tree

35 files changed

+118
-83
lines changed

35 files changed

+118
-83
lines changed

.github/actions/setup-build/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
name: Set up Build
22
description: Sets up Build
3+
inputs:
4+
java-version:
5+
description: 'The Java version to set up'
6+
required: true
7+
default: '17'
38
runs:
49
using: "composite"
510
steps:
611
- uses: ./.github/actions/setup-java
12+
with:
13+
java-version: ${{ inputs.java-version }}
714
- name: Clear existing docker image cache
815
shell: bash
916
run: docker image prune -af
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
name: Set up Java
22
description: Sets up Java version
3+
inputs:
4+
java-version:
5+
description: 'The Java version to set up'
6+
required: true
7+
default: '17'
38
runs:
49
using: "composite"
510
steps:
611
- uses: actions/setup-java@v4
712
with:
8-
java-version: '8'
13+
java-version: ${{ inputs.java-version }}
914
distribution: temurin

.github/settings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ branches:
400400
# Required. Require branches to be up to date before merging.
401401
strict: true
402402
# Required. The list of status checks to require in order to merge into this branch
403-
contexts: ["core", "check_docs_examples (:docs:examples:check)", "in-docker_test", "ci/circleci: minimal_core", "test"]
403+
contexts: ["core (17)", "core (21)", "check_docs_examples (:docs:examples:check)", "in-docker_test", "ci/circleci: minimal_core", "test"]
404404
# Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
405405
enforce_admins: false
406406
# Prevent merge commits from being pushed to matching branches

.github/workflows/ci-docker-wormhole.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ jobs:
5353
-v "$PWD:$PWD" \
5454
-w "$PWD" \
5555
-e AUTO_APPLY_GIT_HOOKS=false \
56-
openjdk:8-jdk-alpine \
56+
eclipse-temurin:17-jdk-alpine \
5757
./gradlew --no-daemon --continue --scan testcontainers:test --tests '*GenericContainerRuleTest'

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,14 @@ jobs:
5050
runs-on: ubuntu-22.04
5151
permissions:
5252
checks: write
53+
strategy:
54+
matrix:
55+
java: [ '17', '21' ]
5356
steps:
5457
- uses: actions/checkout@v4
5558
- uses: ./.github/actions/setup-build
59+
with:
60+
java-version: ${{ matrix.java }}
5661
- name: Build and test with Gradle
5762
run: |
5863
./gradlew :testcontainers:check --no-daemon --continue --scan

.sdkmanrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Enable auto-env through the sdkman_auto_env config
22
# Add key=value pairs of SDKs to use below
3-
java=8.0.372-tem
3+
java=17.0.12-tem

build.gradle

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ plugins {
1414
id 'io.franzbecker.gradle-lombok' version '5.0.0'
1515
id 'com.gradleup.shadow' version '8.3.0'
1616
id 'me.champeau.gradle.japicmp' version '0.4.3' apply false
17-
id 'com.diffplug.spotless' version '6.13.0' apply false
17+
id 'com.diffplug.spotless' version '6.22.0' apply false
1818
}
1919

2020
apply from: "$rootDir/gradle/ci-support.gradle"
@@ -26,6 +26,7 @@ captainHook {
2626
}
2727

2828
subprojects {
29+
apply plugin: 'java'
2930
apply plugin: 'java-library'
3031
apply plugin: 'idea'
3132
apply plugin: 'io.franzbecker.gradle-lombok'
@@ -35,9 +36,17 @@ subprojects {
3536

3637
group = "org.testcontainers"
3738

38-
sourceCompatibility = 1.8
39-
targetCompatibility = 1.8
40-
compileJava.options.encoding = 'UTF-8'
39+
java {
40+
toolchain {
41+
languageVersion = JavaLanguageVersion.of(17)
42+
}
43+
}
44+
45+
tasks.withType(JavaCompile) {
46+
options.release.set(8)
47+
options.encoding = 'UTF-8'
48+
}
49+
4150
compileTestJava.options.encoding = 'UTF-8'
4251
javadoc.options.encoding = 'UTF-8'
4352

@@ -126,7 +135,7 @@ subprojects {
126135
}
127136

128137
checkstyle {
129-
toolVersion = "9.3"
138+
toolVersion = "10.12.4"
130139
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
131140
}
132141
}

core/src/main/java/org/testcontainers/containers/DockerCompose.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
interface DockerCompose {
66
String ENV_PROJECT_NAME = "COMPOSE_PROJECT_NAME";
7+
78
String ENV_COMPOSE_FILE = "COMPOSE_FILE";
89

910
DockerCompose withCommand(String cmd);

core/src/main/java/org/testcontainers/images/builder/Transferable.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
public interface Transferable {
1212
int DEFAULT_FILE_MODE = 0100644;
13+
1314
int DEFAULT_DIR_MODE = 040755;
1415

1516
static Transferable of(String string) {

core/src/test/java/org/testcontainers/TestImages.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44

55
public interface TestImages {
66
DockerImageName REDIS_IMAGE = DockerImageName.parse("redis:6-alpine");
7+
78
DockerImageName RABBITMQ_IMAGE = DockerImageName.parse("rabbitmq:3.7.25");
9+
810
DockerImageName MONGODB_IMAGE = DockerImageName.parse("mongo:4.4");
11+
912
DockerImageName ALPINE_IMAGE = DockerImageName.parse("alpine:3.17");
13+
1014
DockerImageName DOCKER_REGISTRY_IMAGE = DockerImageName.parse("registry:2.7.0");
15+
1116
DockerImageName TINY_IMAGE = DockerImageName.parse("alpine:3.17");
1217
}

0 commit comments

Comments
 (0)