Skip to content
Open
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
4 changes: 4 additions & 0 deletions .github/workflows/build-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
skip-windows-smoke-tests:
type: boolean
required: false
reduced-smoke-tests:
type: boolean
required: false
secrets:
DEVELOCITY_ACCESS_KEY:
required: false
Expand Down Expand Up @@ -459,6 +462,7 @@ jobs:
./gradlew
:smoke-tests:test
-PsmokeTestSuite=${{ matrix.smoke-test-suite }}
${{ inputs.reduced-smoke-tests && '-PreducedSmokeTests=true' || '' }}
${{ inputs.skip-openj9-tests && matrix.smoke-test-suite != 'websphere' && '-PskipOpenJ9SmokeTests=true' || '' }}
${{ inputs.no-build-cache && ' --no-build-cache' || '' }}
Comment on lines 462 to 467

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ jobs:
needs: [resolve-native, resolve-servlet-images]
uses: ./.github/workflows/reusable-pr-build.yml
with:
# `test native` is applied automatically by .github/labeler.yml when the
# PR diff touches native-relevant paths. `test openj9`, `test windows`,
# and `test full smoke` are manual force-enables that are picked up on
# the next PR sync/open/reopen event.
skip-native-tests: ${{ !(needs.resolve-native.outputs.run-native-tests == 'true' || contains(github.event.pull_request.labels.*.name, 'test native')) }}
skip-openj9-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'test openj9') }}
skip-windows-smoke-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'test windows') }}
reduced-smoke-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'test full smoke') }}
skip-servlet-images: ${{ needs.resolve-servlet-images.outputs.build-servlet-images != 'true' }}
4 changes: 4 additions & 0 deletions .github/workflows/reusable-pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
skip-windows-smoke-tests:
type: boolean
default: false
reduced-smoke-tests:
type: boolean
default: false
skip-servlet-images:
type: boolean
default: false
Expand All @@ -27,6 +30,7 @@ jobs:
with:
skip-openj9-tests: ${{ inputs.skip-openj9-tests }}
skip-windows-smoke-tests: ${{ inputs.skip-windows-smoke-tests }}
reduced-smoke-tests: ${{ inputs.reduced-smoke-tests }}
cache-read-only: true

test-latest-deps:
Expand Down
5 changes: 5 additions & 0 deletions smoke-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ tasks {
val extensionTestAppTask = project(":smoke-tests:extensions:testapp").tasks.named<Jar>("jar")
val extensionTestAppJarPath = extensionTestAppTask.flatMap { it.archiveFile }

val reducedSmokeTests = findProperty("reducedSmokeTests") == "true"
if (reducedSmokeTests) {
systemProperty("reducedSmokeTests", "true")
}

dependsOn(shadowTask, extensionTestAppTask, extensionTask)

doFirst {
Expand Down
6 changes: 3 additions & 3 deletions smoke-tests/images/servlet/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ tasks {
description = "Builds all Windows Docker images for the test matrix"
}

val linuxImages = createDockerTasks(buildLinuxTestImages, false)
val windowsImages = createDockerTasks(buildWindowsTestImages, true)
val linuxImages = createDockerTasks(buildLinuxTestImages, false, targets)
val windowsImages = createDockerTasks(buildWindowsTestImages, true, targets)

val pushLinuxImages by registering(DockerPushImage::class) {
dependsOn(buildLinuxTestImages)
Expand Down Expand Up @@ -376,7 +376,7 @@ fun configureImage(
return image
}

fun createDockerTasks(parentTask: TaskProvider<out Task>, isWindows: Boolean): Set<String> {
fun createDockerTasks(parentTask: TaskProvider<out Task>, isWindows: Boolean, targets: Map<String, List<ImageTarget>>): Set<String> {
val resultImages = mutableSetOf<String>()
for ((server, matrices) in targets) {
val smokeTestServer = findProperty("smokeTestServer")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ void setUpServer() {
var jdk = appServer.jdk();
isWindows = TestContainerManager.useWindowsContainers();

// In reduced mode (PR builds), only run a representative subset of the full matrix.
// The full matrix runs on merge to main.
skipIfNotReduced(appServer);

// ibm-semeru-runtimes doesn't publish windows images
// adoptopenjdk is deprecated and doesn't publish Windows 2022 images
assumeFalse(isWindows && jdk.endsWith("-openj9"));
Expand All @@ -59,6 +63,50 @@ void setUpServer() {
startWithoutCleanup(new AppServerImage(jdk, serverVersion, isWindows));
}

// Reduced smoke test rules for PR builds. The full matrix runs on merge to main.
// Tomcat covers all JDKs (hotspot), TomEE covers all JDKs (openj9),
// Websphere is already minimal, other servers test only minimum JDK on hotspot.
private void skipIfNotReduced(AppServer appServer) {
if (!Boolean.getBoolean("reducedSmokeTests")) {
return;
}
String jdk = appServer.jdk();
boolean isOpenj9 = jdk.contains("-openj9");

if (this instanceof TomcatSmokeTest) {
assumeFalse(isOpenj9, "Reduced mode: Tomcat runs hotspot only");
return;
}
if (this instanceof TomeeSmokeTest) {
assumeTrue(isOpenj9, "Reduced mode: TomEE runs openj9 only");
return;
}
if (this instanceof WebsphereSmokeTest) {
return;
}
// All other servers: hotspot only, minimum JDK per server version
assumeFalse(isOpenj9, "Reduced mode: hotspot only");
assumeTrue(isMinimumJdk(appServer), "Reduced mode: only minimum JDK per server version");
}
Comment on lines +76 to +90

private boolean isMinimumJdk(AppServer appServer) {
int myJdk = parseJdkVersion(appServer.jdk());
for (Class<?> sibling : getClass().getEnclosingClass().getDeclaredClasses()) {
AppServer other = sibling.getAnnotation(AppServer.class);
if (other != null
&& other.version().equals(appServer.version())
&& !other.jdk().contains("-openj9")
&& parseJdkVersion(other.jdk()) < myJdk) {
return false;
}
}
return true;
}

private static int parseJdkVersion(String jdk) {
return Integer.parseInt(jdk.split("-")[0]);
}

@AfterAll
void afterAll() {
stop();
Expand Down
Loading