Skip to content

Commit

Permalink
Add Mac M1 to workflow configuration
Browse files Browse the repository at this point in the history
Preprocess the matrix to avoid running M1 jobs on forks
  • Loading branch information
holly-cummins committed Sep 19, 2022
1 parent a46b99c commit 896c572
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 33 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"
}]
46 changes: 13 additions & 33 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,40 +274,12 @@ 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"
}
matrix: ${{ fromJson(needs.calculate-test-jobs.outputs.jvm_matrix) }}


steps:
- name: Stop mysql
if: "!startsWith(matrix.java.os-name, 'windows')"
if: "!startsWith(matrix.java.os-name, 'windows') && !startsWith(matrix.java.os-name, 'macos')"
shell: bash
run: |
ss -ln
Expand All @@ -316,19 +295,20 @@ jobs:
run: git remote add quarkusio https://github.com/quarkusio/quarkus.git

- name: apt clean
if: "!startsWith(matrix.java.os-name, 'windows')"
if: "!startsWith(matrix.java.os-name, 'windows') && !startsWith(matrix.java.os-name, 'macos')"
shell: bash
run: sudo apt-get clean

- name: Reclaim Disk Space
if: "!startsWith(matrix.java.os-name, 'windows')"
if: "!startsWith(matrix.java.os-name, 'windows') && !startsWith(matrix.java.os-name, 'macos')"
run: .github/ci-prerequisites.sh

- name: Set up JDK ${{ matrix.java.java-version }}
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java.java-version }}
architecture: ${{ matrix.java.architecture || 'x64' }}

- name: Download Maven Repo
uses: actions/download-artifact@v3
Expand Down

0 comments on commit 896c572

Please sign in to comment.