From a2ce8e7243ce77a383af64c96097302eb8c4b07c Mon Sep 17 00:00:00 2001 From: David Nestorovic Date: Fri, 13 Oct 2023 14:16:07 +0200 Subject: [PATCH] Split jobs for gradle testing to avoid duplications --- .../workflows/test-native-gradle-plugin.yml | 51 ++++++++++++------- .../workflows/test-native-maven-plugin.yml | 27 +--------- ...graalvm.build.github-actions-helper.gradle | 13 +++-- 3 files changed, 44 insertions(+), 47 deletions(-) diff --git a/.github/workflows/test-native-gradle-plugin.yml b/.github/workflows/test-native-gradle-plugin.yml index 148e59092..7ff4002d9 100644 --- a/.github/workflows/test-native-gradle-plugin.yml +++ b/.github/workflows/test-native-gradle-plugin.yml @@ -40,7 +40,7 @@ jobs: - name: "🕸️ Populate matrix" id: set-matrix run: | - ./gradlew :native-gradle-plugin:dumpFunctionalTestList + ./gradlew -PmatrixType=gradle :native-gradle-plugin:dumpFunctionalTestList test-native-gradle-plugin: name: "Sanity checks" @@ -118,26 +118,41 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} - name: "❓ Check and test the plugin" run: ./gradlew :native-gradle-plugin:functionalTest -DgradleVersion=${{ matrix.gradle-version }} --tests ${{ matrix.test }} - - name: "❓ Check and test the plugin with configuration cache" - run: ./gradlew :native-gradle-plugin:configCacheFunctionalTest -DgradleVersion=${{ matrix.gradle-config-cache-version }} --tests ${{ matrix.test }} - name: "📜 Upload functional tests results" if: always() uses: actions/upload-artifact@v2 with: name: functional-tests-results-${{ matrix.gradle-version }} path: native-gradle-plugin/build/reports/tests/functionalTest/ - - functional-testing-gradle-plugin-windows: - name: "Windows Gradle plugin functional testing" - if: ${{ false }} - # Disabled due to https://github.com/gradle/native-platform/issues/274 - needs: populate-matrix + + populate-cache-matrix: + name: "Set cache matrix" + runs-on: "ubuntu-20.04" + timeout-minutes: 5 + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: "☁️ Checkout repository" + uses: actions/checkout@v3 + - name: "🔧 Prepare environment" + uses: graalvm/setup-graalvm@v1 + with: + java-version: '17' + distribution: 'graalvm' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: "🕸️ Populate matrix" + id: set-matrix + run: | + ./gradlew -PmatrixType=gradleCached :native-gradle-plugin:dumpFunctionalTestList + + functional-testing-gradle-with-cache-version: + name: "🧪 Gradle: ${{ matrix.test }} on ${{ matrix.os }} with cache gradle version: ${{ matrix.gradle-config-cache-version }}" runs-on: ${{ matrix.os }} + timeout-minutes: 60 + needs: populate-cache-matrix strategy: fail-fast: false - matrix: - java-version: [ 17 ] - os: [ windows-latest ] + matrix: ${{fromJson(needs.populate-cache-matrix.outputs.matrix)}} steps: - name: "☁️ Checkout repository" uses: actions/checkout@v3 @@ -145,11 +160,11 @@ jobs: with: java-version: ${{ matrix.java-version }} github-token: ${{ secrets.GITHUB_TOKEN }} - - name: "❓ Check and test the Gradle plugin" - run: ./gradlew :native-gradle-plugin:functionalTest --no-daemon --fail-fast - - name: "📜 Upload tests results" + - name: "❓ Check and test the plugin with configuration cache" + run: ./gradlew :native-gradle-plugin:configCacheFunctionalTest -DgradleVersion=${{ matrix.gradle-config-cache-version }} --tests ${{ matrix.test }} + - name: "📜 Upload functional tests results" if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v2 with: - name: windows-gradle-functional-tests-results - path: native-gradle-plugin/build/reports/tests/ + name: functional-tests-results-${{ matrix.gradle-config-cache-version }} + path: native-gradle-plugin/build/reports/tests/functionalTest/ diff --git a/.github/workflows/test-native-maven-plugin.yml b/.github/workflows/test-native-maven-plugin.yml index 8932316bc..2142bbbbe 100644 --- a/.github/workflows/test-native-maven-plugin.yml +++ b/.github/workflows/test-native-maven-plugin.yml @@ -40,7 +40,7 @@ jobs: - name: "🕸️ Populate matrix" id: set-matrix run: | - ./gradlew :native-maven-plugin:dumpFunctionalTestList + ./gradlew -PmatrixType=maven :native-maven-plugin:dumpFunctionalTestList test-native-maven-plugin: name: "🧪 Maven: ${{ matrix.test }} on ${{ matrix.os }}" @@ -65,28 +65,3 @@ jobs: with: name: maven-functional-tests-results-${{ matrix.os }} path: native-maven-plugin/build/reports/tests/ - test-native-maven-plugin-windows: - name: "Windows Minimal Tests for Maven plugin" - if: ${{ false }} - # Fails with "Illegal char <�> at index 3: C:\�Users\�RUNNER~1\�AppData\�Local\�Temp\�spock_supports_spaces_in__0_testDirectory18198684407774777428\�with spaces\�local-repo\�org\�apache\�commons\�commons-lang3\�3.8.1\�commons-lang3-3.8.1.jar" - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - java-version: [ 17 ] - os: [ windows-latest ] - steps: - - name: "☁️ Checkout repository" - uses: actions/checkout@v3 - - uses: ./.github/actions/prepare-environment - with: - java-version: ${{ matrix.java-version }} - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: "❓ Check and test the Maven plugin" - run: ./gradlew :native-maven-plugin:functionalTest --no-daemon --fail-fast - - name: "📜 Upload tests results" - if: always() - uses: actions/upload-artifact@v3 - with: - name: windows-maven-functional-tests-results - path: native-maven-plugin/build/reports/tests/ diff --git a/build-logic/common-plugins/src/main/groovy/org.graalvm.build.github-actions-helper.gradle b/build-logic/common-plugins/src/main/groovy/org.graalvm.build.github-actions-helper.gradle index c47ae371f..ec829c3b4 100644 --- a/build-logic/common-plugins/src/main/groovy/org.graalvm.build.github-actions-helper.gradle +++ b/build-logic/common-plugins/src/main/groovy/org.graalvm.build.github-actions-helper.gradle @@ -2,13 +2,16 @@ import groovy.json.JsonOutput def matrixDefault = [ "java-version": [ "17" ], - "os": [ "ubuntu-20.04" ] + "os": [ "ubuntu-20.04", "windows-latest" ] ] +// # Following versions are disabled temporarily in order to speed up PR testing "7.3.3", "7.2", "7.1", "6.8.3", def gradleVersions = [ "gradle-version": ["current", "7.4"], +] + +def gradleCachedVersions = [ "gradle-config-cache-version": ["current", "8.0.1"] - // # Following versions are disabled temporarily in order to speed up PR testing "7.3.3", "7.2", "7.1", "6.8.3", ] sourceSets.configureEach { sourceSet -> @@ -23,10 +26,14 @@ sourceSets.configureEach { sourceSet -> matrix.putAll(matrixDefault) // add gradle specific stuff - if (project.getDisplayName().contains(":native-gradle-plugin")) { + if (matrixType == "gradle") { matrix.putAll(gradleVersions) } + if (matrixType == "gradleCached") { + matrix.putAll(gradleCachedVersions) + } + // add functional tests sourceSet.allSource.each { matrix.test << it.name.substring(0, it.name.lastIndexOf('.'))