Skip to content

Commit

Permalink
CI: Make mandrel.yml trigger on workflow_dispatch
Browse files Browse the repository at this point in the history
This allows us to run the workflow on demand and on schedule with
different parameters.
  • Loading branch information
zakkak committed Apr 21, 2021
1 parent d0a18c9 commit 53d1c28
Show file tree
Hide file tree
Showing 3 changed files with 420 additions and 212 deletions.
335 changes: 335 additions & 0 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,335 @@
name: Mandrel-Quarkus tests

on:
workflow_dispatch:
inputs:
quarkus-version:
description: 'Quarkus version to test (branch, tag, commit, or "latest")'
# "latest" is replaced by the latest release available in maven
default: "main"
quarkus-repo:
description: 'The Quarkus repository to be used'
default: 'quarkusio/quarkus'
repo:
description: 'The Mandrel/Graal repository to be used'
default: 'graalvm/mandrel'
version:
description: 'Mandrel version to test (branch, tag, or commit)'
default: "graal/master"
mandrel-packaging-version:
description: 'Mandrel packaging version to test (branch, tag, or commit)'
default: "master"
mandrel-packaging-repo:
description: 'Mandrel packaging repository to be used'
default: 'graalvm/mandrel-packaging'
distribution:
description: 'Distribution to build, mandrel or graalvm'
default: "mandrel"
build-from-source:
description: 'Build Mandrel from source instead of grabing a release'
default: "true"
jdk:
description: 'OpenJDK 11 to use, ga or ea (only needed when building from source)'
default: "ga"
builder-image:
description: 'The builder image to use instead of a release or building from source (e.g. quay.io/quarkus/ubi-quarkus-mandrel:20.3-java11)'
default: "null"

env:
# Workaround testsuite locale issue
LANG: en_US.UTF-8
DB_USER: hibernate_orm_test
DB_PASSWORD: hibernate_orm_test
DB_NAME: hibernate_orm_test
NATIVE_TEST_MAVEN_OPTS: "-B --settings ${QUARKUS_PATH}/.github/mvn-settings.xml --fail-at-end -Dtest-containers -Dstart-containers -Dnative-image.xmx=5g -Dnative -Dnative.surefire.skip -Dformat.skip -Dno-descriptor-tests install -DskipDocs"
MX_GIT_CACHE: refcache
JAVA_HOME: ${{ github.workspace }}/openjdk
MANDREL_REPO: ${{ github.workspace }}/mandrel
MANDREL_HOME: ${{ github.workspace }}/../mandrelvm
MX_HOME: ${{ github.workspace }}/mx
QUARKUS_PATH: ${{ github.workspace }}/quarkus
MANDREL_PACKAGING_REPO: ${{ github.workspace }}/mandrel-packaging

