Skip to content

Commit

Permalink
Split jobs for gradle testing to avoid duplications
Browse files Browse the repository at this point in the history
  • Loading branch information
dnestoro committed Oct 13, 2023
1 parent a0529f3 commit a2ce8e7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 47 deletions.
51 changes: 33 additions & 18 deletions .github/workflows/test-native-gradle-plugin.yml
Expand Up @@ -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"
Expand Down Expand Up @@ -118,38 +118,53 @@ 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
- uses: ./.github/actions/prepare-environment
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/
27 changes: 1 addition & 26 deletions .github/workflows/test-native-maven-plugin.yml
Expand Up @@ -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 }}"
Expand All @@ -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/
Expand Up @@ -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 ->
Expand All @@ -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('.'))
Expand Down

0 comments on commit a2ce8e7

Please sign in to comment.