|
| 1 | +name: Build Quarkus |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + artifacts-suffix: |
| 7 | + type: string |
| 8 | + description: 'The maven repo artifact suffix to use' |
| 9 | + default: "null" |
| 10 | + build-from-source: |
| 11 | + type: boolean |
| 12 | + description: 'Build from source or use a release' |
| 13 | + default: true |
| 14 | + builder-image: |
| 15 | + type: string |
| 16 | + 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)' |
| 17 | + default: "null" |
| 18 | + maven-deploy-local: |
| 19 | + type: string |
| 20 | + description: 'Build flag controlling whether to deploy maven artifacts locally' |
| 21 | + default: "" |
| 22 | + target-os: |
| 23 | + type: string |
| 24 | + description: 'The operating system we are building for (linux or windows)' |
| 25 | + default: "linux" |
| 26 | + quarkus-repo: |
| 27 | + type: string |
| 28 | + description: 'The Quarkus repository to be used' |
| 29 | + default: 'quarkusio/quarkus' |
| 30 | + quarkus-version: |
| 31 | + type: string |
| 32 | + description: 'Quarkus version to test (branch, tag, commit, or "latest")' |
| 33 | + # "latest" is replaced by the latest release available in maven |
| 34 | + default: "main" |
| 35 | + # Builder image can't be tested on Windows due to https://github.com/actions/virtual-environments/issues/1143 |
| 36 | + # builder-image: |
| 37 | + # 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)' |
| 38 | + # default: "null" |
| 39 | + |
| 40 | +env: |
| 41 | + QUARKUS_PATH: quarkus |
| 42 | + COMMON_MAVEN_ARGS: "-e -B --settings .github/mvn-settings.xml --fail-at-end" |
| 43 | + MANDREL_HOME: ${{ github.workspace }}/mandrelvm |
| 44 | + |
| 45 | +jobs: |
| 46 | + build-quarkus: |
| 47 | + name: Quarkus build |
| 48 | + runs-on: ubuntu-latest |
| 49 | + strategy: |
| 50 | + fail-fast: false |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + with: |
| 54 | + repository: graalvm/mandrel |
| 55 | + fetch-depth: 1 |
| 56 | + path: workflow-mandrel |
| 57 | + - uses: actions/checkout@v4 |
| 58 | + with: |
| 59 | + repository: ${{ inputs.quarkus-repo }} |
| 60 | + fetch-depth: 1 |
| 61 | + ref: ${{ inputs.quarkus-version }} |
| 62 | + path: ${{ env.QUARKUS_PATH }} |
| 63 | + - uses: actions/cache@v4 |
| 64 | + with: |
| 65 | + path: ~/.m2/repository |
| 66 | + key: ${{ inputs.target-os }}-${{ inputs.quarkus-version }}-maven-${{ hashFiles('**/pom.xml') }} |
| 67 | + restore-keys: ${{ inputs.target-os }}-${{ inputs.quarkus-version }}-maven- |
| 68 | + - name: Change quarkus.version for Quarkus 2.2 to make mandrel-integration-test not apply quarkus_main.patch |
| 69 | + # See https://github.com/Karm/mandrel-integration-tests/pull/64 |
| 70 | + run: | |
| 71 | + if [ "${{ inputs.quarkus-version }}" == "2.2" ] |
| 72 | + then |
| 73 | + cd quarkus |
| 74 | + bash ../workflow-mandrel/.github/update_quarkus_version.sh 2.2.999 |
| 75 | + fi |
| 76 | + # Use Java 17 to build Quarkus as that's the lowest supported JDK version currently |
| 77 | + - uses: actions/setup-java@v4 |
| 78 | + with: |
| 79 | + distribution: 'temurin' |
| 80 | + java-version: '17' |
| 81 | + - name: Download GraalVM Maven Repo |
| 82 | + if: ${{ inputs.build-from-source == true && inputs.builder-image == 'null' && inputs.maven-deploy-local != ''}} |
| 83 | + uses: actions/download-artifact@v4 |
| 84 | + with: |
| 85 | + name: org-graalvm-artefacts-${{ inputs.artifacts-suffix }} |
| 86 | + path: . |
| 87 | + - name: Download GraalVM Maven Version |
| 88 | + if: ${{ inputs.build-from-source == true && inputs.builder-image == 'null' && inputs.maven-deploy-local != ''}} |
| 89 | + uses: actions/download-artifact@v4 |
| 90 | + with: |
| 91 | + name: mandrel-maven-version-${{ inputs.artifacts-suffix }} |
| 92 | + path: . |
| 93 | + - name: Extract GraalVM Maven Repo and GraalVM Maven Version |
| 94 | + if: ${{ inputs.build-from-source == true && inputs.builder-image == 'null' && inputs.maven-deploy-local != ''}} |
| 95 | + run: | |
| 96 | + tar -xzvf graalvm-maven-artefacts.tgz -C ~ |
| 97 | + tar -xzvf graalvm-version.tgz -C $(dirname ${MANDREL_HOME}) |
| 98 | + - name: Build quarkus with local graalvm version |
| 99 | + if: ${{ inputs.build-from-source == true && inputs.builder-image == 'null' && inputs.maven-deploy-local != ''}} |
| 100 | + run: | |
| 101 | + rm -f maven_graalvm_before_build.txt maven_graalvm_after_build.txt |
| 102 | + find ~/.m2/repository/org/graalvm | sort > maven_graalvm_before_build.txt |
| 103 | + GRAAL_MVN_ARTIFACTS_VERS=$(cat ${MANDREL_HOME}/.maven-version) |
| 104 | + echo "Building quarkus with locally installed GraalVM maven artefacts in version: ${GRAAL_MVN_ARTIFACTS_VERS}" |
| 105 | + cd ${QUARKUS_PATH} |
| 106 | + ./mvnw ${COMMON_MAVEN_ARGS} -Dquickly -Dgraal-sdk.version="${GRAAL_MVN_ARTIFACTS_VERS}" |
| 107 | + cd - |
| 108 | + find ~/.m2/repository/org/graalvm | sort > maven_graalvm_after_build.txt |
| 109 | + diff -u maven_graalvm_before_build.txt maven_graalvm_after_build.txt |
| 110 | + - name: Build quarkus with default graalvm version |
| 111 | + if: ${{ inputs.build-from-source == false || inputs.builder-image != 'null' || inputs.maven-deploy-local == ''}} |
| 112 | + run: | |
| 113 | + cd ${QUARKUS_PATH} |
| 114 | + ./mvnw ${COMMON_MAVEN_ARGS} -Dquickly |
| 115 | + cd - |
| 116 | + - name: Tar Maven Repo |
| 117 | + if: inputs.target-os != 'windows' |
| 118 | + run: | |
| 119 | + tar -czvf maven-repo.tgz -C ~ .m2/repository |
| 120 | + - name: Tar Maven Repo (windows) |
| 121 | + if: inputs.target-os == 'windows' |
| 122 | + run: | |
| 123 | + tar -I 'pigz -9' -cf maven-repo.tgz -C ~ .m2/repository |
| 124 | + - name: Persist Maven Repo |
| 125 | + uses: actions/upload-artifact@v4 |
| 126 | + with: |
| 127 | + name: ${{ inputs.target-os }}-maven-repo-${{ inputs.artifacts-suffix }} |
| 128 | + path: maven-repo.tgz |
| 129 | + - name: Delete Local Quarkus Artifacts From Cache |
| 130 | + run: | |
| 131 | + rm -r ~/.m2/repository/io/quarkus |
| 132 | + - name: Delete Local GraalVM Artifacts From Cache |
| 133 | + if: ${{ inputs.build-from-source == true && inputs.builder-image == 'null' && inputs.maven-deploy-local != ''}} |
| 134 | + run: | |
| 135 | + rm -rf ~/.m2/repository/org/graalvm |
0 commit comments