Skip to content

Commit

Permalink
Preprocess the matrix to avoid running M1 jobs on forks
Browse files Browse the repository at this point in the history
  • Loading branch information
holly-cummins committed Sep 17, 2022
1 parent 004eb29 commit 88bba45
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 38 deletions.
20 changes: 20 additions & 0 deletions .github/filter-jvm-tests-json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

BASEDIR=$(dirname "$0")

# Filter out mac os from a matrix of build configurations.
# The reason we do this is that running mac on a fork won't work; the fork won't have a self-hosted runner

# See https://stackoverflow.com/questions/65384420/how-to-make-a-github-action-matrix-element-conditional

repoName=${GITHUB_REPOSITORY}

if [[ $repoName == "quarkusio/quarkus" ]]
then
matrix=$(cat $BASEDIR/matrix-jvm-tests.json)
else
# Use jq to read in a json file that represents the matrix configuration.
matrix=$(jq 'map(. | select(.["os-name"]!="macos-arm64-latest"))' $BASEDIR/matrix-jvm-tests.json)
fi

echo \{java: ${matrix}\}
36 changes: 36 additions & 0 deletions .github/matrix-jvm-tests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[ {
"name": "11",
"java-version": 11,
"maven_args": "$JVM_TEST_MAVEN_ARGS",
"maven_opts": "-Xmx2g -XX:MaxMetaspaceSize=1g",
"os-name": "ubuntu-latest"
}
, {
"name": "17",
"java-version": 17,
"maven_args": "$JVM_TEST_MAVEN_ARGS",
"maven_opts": "-Xmx2g -XX:MaxMetaspaceSize=1g",
"os-name": "ubuntu-latest"
}
, {
"name": "18",
"java-version": 18,
"maven_args": "$JVM_TEST_MAVEN_ARGS",
"maven_opts": "-Xmx2g -XX:MaxMetaspaceSize=1g",
"os-name": "ubuntu-latest"
}
, {
"name": "11 Windows",
"java-version": 11,
"maven_args": "-DskipDocs -Dformat.skip",
"maven_opts": "-Xmx2g -XX:MaxMetaspaceSize=1g -Xlog:gc*=debug:file=windows-java-11.txt",
"os-name": "windows-latest"
}
, {
"name": "17 MacOS M1",
"java-version": 17,
"maven_args": "-DskipDocs -Dformat.skip",
"maven_opts": "-Xmx2g -XX:MaxMetaspaceSize=1g",
"architecture": "aarch64",
"os-name": "macos-arm64-latest"
}]
47 changes: 9 additions & 38 deletions .github/workflows/ci-actions-incremental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ jobs:
GIB_IMPACTED_MODULES: ${{ needs.build-jdk11.outputs.gib_impacted }}
outputs:
native_matrix: ${{ steps.calc-native-matrix.outputs.matrix }}
jvm_matrix: ${{ steps.calc-jvm-matrix.outputs.matrix }}
run_jvm: ${{ steps.calc-run-flags.outputs.run_jvm }}
run_devtools: ${{ steps.calc-run-flags.outputs.run_devtools }}
run_gradle: ${{ steps.calc-run-flags.outputs.run_gradle }}
Expand All @@ -236,6 +237,12 @@ jobs:
json=$(.github/filter-native-tests-json.sh "${GIB_IMPACTED_MODULES}" | tr -d '\n')
echo "${json}"
echo "::set-output name=matrix::${json}"
- name: Calculate matrix from matrix-jvm-tests.json
id: calc-jvm-matrix
run: |
json=$(.github/filter-jvm-tests-json.sh)
echo "${json}"
echo "::set-output name=matrix::${json}"
- name: Calculate run flags
id: calc-run-flags
run: |
Expand Down Expand Up @@ -267,44 +274,8 @@ jobs:
MAVEN_OPTS: ${{ matrix.java.maven_opts }}
strategy:
fail-fast: false
matrix:
java:
- {
name: "11",
java-version: 11,
maven_args: "$JVM_TEST_MAVEN_ARGS",
maven_opts: "-Xmx2g -XX:MaxMetaspaceSize=1g",
os-name: "ubuntu-latest"
}
- {
name: "17",
java-version: 17,
maven_args: "$JVM_TEST_MAVEN_ARGS",
maven_opts: "-Xmx2g -XX:MaxMetaspaceSize=1g",
os-name: "ubuntu-latest"
}
- {
name: "18",
java-version: 18,
maven_args: "$JVM_TEST_MAVEN_ARGS",
maven_opts: "-Xmx2g -XX:MaxMetaspaceSize=1g",
os-name: "ubuntu-latest"
}
- {
name: "11 Windows",
java-version: 11,
maven_args: "-DskipDocs -Dformat.skip",
maven_opts: "-Xmx2g -XX:MaxMetaspaceSize=1g -Xlog:gc*=debug:file=windows-java-11.txt",
os-name: "windows-latest"
}
- {
name: "17 MacOS M1",
java-version: 17,
maven_args: "-DskipDocs -Dformat.skip",
maven_opts: "-Xmx2g -XX:MaxMetaspaceSize=1g",
architecture: aarch64,
os-name: "macos-arm64-latest"
}
matrix: ${{ fromJson(needs.calculate-test-jobs.outputs.jvm_matrix) }}


steps:
- name: Stop mysql
Expand Down

0 comments on commit 88bba45

Please sign in to comment.