Skip to content

Update build.yml

Update build.yml #6

Workflow file for this run

name: Build OpenJDK 17 for Android and iOS
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 1 1 */2 *"
jobs:
build_android:
strategy:
matrix:
arch: ["aarch32", "aarch64", "x86", "x86_64"]
version: [17, 21]
fail-fast: false
name: "Build Java ${{ matrix.version }} for Android ${{matrix.arch}}"
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: set up JDK 1.${{ matrix.version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.version }}
distribution: temurin
- name: Install build dependencies
run: |
sudo apt update
sudo apt -y install autoconf python3 python-is-python3 unzip zip systemtap-sdt-dev libxtst-dev libasound2-dev libelf-dev libfontconfig1-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libxtst-dev libxt-dev
- name: Build with CI build script
run: export TARGET_VERSION=${{ matrix.version }} && bash "1_ci_build_arch_${{matrix.arch}}.sh"
- name: Upload JDK build output
uses: actions/upload-artifact@v4
with:
name: "jdk${{ matrix.version }}-${{matrix.arch}}"
path: jdk${{ matrix.version }}*.tar.xz
- name: Upload JRE build output
uses: actions/upload-artifact@v4
with:
name: "jre${{ matrix.version }}-${{matrix.arch}}"
path: jre${{ matrix.version }}*.tar.xz
- name: Upload JRE debuginfo build output
uses: actions/upload-artifact@v4
with:
name: "jre${{ matrix.version }}-debuginfo-${{matrix.arch}}"
path: dizout
build_iosport:
strategy:
matrix:
version: [17, 21]
fail-fast: false
name: "Build Java ${{ matrix.version }} for iOS aarch64"
runs-on: macos-latest
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Apply repo-root patch (idempotent)
if: runner.os == 'macOS'
run: |
set -euo pipefail
PATCH="./patches/jre_21/ios/fix_fdopen.patch"
echo "Looking for patch at $PATCH"
if [ ! -f "$PATCH" ]; then
echo "Patch not found at $PATCH" >&2
exit 1
fi
# If the patch cleanly applies, apply it.
if git apply --check "$PATCH" 2>/dev/null; then
git apply "$PATCH"
echo "Patch applied"
# If the reverse of the patch applies cleanly, the patch was already applied.
elif git apply --check --reverse "$PATCH" 2>/dev/null; then
echo "Patch already applied; skipping"
else
echo "Patch cannot be applied cleanly. Showing git apply --check output:" >&2
git apply --check "$PATCH" || true
echo "Attempting git apply --reject to capture rejects for manual inspection" >&2
git apply --reject "$PATCH" || true
exit 1
fi
- name: Build with CI build script
run: |
export PATH=/opt/procursus/bin:/opt/homebrew/bin:$PATH
export JAVA_HOME=$(/usr/libexec/java_home -v ${{ matrix.version }})
export BUILD_IOS=1
export TARGET_VERSION=${{ matrix.version }}
bash "1_ci_build_arch_aarch64.sh"
# - name: Upload JDK build output
# uses: actions/upload-artifact@v4
# with:
# name: "jdk17-ios-aarch64"
# path: jdk17*.tar.xz
- name: Upload JRE build output
uses: actions/upload-artifact@v4
with:
name: "jre${{ matrix.version }}-ios-aarch64"
path: jre${{ matrix.version }}*.tar.xz
- name: Upload JRE debuginfo build output
uses: actions/upload-artifact@v4
with:
name: "jre${{ matrix.version }}-ios-debuginfo-aarch64"
path: dizout
pojav:
needs: build_android
runs-on: ubuntu-22.04
strategy:
matrix:
version: [17, 21]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get jre${{ matrix.version }}-aarch32
uses: actions/download-artifact@v4
with:
name: jre${{ matrix.version }}-aarch32
path: pojav
- name: Get jre${{ matrix.version }}-aarch64
uses: actions/download-artifact@v4
with:
name: jre${{ matrix.version }}-aarch64
path: pojav
- name: Get jre${{ matrix.version }}-x86
uses: actions/download-artifact@v4
with:
name: jre${{ matrix.version }}-x86
path: pojav
- name: Get jre${{ matrix.version }}-x86_64
uses: actions/download-artifact@v4
with:
name: jre${{ matrix.version }}-x86_64
path: pojav
- name: Repack JRE
run: export TARGET_VERSION=${{ matrix.version }} && bash "9_repackjre.sh" $GITHUB_WORKSPACE/pojav $GITHUB_WORKSPACE/pojav/jre${{ matrix.version }}-pojav
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: jre${{ matrix.version }}-pojav
path: pojav/jre${{ matrix.version }}-pojav/*