From bc2700b7dc6039e2a17124a0ca32780383c4a43f Mon Sep 17 00:00:00 2001 From: George Adams Date: Tue, 20 Aug 2024 14:38:31 +0000 Subject: [PATCH] 8282944: GHA: Add Alpine Linux x86_64 pre-integration check Reviewed-by: ihse --- .github/actions/config/action.yml | 2 +- .github/workflows/build-alpine-linux.yml | 112 +++++++++++++++++++++++ .github/workflows/main.yml | 38 +++++++- make/conf/github-actions.conf | 4 + 4 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build-alpine-linux.yml diff --git a/.github/actions/config/action.yml b/.github/actions/config/action.yml index 5f648ffc022..931988accc3 100644 --- a/.github/actions/config/action.yml +++ b/.github/actions/config/action.yml @@ -41,6 +41,6 @@ runs: id: read-config run: | # Extract value from configuration file - value="$(grep -h ${{ inputs.var }}= make/conf/github-actions.conf | cut -d '=' -f 2-)" + value="$(grep -h '^${{ inputs.var }}'= make/conf/github-actions.conf | cut -d '=' -f 2-)" echo "value=$value" >> $GITHUB_OUTPUT shell: bash diff --git a/.github/workflows/build-alpine-linux.yml b/.github/workflows/build-alpine-linux.yml new file mode 100644 index 00000000000..ac5870ca675 --- /dev/null +++ b/.github/workflows/build-alpine-linux.yml @@ -0,0 +1,112 @@ +# +# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +name: 'Build (alpine-linux)' + +on: + workflow_call: + inputs: + platform: + required: true + type: string + extra-conf-options: + required: false + type: string + make-target: + required: false + type: string + default: 'product-bundles test-bundles' + debug-levels: + required: false + type: string + default: '[ "debug", "release" ]' + apk-extra-packages: + required: false + type: string + configure-arguments: + required: false + type: string + make-arguments: + required: false + type: string + +jobs: + build-linux: + name: build + runs-on: ubuntu-22.04 + container: + image: alpine:3.20 + + strategy: + fail-fast: false + matrix: + debug-level: ${{ fromJSON(inputs.debug-levels) }} + include: + - debug-level: debug + flags: --with-debug-level=fastdebug + suffix: -debug+ + + steps: + - name: 'Checkout the JDK source' + uses: actions/checkout@v4 + + - name: 'Install toolchain and dependencies' + run: | + apk update + apk add alpine-sdk alsa-lib-dev autoconf bash cups-dev cups-libs fontconfig-dev freetype-dev grep libx11-dev libxext-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev linux-headers wget zip ${{ inputs.apk-extra-packages }} + + - name: 'Get the BootJDK' + id: bootjdk + uses: ./.github/actions/get-bootjdk + with: + platform: alpine-linux-x64 + + - name: 'Configure' + run: > + bash configure + --with-conf-name=${{ inputs.platform }} + ${{ matrix.flags }} + --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA} + --with-boot-jdk=${{ steps.bootjdk.outputs.path }} + --with-zlib=system + --with-jmod-compress=zip-1 + ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || ( + echo "Dumping config.log:" && + cat config.log && + exit 1) + + - name: 'Build' + id: build + uses: ./.github/actions/do-build + with: + make-target: '${{ inputs.make-target }} ${{ inputs.make-arguments }}' + platform: ${{ inputs.platform }} + debug-suffix: '${{ matrix.suffix }}' + + - name: 'Upload bundles' + uses: ./.github/actions/upload-bundles + with: + platform: ${{ inputs.platform }} + debug-suffix: '${{ matrix.suffix }}' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1dc0b25c345..e4c05acb684 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ on: platforms: description: 'Platform(s) to execute on (comma separated, e.g. "linux-x64, macos, aarch64")' required: true - default: 'linux-x64, linux-x86-hs, linux-x64-variants, linux-cross-compile, macos-x64, macos-aarch64, windows-x64, windows-aarch64, docs' + default: 'linux-x64, linux-x86-hs, linux-x64-variants, linux-cross-compile, alpine-linux-x64, macos-x64, macos-aarch64, windows-x64, windows-aarch64, docs' configure-arguments: description: 'Additional configure arguments' required: false @@ -57,11 +57,15 @@ jobs: select: name: 'Select platforms' runs-on: ubuntu-22.04 + env: + # List of platforms to exclude by default + EXCLUDED_PLATFORMS: 'alpine-linux-x64' outputs: linux-x64: ${{ steps.include.outputs.linux-x64 }} linux-x86-hs: ${{ steps.include.outputs.linux-x86-hs }} linux-x64-variants: ${{ steps.include.outputs.linux-x64-variants }} linux-cross-compile: ${{ steps.include.outputs.linux-cross-compile }} + alpine-linux-x64: ${{ steps.include.outputs.alpine-linux-x64 }} macos-x64: ${{ steps.include.outputs.macos-x64 }} macos-aarch64: ${{ steps.include.outputs.macos-aarch64 }} windows-x64: ${{ steps.include.outputs.windows-x64 }} @@ -78,6 +82,10 @@ jobs: # Returns 'true' if the input platform list matches any of the platform monikers given as argument, # 'false' otherwise. # arg $1: platform name or names to look for + + # Convert EXCLUDED_PLATFORMS from a comma-separated string to an array + IFS=',' read -r -a excluded_array <<< "$EXCLUDED_PLATFORMS" + function check_platform() { if [[ $GITHUB_EVENT_NAME == workflow_dispatch ]]; then input='${{ github.event.inputs.platforms }}' @@ -94,7 +102,13 @@ jobs: normalized_input="$(echo ,$input, | tr -d ' ')" if [[ "$normalized_input" == ",," ]]; then - # For an empty input, assume all platforms should run + # For an empty input, assume all platforms should run, except those in the EXCLUDED_PLATFORMS list + for excluded in "${excluded_array[@]}"; do + if [[ "$1" == "$excluded" ]]; then + echo 'false' + return + fi + done echo 'true' return else @@ -105,6 +119,14 @@ jobs: return fi done + + # If not explicitly included, check against the EXCLUDED_PLATFORMS list + for excluded in "${excluded_array[@]}"; do + if [[ "$1" == "$excluded" ]]; then + echo 'false' + return + fi + done fi echo 'false' @@ -114,6 +136,7 @@ jobs: echo "linux-x86-hs=$(check_platform linux-x86-hs linux x86)" >> $GITHUB_OUTPUT echo "linux-x64-variants=$(check_platform linux-x64-variants variants)" >> $GITHUB_OUTPUT echo "linux-cross-compile=$(check_platform linux-cross-compile cross-compile)" >> $GITHUB_OUTPUT + echo "alpine-linux-x64=$(check_platform alpine-linux-x64 alpine-linux x64)" >> $GITHUB_OUTPUT echo "macos-x64=$(check_platform macos-x64 macos x64)" >> $GITHUB_OUTPUT echo "macos-aarch64=$(check_platform macos-aarch64 macos aarch64)" >> $GITHUB_OUTPUT echo "windows-x64=$(check_platform windows-x64 windows x64)" >> $GITHUB_OUTPUT @@ -221,6 +244,16 @@ jobs: make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.linux-cross-compile == 'true' + build-alpine-linux-x64: + name: alpine-linux-x64 + needs: select + uses: ./.github/workflows/build-alpine-linux.yml + with: + platform: alpine-linux-x64 + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} + if: needs.select.outputs.alpine-linux-x64 == 'true' + build-macos-x64: name: macos-x64 needs: select @@ -344,6 +377,7 @@ jobs: - build-linux-x64-hs-minimal - build-linux-x64-hs-optimized - build-linux-cross-compile + - build-alpine-linux-x64 - build-macos-x64 - build-macos-aarch64 - build-windows-x64 diff --git a/make/conf/github-actions.conf b/make/conf/github-actions.conf index 3cb56b47b50..eca6c05033d 100644 --- a/make/conf/github-actions.conf +++ b/make/conf/github-actions.conf @@ -32,6 +32,10 @@ LINUX_X64_BOOT_JDK_EXT=tar.gz LINUX_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk22.0.2/c9ecb94cd31b495da20a27d4581645e8/9/GPL/openjdk-22.0.2_linux-x64_bin.tar.gz LINUX_X64_BOOT_JDK_SHA256=41536f115668308ecf4eba92aaf6acaeb0936225828b741efd83b6173ba82963 +ALPINE_LINUX_X64_BOOT_JDK_EXT=tar.gz +ALPINE_LINUX_X64_BOOT_JDK_URL=https://github.com/adoptium/temurin22-binaries/releases/download/jdk-22.0.2%2B9/OpenJDK22U-jdk_x64_alpine-linux_hotspot_22.0.2_9.tar.gz +ALPINE_LINUX_X64_BOOT_JDK_SHA256=49f73414824b1a7c268a611225fa4d7ce5e25600201e0f1cd59f94d1040b5264 + MACOS_AARCH64_BOOT_JDK_EXT=tar.gz MACOS_AARCH64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk22.0.2/c9ecb94cd31b495da20a27d4581645e8/9/GPL/openjdk-22.0.2_macos-aarch64_bin.tar.gz MACOS_AARCH64_BOOT_JDK_SHA256=3dab98730234e1a87aec14bcb8171d2cae101e96ff4eed1dab96abbb08e843fd