From a71aa5f3cf5e59ced5a2214ada17d8f1079fba48 Mon Sep 17 00:00:00 2001 From: Gerd Aschemann Date: Fri, 2 Feb 2024 07:18:52 +0100 Subject: [PATCH] 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. --- .github/workflows/gradle-build.yml | 20 ++++++++++++---- .github/workflows/test-java-os-mix.yml | 33 ++++++++++++++++++++++++++ build.gradle | 21 ++++++++++++---- 3 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/test-java-os-mix.yml diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml index e0cb3c2e..97e84884 100644 --- a/.github/workflows/gradle-build.yml +++ b/.github/workflows/gradle-build.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/test-java-os-mix.yml b/.github/workflows/test-java-os-mix.yml new file mode 100644 index 00000000..3a2d3c48 --- /dev/null +++ b/.github/workflows/test-java-os-mix.yml @@ -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 + diff --git a/build.gradle b/build.gradle index f7c886fe..c8a687ec 100644 --- a/build.gradle +++ b/build.gradle @@ -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 } } @@ -91,16 +95,16 @@ 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) @@ -108,10 +112,19 @@ tasks.register("integrationTest") { 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.