Skip to content

Commit

Permalink
Execute integration tests with (LTS) Java versions
Browse files Browse the repository at this point in the history
After building with JDK 8 we should check whether
everything runs with other current JDK LTS versions
and on major OS versions.
  • Loading branch information
ascheman committed Feb 5, 2024
1 parent 318bc16 commit a71aa5f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 8 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name: Gradle Build Check
name: Gradle Build and Test
on:
pull_request:
push:
workflow_dispatch: {}
workflow_dispatch:
jobs:
gradle:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
# Always build with JDK 8 initially
java-version: 8

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

- name: Execute Gradle build
run: ./gradlew clean check integrationTest --scan -stacktrace
run: ./gradlew clean check integrationTest --scan --stacktrace

- name: 'Publish Test Results'
uses: EnricoMi/publish-unit-test-result-action/composite@v2
Expand All @@ -35,3 +36,14 @@ jobs:
coverage_report_name: Coverage
coverage_report_title: JaCoCo
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Artifacts
uses: actions/upload-artifact@master
with:
name: maven-repo
path: build/maven-repo

- name: Trigger Test Matrix Workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: test-java-os-mix.yml
33 changes: 33 additions & 0 deletions .github/workflows/test-java-os-mix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: HTML Sanity Check Matrix Test
on:
push:
paths:
- .github/workflows/test-java-os-mix.yml
workflow_dispatch: {}

jobs:
test-java-os-mix:
strategy:
matrix:
os-version: [ ubuntu-latest, macos-14, windows-latest ]
java-version: [ 11, 17, 21 ]
runs-on: ${{ matrix.os-version }}
steps:
- uses: actions/checkout@v3
- name: Download Artifacts
uses: dawidd6/action-download-artifact@v3
with:
workflow: gradle-build.yml
name: maven-repo
path: build/maven-repo
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java-version }}
- name: Execute integration test (on Unixes)
run: |
uname -a
./gradlew --version
./gradlew info
./gradlew integrationTestOnly --scan
21 changes: 17 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ allprojects {
println "projectDir : " + projectDir
println "groupId : " + project.group
println "targetCompatibility : " + java.targetCompatibility
println "OS : " + System.properties["os.name"]
println "Java VM Name : " + System.properties["java.vm.name"]
println "Java VM Vendor : " + System.properties["java.vm.vendor"]
println "Java VM Version : " + System.properties["java.vm.version"]
println "=" * 80
}
}
Expand Down Expand Up @@ -91,27 +95,36 @@ configure(subprojects) {
// apply plugin: 'codenarc'
}

tasks.register("integrationTest") {
tasks.register("integrationTestOnly") {
group("Verification")
description("Run overall integration tests")
description("Run overall integration tests (no publish)")

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

doLast {
def result = exec {
workingDir INTEGRATION_TEST_DIRECTORY
commandLine "./gradlew", "clean", "htmlSanityCheck", "-PhtmlSanityCheckVersion=${project.version}"
commandLine System.getProperty("os.name") ==~ /Windows.*/ ? "gradlew.bat" : "./gradlew", "clean", "htmlSanityCheck", "-PhtmlSanityCheckVersion=${project.version}"
}
logger.debug "Script output: $result"
File integrationTestDirectory = file(INTEGRATION_TEST_DIRECTORY)
final File testIndex = new File (integrationTestDirectory, "build/reports/index.html")
assert testIndex.exists()
}
}
integrationTest.dependsOn(
integrationTestOnly.mustRunAfter(
':htmlSanityCheck-core:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository',
':htmlSanityCheck-gradle-plugin:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository'
)
tasks.register("integrationTest") {
group("Verification")
description("Run overall integration tests (and publish first)")
}
integrationTest.dependsOn(
':htmlSanityCheck-core:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository',
':htmlSanityCheck-gradle-plugin:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository',
'integrationTestOnly'
)

/*
* Copyright Gernot Starke and aim42 contributors.
Expand Down

0 comments on commit a71aa5f

Please sign in to comment.