From 4c9a90131c2ab9eca7d9bc72fea8ea24df3e7033 Mon Sep 17 00:00:00 2001 From: Abhinay Agarwal Date: Tue, 3 Sep 2024 13:45:24 +0530 Subject: [PATCH] Add on demand 'build' and 'tag release' for static libs (#5) --- .github/actions/do-build/action.yml | 2 +- .github/actions/upload-bundles/action.yml | 83 ++++++- .github/workflows/build-android-linux.yml | 149 ++++++++++++ .github/workflows/build-ios-macos.yml | 118 +++++++++ .github/workflows/build-linux.yml | 1 + .github/workflows/build-macos.yml | 1 + .github/workflows/build-windows.yml | 1 + .github/workflows/static-build.yml | 281 ++++++++++++++++++++++ .github/workflows/static-release.yml | 178 ++++++++++++++ 9 files changed, 811 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build-android-linux.yml create mode 100644 .github/workflows/build-ios-macos.yml create mode 100644 .github/workflows/static-build.yml create mode 100644 .github/workflows/static-release.yml diff --git a/.github/actions/do-build/action.yml b/.github/actions/do-build/action.yml index 79eddf8c70f..2bf3d0e5db0 100644 --- a/.github/actions/do-build/action.yml +++ b/.github/actions/do-build/action.yml @@ -42,7 +42,7 @@ runs: - name: 'Build' id: build run: > - make LOG=info ${{ inputs.make-target }} + make LOG=cmdlines,info ${{ inputs.make-target }} || bash ./.github/scripts/gen-build-failure-report.sh "$GITHUB_STEP_SUMMARY" shell: bash diff --git a/.github/actions/upload-bundles/action.yml b/.github/actions/upload-bundles/action.yml index b35ee3a42e9..0fcbe3a0753 100644 --- a/.github/actions/upload-bundles/action.yml +++ b/.github/actions/upload-bundles/action.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 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 @@ -32,6 +32,9 @@ inputs: debug-suffix: description: 'File name suffix denoting debug level, possibly empty' required: false + make-target: + description: 'Make target' + required: false runs: using: composite @@ -68,10 +71,86 @@ runs: fi shell: bash + - name: 'Create libjdk.a' + run: | + cd build + mkdir -p allobjs + cd allobjs + find .. -name "*.a" -exec ar x {} \; + ar rcs ../libjdk.a *.o + cd .. + rm -rf allobjs + shell: bash + if: inputs.make-target == 'static-libs' && inputs.debug-suffix != '-debug' && !startsWith(inputs.platform, 'windows') + + - name: 'List all *.lib files' + run: | + Get-ChildItem -Path .\build -Filter *.lib -Recurse + shell: pwsh + if: inputs.make-target == 'static-libs' && inputs.debug-suffix != '-debug' && startsWith(inputs.platform, 'windows') + + - name: 'Create libjdk.lib for windows' + run: | + # Define the root path where to start the search + $searchRoot = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC" + + # Search for lib.exe using a wildcard for the version + $libPath = Get-ChildItem -Path $searchRoot -Recurse -Filter "lib.exe" -ErrorAction SilentlyContinue | Where-Object { $_.FullName -like "*14.29*\bin\Hostx64\x64\lib.exe" } + + # Check if libPath is not empty + if ($libPath) { + # Store the full path of the first found lib.exe (if there are multiple, you can adjust as needed) + $libPath = $libPath[0].FullName + Write-Output "Found lib.exe at: $libPath" + + # Change directory to where .lib files are located + cd build + + # Collect all .lib files in the directory and subdirectories + $libFiles = Get-ChildItem -Path . -Filter *.lib -Recurse | Select-Object -ExpandProperty FullName + + # Check if any .lib files were found + if ($libFiles.Count -eq 0) { + Write-Output "No .lib files found in the specified directory." + exit 1 + } + + # Prepare the command arguments + $arguments = "/OUT:libjdk.lib " + ($libFiles -join " ") + + # Construct the command + $command = "& `"$libPath`" $arguments" + + # Execute the command + Write-Output "Executing command: $command" + Invoke-Expression $command + + # Check if the output file was created + if (Test-Path "libjdk.lib") { + Write-Output "Successfully created libjdk.lib" + } else { + Write-Output "Failed to create libjdk.lib" + exit 1 + } + } else { + Write-Output "lib.exe not found." + exit 1 + } + shell: pwsh + if: inputs.make-target == 'static-libs' && inputs.debug-suffix != '-debug' && startsWith(inputs.platform, 'windows') + - name: 'Upload bundles artifact' uses: actions/upload-artifact@v4 with: name: bundles-${{ inputs.platform }}${{ inputs.debug-suffix }} path: bundles retention-days: 1 - if: steps.bundles.outputs.bundles-found == 'true' + if: steps.bundles.outputs.bundles-found == 'true' && inputs.make-target != 'static-libs' + + - name: 'Upload static image artifact' + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.platform }} + path: build/libjdk.* + retention-days: 1 + if: inputs.make-target == 'static-libs' && inputs.debug-suffix != '-debug' diff --git a/.github/workflows/build-android-linux.yml b/.github/workflows/build-android-linux.yml new file mode 100644 index 00000000000..d712cc32fae --- /dev/null +++ b/.github/workflows/build-android-linux.yml @@ -0,0 +1,149 @@ +# +# Copyright (c) 2024, Gluon 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 (android)' + +on: + workflow_call: + inputs: + platform: + required: true + type: string + extra-conf-options: + required: false + type: string + make-target: + required: false + type: string + default: 'static-libs' + debug-levels: + required: false + type: string + default: '[ "release" ]' + gcc-major-version: + required: true + type: string + gcc-package-suffix: + required: false + type: string + default: '' + apt-architecture: + required: false + type: string + apt-extra-packages: + required: false + type: string + configure-arguments: + required: false + type: string + make-arguments: + required: false + type: string + +jobs: + build-android: + name: build + runs-on: ubuntu-22.04 + + steps: + - name: 'Checkout the JDK source' + uses: actions/checkout@v4 + + - name: 'Get the BootJDK' + id: bootjdk + uses: ./.github/actions/get-bootjdk + with: + platform: linux-x64 + + - name: 'Get JTReg' + id: jtreg + uses: ./.github/actions/get-jtreg + + - name: 'Get GTest' + id: gtest + uses: ./.github/actions/get-gtest + + - name: 'Set architecture' + id: arch + run: | + # Set a proper suffix for packages if using a different architecture + if [[ '${{ inputs.apt-architecture }}' != '' ]]; then + echo 'suffix=:${{ inputs.apt-architecture }}' >> $GITHUB_OUTPUT + fi + + # Upgrading apt to solve libc6 installation bugs, see JDK-8260460. + - name: 'Install toolchain and dependencies' + run: | + # Install dependencies using apt-get + if [[ '${{ inputs.apt-architecture }}' != '' ]]; then + sudo dpkg --add-architecture ${{ inputs.apt-architecture }} + fi + sudo apt-get update + sudo apt-get install --only-upgrade apt + sudo apt-get install gcc-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }} g++-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }} libxrandr-dev${{ steps.arch.outputs.suffix }} libxtst-dev${{ steps.arch.outputs.suffix }} libcups2-dev${{ steps.arch.outputs.suffix }} libasound2-dev${{ steps.arch.outputs.suffix }} ${{ inputs.apt-extra-packages }} + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ inputs.gcc-major-version }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ inputs.gcc-major-version }} + + - name: 'Android NDK' + uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r26c + add-to-path: false + + - name: 'Configure' + run: > + bash configure + --with-conf-name=android-linux-aarch64 + --enable-headless-only + --with-boot-jdk=${{ steps.bootjdk.outputs.path }} + --with-toolchain-path=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin + --with-sysroot=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot + --with-toolchain-type=clang + --with-jvm-variants=minimal + --host=aarch64-linux-android + --target=aarch64-linux-android + --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA} + ${{ matrix.flags }} + ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || ( + echo "Dumping config.log:" && + cat config.log && + exit 1) + env: + ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} + + - 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 }}' + make-target: 'static-libs' diff --git a/.github/workflows/build-ios-macos.yml b/.github/workflows/build-ios-macos.yml new file mode 100644 index 00000000000..07ae7ed767b --- /dev/null +++ b/.github/workflows/build-ios-macos.yml @@ -0,0 +1,118 @@ +# +# Copyright (c) 2024, Gluon 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 (ios)' + +on: + workflow_call: + inputs: + platform: + required: true + type: string + runs-on: + required: true + type: string + extra-conf-options: + required: false + type: string + make-target: + required: false + type: string + default: 'static-libs' + debug-levels: + required: false + type: string + default: '[ "release" ]' + xcode-toolset-version: + required: true + type: string + configure-arguments: + required: false + type: string + make-arguments: + required: false + type: string + +jobs: + build-macos: + name: build + runs-on: ${{ inputs.runs-on }} + + steps: + - name: 'Checkout the JDK source' + uses: actions/checkout@v4 + + - name: 'Get the BootJDK' + id: bootjdk + uses: ./.github/actions/get-bootjdk + with: + platform: macos-aarch64 + + - name: 'Get JTReg' + id: jtreg + uses: ./.github/actions/get-jtreg + + - name: 'Get GTest' + id: gtest + uses: ./.github/actions/get-gtest + + - name: 'Install toolchain and dependencies' + run: | + # Run Homebrew installation and xcode-select + brew install autoconf make + sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-toolset-version }}.app/Contents/Developer + # This will make GNU make available as 'make' and not only as 'gmake' + echo '/usr/local/opt/make/libexec/gnubin' >> $GITHUB_PATH + wget -P /tmp https://github.com/apple/cups/archive/refs/tags/v2.3.6.zip && unzip /tmp/v2.3.6.zip -d /tmp + - name: 'Configure' + run: > + bash configure + --with-conf-name=ios-macos-aarch64 + --enable-headless-only + --with-boot-jdk=${{ steps.bootjdk.outputs.path }} + --openjdk-target=aarch64-macos-ios + --with-cups-include=/tmp/cups-2.3.6 + --with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk + --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA} + ${{ matrix.flags }} + ${{ 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 }}' + make-target: 'static-libs' \ No newline at end of file diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index f3ea4e4fb6a..87b958b938f 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -143,3 +143,4 @@ jobs: with: platform: ${{ inputs.platform }} debug-suffix: '${{ matrix.suffix }}' + make-target: 'static-libs' diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 90bb6af044f..5155e6dfd52 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -124,3 +124,4 @@ jobs: with: platform: ${{ inputs.platform }} debug-suffix: '${{ matrix.suffix }}' + make-target: 'static-libs' diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index d02ef91ad86..d4c05169943 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -153,3 +153,4 @@ jobs: with: platform: ${{ inputs.platform }} debug-suffix: '${{ matrix.suffix }}' + make-target: 'static-libs' diff --git a/.github/workflows/static-build.yml b/.github/workflows/static-build.yml new file mode 100644 index 00000000000..c4fb3df7b93 --- /dev/null +++ b/.github/workflows/static-build.yml @@ -0,0 +1,281 @@ +# +# Copyright (c) 2024, Gluon 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: 'OpenJDK Static Builds' + +on: + workflow_dispatch: + inputs: + platforms: + description: 'Platform(s) to execute on (comma separated, e.g. "android-linux-aarch64, ios-macos-aarch64, linux-x64, macos, aarch64")' + required: true + default: 'android-linux-aarch64, ios-macos-aarch64, linux-x64, macos-x64, macos-aarch64, windows-x64, windows-aarch64' + configure-arguments: + description: 'Additional configure arguments' + required: false + make-arguments: + description: 'Additional make arguments' + required: false + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + ### + ### Determine platforms to include + ### + + select: + name: 'Select platforms' + runs-on: ubuntu-22.04 + env: + # List of platforms to exclude by default + EXCLUDED_PLATFORMS: 'alpine-linux-x64' + outputs: + android-linux-aarch64: ${{ steps.include.outputs.android-linux-aarch64 }} + ios-macos-aarch64: ${{ steps.include.outputs.ios-macos-aarch64 }} + 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 }} + windows-aarch64: ${{ steps.include.outputs.windows-aarch64 }} + docs: ${{ steps.include.outputs.docs }} + + steps: + # This function must be inlined in main.yml, or we'd be forced to checkout the repo + - name: 'Check what jobs to run' + id: include + run: | + # Determine which platform jobs to run + + # 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 }}' + elif [[ $GITHUB_EVENT_NAME == push ]]; then + if [[ '${{ !secrets.JDK_SUBMIT_FILTER || startsWith(github.ref, 'refs/heads/submit/') }}' == 'false' ]]; then + # If JDK_SUBMIT_FILTER is set, and this is not a "submit/" branch, don't run anything + >&2 echo 'JDK_SUBMIT_FILTER is set and not a "submit/" branch' + echo 'false' + return + else + input='android-linux-aarch64, ios-macos-aarch64' # what should we do here? + fi + fi + + normalized_input="$(echo ,$input, | tr -d ' ')" + if [[ "$normalized_input" == ",," ]]; then + # 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 + # Check for all acceptable platform names + for part in $* ; do + if echo "$normalized_input" | grep -q -e ",$part," ; then + echo 'true' + 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' + } + + echo "android-linux-aarch64=$(check_platform android-linux-aarch64 android linux aarch64)" >> $GITHUB_OUTPUT + echo "ios-macos-aarch64=$(check_platform ios-macos-aarch64 ios macos aarch64)" >> $GITHUB_OUTPUT + echo "linux-x64=$(check_platform linux-x64 linux x64)" >> $GITHUB_OUTPUT + 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 + echo "windows-aarch64=$(check_platform windows-aarch64 windows aarch64)" >> $GITHUB_OUTPUT + echo "docs=$(check_platform docs)" >> $GITHUB_OUTPUT + + ### + ### Build jobs + ### + + build-android-linux-aarch64: + name: android-linux-aarch64 + needs: select + uses: ./.github/workflows/build-android-linux.yml + with: + platform: android-linux-aarch64 + make-target: 'static-libs' + gcc-major-version: '10' + debug-levels: '[ "release" ]' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} + if: needs.select.outputs.android-linux-aarch64 == 'true' + + build-ios-macos-aarch64: + name: ios-macos-aarch64 + needs: select + uses: ./.github/workflows/build-ios-macos.yml + with: + platform: ios-macos-aarch64 + runs-on: 'macos-14' + make-target: 'static-libs' + xcode-toolset-version: '14.3.1' + debug-levels: '[ "release" ]' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} + if: needs.select.outputs.ios-macos-aarch64 == 'true' + + build-linux-x64: + name: linux-x64 + needs: select + uses: ./.github/workflows/build-linux.yml + with: + platform: linux-x64 + make-target: 'static-libs' + gcc-major-version: '10' + debug-levels: '[ "release" ]' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} + if: needs.select.outputs.linux-x64 == 'true' + + build-macos-x64: + name: macos-x64 + needs: select + uses: ./.github/workflows/build-macos.yml + with: + platform: macos-x64 + runs-on: 'macos-13' + make-target: 'static-libs' + xcode-toolset-version: '14.3.1' + debug-levels: '[ "release" ]' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} + if: needs.select.outputs.macos-x64 == 'true' + + build-macos-aarch64: + name: macos-aarch64 + needs: select + uses: ./.github/workflows/build-macos.yml + with: + platform: macos-aarch64 + runs-on: 'macos-14' + make-target: 'static-libs' + xcode-toolset-version: '14.3.1' + debug-levels: '[ "release" ]' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} + if: needs.select.outputs.macos-aarch64 == 'true' + + build-windows-x64: + name: windows-x64 + needs: select + uses: ./.github/workflows/build-windows.yml + with: + platform: windows-x64 + make-target: 'static-libs' + msvc-toolset-version: '14.29' + msvc-toolset-architecture: 'x86.x64' + debug-levels: '[ "release" ]' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} + if: needs.select.outputs.windows-x64 == 'true' + + build-windows-aarch64: + name: windows-aarch64 + needs: select + uses: ./.github/workflows/build-windows.yml + with: + platform: windows-aarch64 + make-target: 'static-libs' + msvc-toolset-version: '14.29' + msvc-toolset-architecture: 'arm64' + extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin' + debug-levels: '[ "release" ]' + configure-arguments: ${{ github.event.inputs.configure-arguments }} + make-arguments: ${{ github.event.inputs.make-arguments }} + if: needs.select.outputs.windows-aarch64 == 'true' + + # Remove bundles so they are not misconstrued as binary distributions from the JDK project + remove-bundles: + name: 'Remove bundle artifacts' + runs-on: ubuntu-22.04 + if: always() + needs: + - build-android-linux-aarch64 + - build-ios-macos-aarch64 + - build-linux-x64 + - build-macos-x64 + - build-macos-aarch64 + - build-windows-x64 + - build-windows-aarch64 + + steps: + - name: 'Remove bundle artifacts' + if: needs.select.outputs.android-linux-aarch64 == 'false' # should this be here? + run: | + # Find and remove all bundle artifacts + # See: https://docs.github.com/en/rest/actions/artifacts?apiVersion=2022-11-28 + ALL_ARTIFACT_IDS="$(curl -sL \ + -H 'Accept: application/vnd.github+json' \ + -H 'Authorization: Bearer ${{ github.token }}' \ + -H 'X-GitHub-Api-Version: 2022-11-28' \ + '${{ github.api_url }}/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts?per_page=100')" + BUNDLE_ARTIFACT_IDS="$(echo "$ALL_ARTIFACT_IDS" | jq -r -c '.artifacts | map(select(.name|startswith("bundles-"))) | .[].id')" + for id in $BUNDLE_ARTIFACT_IDS; do + echo "Removing $id" + curl -sL \ + -X DELETE \ + -H 'Accept: application/vnd.github+json' \ + -H 'Authorization: Bearer ${{ github.token }}' \ + -H 'X-GitHub-Api-Version: 2022-11-28' \ + "${{ github.api_url }}/repos/${{ github.repository }}/actions/artifacts/$id" \ + || echo "Failed to remove bundle" + done diff --git a/.github/workflows/static-release.yml b/.github/workflows/static-release.yml new file mode 100644 index 00000000000..727b336bbb0 --- /dev/null +++ b/.github/workflows/static-release.yml @@ -0,0 +1,178 @@ +# +# Copyright (c) 2024, Gluon 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: 'OpenJDK Static Release' + +on: + push: + tags: + - '*' + +jobs: + build-android-linux-aarch64: + name: android-linux-aarch64 + uses: ./.github/workflows/build-android-linux.yml + with: + platform: android-linux-aarch64 + make-target: 'static-libs' + gcc-major-version: '10' + debug-levels: '[ "release" ]' + + build-ios-macos-aarch64: + name: ios-macos-aarch64 + uses: ./.github/workflows/build-ios-macos.yml + with: + platform: ios-macos-aarch64 + runs-on: 'macos-14' + make-target: 'static-libs' + xcode-toolset-version: '14.3.1' + debug-levels: '[ "release" ]' + + build-linux-x64: + name: linux-x64 + uses: ./.github/workflows/build-linux.yml + with: + platform: linux-x64 + make-target: 'static-libs' + gcc-major-version: '10' + debug-levels: '[ "release" ]' + + build-macos-x64: + name: macos-x64 + uses: ./.github/workflows/build-macos.yml + with: + platform: macos-x64 + runs-on: 'macos-13' + make-target: 'static-libs' + xcode-toolset-version: '14.3.1' + debug-levels: '[ "release" ]' + + build-macos-aarch64: + name: macos-aarch64 + uses: ./.github/workflows/build-macos.yml + with: + platform: macos-aarch64 + runs-on: 'macos-14' + make-target: 'static-libs' + xcode-toolset-version: '14.3.1' + debug-levels: '[ "release" ]' + + build-windows-x64: + name: windows-x64 + uses: ./.github/workflows/build-windows.yml + with: + platform: windows-x64 + make-target: 'static-libs' + msvc-toolset-version: '14.29' + msvc-toolset-architecture: 'x86.x64' + debug-levels: '[ "release" ]' + + build-windows-aarch64: + name: windows-aarch64 + uses: ./.github/workflows/build-windows.yml + with: + platform: windows-aarch64 + make-target: 'static-libs' + msvc-toolset-version: '14.29' + msvc-toolset-architecture: 'arm64' + extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin' + debug-levels: '[ "release" ]' + + release: + needs: [ + build-android-linux-aarch64, build-ios-macos-aarch64, + build-linux-x64, + build-macos-x64, build-macos-aarch64, + build-windows-x64, build-windows-aarch64 + ] + runs-on: ubuntu-20.04 + steps: + - name: Download Android Linux AArch64 artifact + uses: actions/download-artifact@v4 + with: + name: android-linux-aarch64 + path: ./dist/android-linux-aarch64 + + - name: Download iOS macOS AArch64 artifact + uses: actions/download-artifact@v4 + with: + name: ios-macos-aarch64 + path: ./dist/ios-macos-aarch64 + + - name: Download Linux x64 artifact + uses: actions/download-artifact@v4 + with: + name: linux-x64 + path: ./dist/linux-x64 + + - name: Download macOS x64 artifact + uses: actions/download-artifact@v4 + with: + name: macos-x64 + path: ./dist/macos-x64 + + - name: Download macOS AArch64 artifact + uses: actions/download-artifact@v4 + with: + name: macos-aarch64 + path: ./dist/macos-aarch64 + + - name: Download Windows x64 artifact + uses: actions/download-artifact@v4 + with: + name: windows-x64 + path: ./dist/windows-x64 + + - name: Download Windows AArch64 artifact + uses: actions/download-artifact@v4 + with: + name: windows-aarch64 + path: ./dist/windows-aarch64 + + - name: Check downloaded artifacts + run: | + pwd + ls -R ./dist + + - name: Zip downloaded artifacts + run: | + cd ./dist + zip -r android-linux-aarch64.zip android-linux-aarch64 + zip -r ios-macos-aarch64.zip ios-macos-aarch64 + zip -r linux-x64.zip linux-x64 + zip -r macos-x64.zip macos-x64 + zip -r macos-aarch64.zip macos-aarch64 + zip -r windows-x64.zip windows-x64 + zip -r windows-aarch64.zip windows-aarch64 + + - name: Check zip files + run: | + ls -R ./dist + + - name: Release + uses: softprops/action-gh-release@v2 + with: + files: | + ./dist/*.zip