Skip to content

Commit

Permalink
Add concurrency in maven and gradle functional testing workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
dnestoro committed Sep 7, 2023
1 parent b168dc7 commit e383e61
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 21 deletions.
48 changes: 33 additions & 15 deletions .github/workflows/test-native-gradle-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,34 @@ 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 :native-gradle-plugin:dumpFunctionalTestList
test-native-gradle-plugin:
name: "Sanity checks"
runs-on: ${{ matrix.os }}
runs-on: "ubuntu-20.04"
timeout-minutes: 60
needs: populate-matrix
strategy:
fail-fast: false
matrix:
java-version: [ 17 ]
os: [ ubuntu-20.04 ]
matrix: ${{fromJson(needs.populate-matrix.outputs.matrix)}}
steps:
- name: "☁️ Checkout repository"
uses: actions/checkout@v3
Expand All @@ -45,18 +65,15 @@ jobs:
with:
name: unit-tests-results
path: native-gradle-plugin/build/reports/tests/test/

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@v3
Expand All @@ -65,9 +82,9 @@ 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 }}
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 }}
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
Expand All @@ -78,6 +95,7 @@ jobs:
name: "Windows Gradle plugin functional testing"
if: ${{ false }}
# Disabled due to https://github.com/gradle/native-platform/issues/274
needs: populate-matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -95,7 +113,7 @@ jobs:
run: ./gradlew :native-gradle-plugin:functionalTest --no-daemon --fail-fast
- name: "📜 Upload tests results"
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: windows-gradle-functional-tests-results
path: native-gradle-plugin/build/reports/tests/
32 changes: 26 additions & 6 deletions .github/workflows/test-native-maven-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,34 @@ 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 :native-maven-plugin:dumpFunctionalTestList
test-native-maven-plugin:
name: "Maven plugin tests"
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: [ ubuntu-20.04 ]
matrix: ${{fromJson(needs.populate-matrix.outputs.matrix)}}
steps:
- name: "☁️ Checkout repository"
uses: actions/checkout@v3
Expand All @@ -38,7 +58,7 @@ jobs:
java-version: ${{ matrix.java-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: "❓ Check and test the plugin"
run: ./gradlew :native-maven-plugin:check --no-daemon
run: ./gradlew :native-maven-plugin:functionalTest --no-daemon --fail-fast --tests ${{ matrix.test }}
- name: "📜 Upload unit test results"
if: always()
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -66,7 +86,7 @@ jobs:
run: ./gradlew :native-maven-plugin:functionalTest --no-daemon --fail-fast
- name: "📜 Upload tests results"
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: windows-maven-functional-tests-results
path: native-maven-plugin/build/reports/tests/
1 change: 1 addition & 0 deletions build-logic/common-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

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

repositories {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import groovy.json.JsonOutput

import java.nio.file.Files

def matrixDefault = [
"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" ]
]

sourceSets.configureEach { sourceSet ->
if (sourceSet.name == 'functionalTest') {
tasks.register("dumpFunctionalTestList") {
doLast {
def matrix = [
test: []
]
matrix.putAll(matrixDefault)
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 e383e61

Please sign in to comment.