Skip to content

Commit

Permalink
Merge pull request #482 from dnestoro/dnestoro/AddConcurrencyToGithub…
Browse files Browse the repository at this point in the history
…Actions

Add concurrency with test array in matrix
  • Loading branch information
dnestoro committed Oct 26, 2023
2 parents c5477c6 + 3b31ada commit 5b632b8
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 50 deletions.
81 changes: 59 additions & 22 deletions .github/workflows/test-native-gradle-plugin.yml
Expand Up @@ -22,9 +22,29 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'graalvm/native-build-tools' }}

jobs:
populate-matrix:
name: "Set 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=gradle :native-gradle-plugin:dumpFunctionalTestList

test-native-gradle-plugin:
name: "Sanity checks"
runs-on: ${{ matrix.os }}
runs-on: "ubuntu-20.04"
timeout-minutes: 50
strategy:
fail-fast: false
matrix:
Expand All @@ -45,6 +65,7 @@ jobs:
with:
name: unit-tests-results
path: native-gradle-plugin/build/reports/tests/test/

functional-testing-gradle-plugin-dev:
name: "Functional testing (GraalVM Dev Build)"
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -78,18 +99,15 @@ jobs:
with:
name: functional-tests-results-graalvm-dev
path: native-gradle-plugin/build/reports/tests/functionalTest/

functional-testing-gradle-plugin:
name: "Functional testing"
name: "🧪 Gradle: ${{ matrix.test }} on ${{ matrix.os }} with gradle version: ${{ matrix.gradle-version }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 60
needs: populate-matrix
strategy:
fail-fast: false
matrix:
gradle-version: ["current", "7.4"]
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"
java-version: [ 17 ]
os: [ ubuntu-20.04 ]
matrix: ${{fromJson(needs.populate-matrix.outputs.matrix)}}
steps:
- name: "☁️ Checkout repository"
uses: actions/checkout@v4
Expand All @@ -99,23 +117,42 @@ jobs:
java-version: ${{ matrix.java-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: "❓ Check and test the plugin"
run: ./gradlew :native-gradle-plugin:functionalTest -DgradleVersion=${{ matrix.gradle-version }}
- name: "❓ Check and test the plugin with configuration cache"
run: ./gradlew :native-gradle-plugin:configCacheFunctionalTest -DgradleVersion=${{ matrix.gradle-config-cache-version }}
run: ./gradlew :native-gradle-plugin:functionalTest -DgradleVersion="${{ matrix.gradle-version }}" --tests ${{ matrix.test }}
- name: "📜 Upload functional tests results"
if: always()
uses: actions/upload-artifact@v3
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"

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@v4
Expand All @@ -124,11 +161,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
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/
52 changes: 24 additions & 28 deletions .github/workflows/test-native-maven-plugin.yml
Expand Up @@ -22,38 +22,34 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'graalvm/native-build-tools' }}

jobs:
test-native-maven-plugin:
name: "Maven plugin tests"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java-version: [ 17 ]
os: [ ubuntu-20.04 ]
populate-matrix:
name: "Set matrix"
runs-on: "ubuntu-20.04"
timeout-minutes: 5
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: "☁️ Checkout repository"
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: "🔧 Prepare environment"
uses: ./.github/actions/prepare-environment
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ matrix.java-version }}
java-version: '17'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: "❓ Check and test the plugin"
run: ./gradlew :native-maven-plugin:check --no-daemon
- name: "📜 Upload unit test results"
if: always()
uses: actions/upload-artifact@v3
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"
- name: "🕸️ Populate matrix"
id: set-matrix
run: |
./gradlew -PmatrixType=maven :native-maven-plugin:dumpFunctionalTestList
test-native-maven-plugin:
name: "🧪 Maven: ${{ matrix.test }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 60
needs: populate-matrix
strategy:
fail-fast: false
matrix:
java-version: [ 17 ]
os: [ windows-latest ]
matrix: ${{fromJson(needs.populate-matrix.outputs.matrix)}}
steps:
- name: "☁️ Checkout repository"
uses: actions/checkout@v4
Expand All @@ -62,11 +58,11 @@ jobs:
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"
- name: "❓ Check and test the plugin"
run: ./gradlew :native-maven-plugin:functionalTest --no-daemon --fail-fast --tests ${{ matrix.test }}
- name: "📜 Upload unit test results"
if: always()
uses: actions/upload-artifact@v3
with:
name: windows-maven-functional-tests-results
name: maven-functional-tests-results-${{ matrix.os }}
path: native-maven-plugin/build/reports/tests/
1 change: 1 addition & 0 deletions build-logic/common-plugins/build.gradle.kts
Expand Up @@ -41,6 +41,7 @@

plugins {
`kotlin-dsl`
`groovy-gradle-plugin`
}

repositories {
Expand Down
@@ -0,0 +1,54 @@
import groovy.json.JsonOutput

def matrixDefault = [
"java-version": [ "17" ],
"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"]
]

sourceSets.configureEach { sourceSet ->
if (sourceSet.name == 'functionalTest') {
tasks.register("dumpFunctionalTestList") {
doLast {
def matrix = [
test: []
]

// add all defaults
matrix.putAll(matrixDefault)

// add gradle specific stuff
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('.'))
}

String githubOut = System.getenv("GITHUB_OUTPUT")
if (githubOut != null) {
new File(githubOut).withWriterAppend {
it.println "matrix=${JsonOutput.toJson(matrix)}"
}
} else {
println "Warning: GITHUB_OUTPUT environment variable not found"
}
println "Build Matrix: $matrix"
}
}
}
}
1 change: 1 addition & 0 deletions native-gradle-plugin/build.gradle
Expand Up @@ -47,6 +47,7 @@ plugins {
id 'org.graalvm.build.java'
id 'org.graalvm.build.functional-testing'
id 'org.graalvm.build.publishing'
id 'org.graalvm.build.github-actions-helper'
}

maven {
Expand Down
1 change: 1 addition & 0 deletions native-maven-plugin/build.gradle.kts
Expand Up @@ -51,6 +51,7 @@ plugins {
id("org.graalvm.build.publishing")
id("org.graalvm.build.maven-plugin")
id("org.graalvm.build.maven-functional-testing")
id("org.graalvm.build.github-actions-helper")
}

maven {
Expand Down

0 comments on commit 5b632b8

Please sign in to comment.