jobs:
build-mandrel:
name: Mandrel ${{ github.event.inputs.version }} build - OpenJDK11-${{ github.event.inputs.jdk }}
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'mandrel' && github.event.inputs.builder-image == 'null'}}
with:
repository: ${{ github.event.inputs.repo }}
fetch-depth: 1
ref: ${{ github.event.inputs.version }}
path: ${{ env.MANDREL_REPO }}
- uses: actions/checkout@v2
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'mandrel' && github.event.inputs.builder-image == 'null' }}
with:
repository: graalvm/mx.git
ref: master
path: ${{ env.MX_HOME }}
- uses: actions/checkout@v2
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'mandrel' && github.event.inputs.builder-image == 'null' }}
with:
repository: ${{ github.event.inputs.mandrel-packaging-repo }}
ref: ${{ github.event.inputs.mandrel-packaging-version }}
path: ${{ env.MANDREL_PACKAGING_REPO }}
- uses: actions/[email protected]
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'mandrel' && github.event.inputs.builder-image == 'null' }}
with:
path: ~/.mx
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }}
restore-keys: ${{ runner.os }}-mx-
- name: Get OpenJDK 11 with static libs
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'mandrel' && github.event.inputs.builder-image == 'null' }}
run: |
curl -sL https://api.adoptopenjdk.net/v3/binary/latest/11/${{ github.event.inputs.jdk }}/linux/x64/jdk/hotspot/normal/openjdk -o jdk.tar.gz
curl -sL https://api.adoptopenjdk.net/v3/binary/latest/11/${{ github.event.inputs.jdk }}/linux/x64/staticlibs/hotspot/normal/openjdk -o jdk-static-libs.tar.gz
mkdir -p ${JAVA_HOME}
tar xf jdk.tar.gz -C ${JAVA_HOME} --strip-components=1
tar xf jdk-static-libs.tar.gz -C ${JAVA_HOME} --strip-components=1
echo ${JAVA_HOME}
${JAVA_HOME}/bin/java --version
- name: Build Mandrel
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'mandrel' && github.event.inputs.builder-image == 'null' }}
run: |
${JAVA_HOME}/bin/java -ea ${MANDREL_PACKAGING_REPO}/build.java \
--mx-home ${MX_HOME} \
--mandrel-repo ${MANDREL_REPO} \
--mandrel-home ${MANDREL_HOME} \
--archive-suffix tar.gz
${MANDREL_HOME}/bin/native-image --version
mv mandrel-java11-linux-amd64-*.tar.gz ${{ github.workspace }}/jdk.tgz
- name: Persist Mandrel build
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'mandrel' && github.event.inputs.builder-image == 'null' }}
uses: actions/upload-artifact@v2
with:
name: jdk
path: jdk.tgz

build-graal:
name: GraalVM CE ${{ github.event.inputs.version }} build
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'graalvm' && github.event.inputs.builder-image == 'null'}}
with:
repository: ${{ github.event.inputs.repo }}
fetch-depth: 1
ref: ${{ github.event.inputs.version }}
path: graal
- uses: actions/checkout@v2
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'graalvm' && github.event.inputs.builder-image == 'null' }}
with:
repository: graalvm/mx.git
ref: master
path: mx
- uses: actions/[email protected]
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'graalvm' && github.event.inputs.builder-image == 'null' }}
with:
path: ~/.mx
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }}
restore-keys: ${{ runner.os }}-mx-
- name: Get labs OpenJDK 11
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'graalvm' && github.event.inputs.builder-image == 'null' }}
run: |
mkdir jdk-dl
${MX_PATH}/mx fetch-jdk --java-distribution labsjdk-ce-11 --to jdk-dl --alias ${JAVA_HOME}
- name: Build graalvm native-image
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'graalvm' && github.event.inputs.builder-image == 'null' }}
run: |
cd substratevm
${MX_PATH}/mx --native=native-image --components="Native Image" build
mv $(${MX_PATH}/mx --native=native-image --components="Native Image" graalvm-home) ${MANDREL_HOME}
${MANDREL_HOME}/bin/native-image --version
- name: Tar GraalVM
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'graalvm' && github.event.inputs.builder-image == 'null' }}
run: tar czvf jdk.tgz -C $(dirname ${MANDREL_HOME}) $(basename ${MANDREL_HOME})
- name: Persist Mandrel build
if: ${{ github.event.inputs.build-from-source == 'true' && github.event.inputs.distribution == 'graalvm' && github.event.inputs.builder-image == 'null' }}
uses: actions/upload-artifact@v2
with:
name: jdk
path: jdk.tgz

