Skip to content

Commit a71aa5f

Browse files
committed
Execute integration tests with (LTS) Java versions
After building with JDK 8 we should check whether everything runs with other current JDK LTS versions and on major OS versions.
1 parent 318bc16 commit a71aa5f

File tree

3 files changed

+66
-8
lines changed

3 files changed

+66
-8
lines changed

.github/workflows/gradle-build.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
name: Gradle Build Check
1+
name: Gradle Build and Test
22
on:
33
pull_request:
44
push:
5-
workflow_dispatch: {}
5+
workflow_dispatch:
66
jobs:
77
gradle:
8-
runs-on: ubuntu-22.04
8+
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v3
1111
- uses: actions/setup-java@v3
1212
with:
1313
distribution: temurin
14+
# Always build with JDK 8 initially
1415
java-version: 8
1516

1617
- name: Setup Gradle
@@ -19,7 +20,7 @@ jobs:
1920
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
2021

2122
- name: Execute Gradle build
22-
run: ./gradlew clean check integrationTest --scan -stacktrace
23+
run: ./gradlew clean check integrationTest --scan --stacktrace
2324

2425
- name: 'Publish Test Results'
2526
uses: EnricoMi/publish-unit-test-result-action/composite@v2
@@ -35,3 +36,14 @@ jobs:
3536
coverage_report_name: Coverage
3637
coverage_report_title: JaCoCo
3738
github_token: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Upload Artifacts
41+
uses: actions/upload-artifact@master
42+
with:
43+
name: maven-repo
44+
path: build/maven-repo
45+
46+
- name: Trigger Test Matrix Workflow
47+
uses: benc-uk/workflow-dispatch@v1
48+
with:
49+
workflow: test-java-os-mix.yml
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: HTML Sanity Check Matrix Test
2+
on:
3+
push:
4+
paths:
5+
- .github/workflows/test-java-os-mix.yml
6+
workflow_dispatch: {}
7+
8+
jobs:
9+
test-java-os-mix:
10+
strategy:
11+
matrix:
12+
os-version: [ ubuntu-latest, macos-14, windows-latest ]
13+
java-version: [ 11, 17, 21 ]
14+
runs-on: ${{ matrix.os-version }}
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Download Artifacts
18+
uses: dawidd6/action-download-artifact@v3
19+
with:
20+
workflow: gradle-build.yml
21+
name: maven-repo
22+
path: build/maven-repo
23+
- uses: actions/setup-java@v3
24+
with:
25+
distribution: temurin
26+
java-version: ${{ matrix.java-version }}
27+
- name: Execute integration test (on Unixes)
28+
run: |
29+
uname -a
30+
./gradlew --version
31+
./gradlew info
32+
./gradlew integrationTestOnly --scan
33+

build.gradle

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ allprojects {
3232
println "projectDir : " + projectDir
3333
println "groupId : " + project.group
3434
println "targetCompatibility : " + java.targetCompatibility
35+
println "OS : " + System.properties["os.name"]
36+
println "Java VM Name : " + System.properties["java.vm.name"]
37+
println "Java VM Vendor : " + System.properties["java.vm.vendor"]
38+
println "Java VM Version : " + System.properties["java.vm.version"]
3539
println "=" * 80
3640
}
3741
}
@@ -91,27 +95,36 @@ configure(subprojects) {
9195
// apply plugin: 'codenarc'
9296
}
9397

94-
tasks.register("integrationTest") {
98+
tasks.register("integrationTestOnly") {
9599
group("Verification")
96-
description("Run overall integration tests")
100+
description("Run overall integration tests (no publish)")
97101

98102
final String INTEGRATION_TEST_DIRECTORY = "integration-test/gradle-plugin"
99103

100104
doLast {
101105
def result = exec {
102106
workingDir INTEGRATION_TEST_DIRECTORY
103-
commandLine "./gradlew", "clean", "htmlSanityCheck", "-PhtmlSanityCheckVersion=${project.version}"
107+
commandLine System.getProperty("os.name") ==~ /Windows.*/ ? "gradlew.bat" : "./gradlew", "clean", "htmlSanityCheck", "-PhtmlSanityCheckVersion=${project.version}"
104108
}
105109
logger.debug "Script output: $result"
106110
File integrationTestDirectory = file(INTEGRATION_TEST_DIRECTORY)
107111
final File testIndex = new File (integrationTestDirectory, "build/reports/index.html")
108112
assert testIndex.exists()
109113
}
110114
}
111-
integrationTest.dependsOn(
115+
integrationTestOnly.mustRunAfter(
112116
':htmlSanityCheck-core:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository',
113117
':htmlSanityCheck-gradle-plugin:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository'
114118
)
119+
tasks.register("integrationTest") {
120+
group("Verification")
121+
description("Run overall integration tests (and publish first)")
122+
}
123+
integrationTest.dependsOn(
124+
':htmlSanityCheck-core:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository',
125+
':htmlSanityCheck-gradle-plugin:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository',
126+
'integrationTestOnly'
127+
)
115128

116129
/*
117130
* Copyright Gernot Starke and aim42 contributors.

0 commit comments

Comments
 (0)