get-jdk:
name: Get Mandrel/GraalVM CE ${{ github.event.inputs.version }} or OpenJDK11-${{ github.event.inputs.jdk }}
runs-on: ubuntu-18.04
steps:
- name: Get Mandrel ${{ github.event.inputs.version }}
if: ${{ github.event.inputs.build-from-source == 'false' && github.event.inputs.distribution == 'mandrel' && github.event.inputs.builder-image == 'null' }}
run: |
VERSION=${{ github.event.inputs.version }}
curl \
-sL ${GITHUB_SERVER_URL}/graalvm/mandrel/releases/download/${VERSION}/mandrel-java11-linux-amd64-${VERSION##mandrel-}.tar.gz \
-o jdk.tgz
- name: Get GraalVM CE ${{ github.event.inputs.version }}
if: ${{ github.event.inputs.build-from-source == 'false' && github.event.inputs.distribution == 'graalvm' && github.event.inputs.builder-image == 'null' }}
run: |
VERSION=${{ github.event.inputs.version }}
curl \
-sL ${GITHUB_SERVER_URL}/graalvm/graalvm-ce-builds/releases/download/${VERSION}/graalvm-ce-java11-linux-amd64-${VERSION##vm-}.tar.gz \
-o graalvm.tgz
mkdir -p ${JAVA_HOME}
tar xzvf graalvm.tgz -C ${JAVA_HOME} --strip-components=1
${JAVA_HOME}/bin/gu install native-image
${JAVA_HOME}/bin/native-image --version
tar czvf jdk.tgz -C $(dirname ${JAVA_HOME}) $(basename ${JAVA_HOME})
- name: Get OpenJDK11-${{ github.event.inputs.jdk }}
if: ${{ github.event.inputs.builder-image != 'null' }}
run: |
curl -sL https://api.adoptopenjdk.net/v3/binary/latest/11/${{ github.event.inputs.jdk }}/linux/x64/jdk/hotspot/normal/openjdk -o jdk.tgz
- name: Persist Mandrel or OpenJDK
if: ${{ github.event.inputs.build-from-source == 'false' || github.event.inputs.builder-image != 'null' }}
uses: actions/upload-artifact@v2
with:
name: jdk
path: jdk.tgz

get-test-matrix:
name: Get test matrix
runs-on: ubuntu-18.04
outputs:
quarkus-version: ${{ steps.version.outputs.quarkus-version }}
tests-matrix: ${{ steps.version.outputs.tests-matrix }}
steps:
- name: Get Quarkus version and test matrix
id: version
run: |
QUARKUS_VERSION=${{ github.event.inputs.quarkus-version }}
if echo ${QUARKUS_VERSION} | grep '"latest"'
then
quarkus_latest=$(curl https://repo1.maven.org/maven2/io/quarkus/quarkus-bom/maven-metadata.xml | awk -F"[<>]" '/latest/ {print $3}')
export QUARKUS_VERSION=$(echo ${QUARKUS_VERSION} | sed "s/latest/${quarkus_latest}/")
echo ${QUARKUS_VERSION}
fi
echo "::set-output name=quarkus-version::${QUARKUS_VERSION}"
curl --output native-tests.json https://raw.githubusercontent.com/${{ github.event.inputs.quarkus-repo }}/${QUARKUS_VERSION}/.github/native-tests.json
tests_json=$(tr -d '\n' < native-tests.json)
echo ${tests_json}
echo "::set-output name=tests-matrix::${tests_json}"
build-quarkus:
name: Quarkus ${{ needs.get-test-matrix.outputs.quarkus-version }} - OpenJDK11-${{ github.event.inputs.jdk }}
runs-on: ubuntu-18.04
needs:
- get-test-matrix
- build-mandrel
- build-graal
- get-jdk
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.quarkus-repo }}
fetch-depth: 1
ref: ${{ github.event.inputs.quarkus-version }}
path: ${{ env.QUARKUS_PATH }}
- uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-${{ needs.get-test-matrix.outputs.quarkus-version }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-${{ needs.get-test-matrix.outputs.quarkus-version }}-maven-
- name: Download Mandrel or OpenJDK11
uses: actions/download-artifact@v1
with:
name: jdk
path: .
- name: Extract Mandrel or OpenJDK11
shell: bash
run: |
mkdir -p ${JAVA_HOME}
tar xzvf jdk.tgz -C ${JAVA_HOME} --strip-components=1
${JAVA_HOME}/bin/java -version
- name: Build quarkus
run: |
cd ${QUARKUS_PATH}
mvn -e -B -Dquickly
- name: Tar Maven Repo
shell: bash
run: tar -czvf maven-repo-${{ needs.get-test-matrix.outputs.quarkus-version }}-${{ github.event.inputs.jdk }}.tgz -C ~ .m2/repository
- name: Persist Maven Repo
uses: actions/upload-artifact@v2
with:
name: maven-repo-${{ needs.get-test-matrix.outputs.quarkus-version }}-${{ github.event.inputs.jdk }}
path: maven-repo-${{ needs.get-test-matrix.outputs.quarkus-version }}-${{ github.event.inputs.jdk }}.tgz
- name: Delete Local Artifacts From Cache
shell: bash
run: rm -r ~/.m2/repository/io/quarkus

native-tests:
name: Q ${{ needs.get-test-matrix.outputs.quarkus-version }} - ${{ matrix.category }} - OpenJDK11-${{ github.event.inputs.jdk }}
needs:
- build-quarkus
- get-test-matrix
runs-on: ubuntu-18.04
# Ignore the following YAML Schema error
timeout-minutes: ${{matrix.timeout}}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-test-matrix.outputs.tests-matrix) }}
steps:
- name: Download Maven Repo
uses: actions/download-artifact@v1
with:
name: maven-repo-${{ needs.get-test-matrix.outputs.quarkus-version }}-${{ github.event.inputs.jdk }}
path: .
- name: Extract Maven Repo
shell: bash
run: tar -xzvf maven-repo-${{ needs.get-test-matrix.outputs.quarkus-version }}-${{ github.event.inputs.jdk }}.tgz -C ~
- name: Download Mandrel or OpenJDK11
uses: actions/download-artifact@v1
with:
name: jdk
path: .
- name: Extract Mandrel or OpenJDK11
shell: bash
run: |
mkdir -p ${JAVA_HOME}
tar -xzvf jdk.tgz -C ${JAVA_HOME} --strip-components=1
- uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.quarkus-repo }}
fetch-depth: 1
ref: ${{ github.event.inputs.quarkus-version }}
path: ${{ env.QUARKUS_PATH }}
- name: Reclaim disk space
run: ${QUARKUS_PATH}/.github/ci-prerequisites.sh
- name: Build with Maven
env:
TEST_MODULES: ${{matrix.test-modules}}
CATEGORY: ${{matrix.category}}
run: |
if [[ ${{ github.event.inputs.builder-image }} == "null" ]]
then
export BUILDER_IMAGE=""
else
export BUILDER_IMAGE="-Dquarkus.container-image.build=true -Dquarkus.native.builder-image=${{ github.event.inputs.builder-image }}"
fi
cd ${QUARKUS_PATH}
export GRAALVM_HOME="${JAVA_HOME}"
if [[ -f ${GRAALVM_HOME}/bin/native-image ]]
then
${GRAALVM_HOME}/bin/native-image --version
fi
for i in $TEST_MODULES
do modules+=("integration-tests/$i"); done
IFS=,
eval mvn -pl "${modules[*]}" $BUILDER_IMAGE $NATIVE_TEST_MAVEN_OPTS
# add the 'simple with spaces' project to the run of 'Misc1' by executing it explicitly
# done because there is no good way to pass strings with empty values to the previous command
# so this hack is as good as any
if [ "$CATEGORY" == "Misc1" ]; then
mvn -Dnative $BUILDER_IMAGE -B --settings .github/mvn-settings.xml -f 'integration-tests/simple with space/' verify
fi
- name: Prepare failure archive (if maven failed)
if: failure()
shell: bash
run: find . -type d -name '*-reports' -o -wholename '*/build/reports/tests/functionalTest' | tar czvf test-reports.tgz -T -
- name: Upload failure Archive (if maven failed)
uses: actions/upload-artifact@v2
if: failure()
with:
name: test-reports-native-${{matrix.category}}
path: 'test-reports.tgz'
Loading

0 comments on commit 53d1c28

Please sign in to comment.