diff --git a/.github/scripts/release-binaries-plan.sh b/.github/scripts/release-binaries-plan.sh index 98079ab1ca..89d9c678f1 100755 --- a/.github/scripts/release-binaries-plan.sh +++ b/.github/scripts/release-binaries-plan.sh @@ -7,17 +7,17 @@ # # PLATFORMS is `missing` (the binaries the release does not have yet), `all`, `none` (no binaries: # a dispatch that only repairs the release's images), or a comma list of linux-amd64, linux-arm64, -# linux-arm64-baseline, darwin-amd64, windows-amd64. A named platform the release already carries is +# linux-arm64-baseline, darwin-arm64, darwin-amd64, windows-amd64. A named platform the release already carries is # refused unless REPLACE=true; `missing` and `none` never replace anything. # # Writes key=value lines to $GITHUB_OUTPUT (stdout when unset, so it doubles as a dry run): -# linux_amd64, linux_arm64, linux_arm64_baseline, darwin_amd64, windows_amd64 true|false +# linux_amd64, linux_arm64, linux_arm64_baseline, darwin_arm64, darwin_amd64, windows_amd64 true|false # standalone comma list of the selected macOS/Windows platforms, for standalone-binaries.yml # any true when at least one binary is selected # Exits non-zero, building nothing, when the request is invalid. set -euo pipefail -ALL=(linux-amd64 linux-arm64 linux-arm64-baseline darwin-amd64 windows-amd64) +ALL=(linux-amd64 linux-arm64 linux-arm64-baseline darwin-arm64 darwin-amd64 windows-amd64) OUT=${GITHUB_OUTPUT:-/dev/stdout} SUMMARY=${GITHUB_STEP_SUMMARY:-/dev/null} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c0ff70cf7..ca8c2f9f47 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ on: required: true type: string platforms: - description: missing, all, none, or a comma list of linux-amd64, linux-arm64, linux-arm64-baseline, darwin-amd64, windows-amd64 + description: missing, all, none, or a comma list of linux-amd64, linux-arm64, linux-arm64-baseline, darwin-arm64, darwin-amd64, windows-amd64 required: false type: string default: missing @@ -319,8 +319,6 @@ jobs: # The Linux release binaries are the native-amd64, native-arm64 and native-arm64-baseline # artifacts above, which also go into the images. macOS and Windows are built only for the # release assets, by standalone-binaries.yml, which can also be run by hand to try a change. - # darwin-arm64 is left out: it cannot build on a free runner, and Apple Silicon Macs run the - # darwin-amd64 binary under Rosetta 2 instead. standalone-binaries: name: Standalone binaries needs: plan @@ -399,6 +397,7 @@ jobs: [ "$LINUX_AMD64" = true ] && stage native-amd64 floci-aws-linux-amd64 [ "$LINUX_ARM64" = true ] && stage native-arm64 floci-aws-linux-arm64 [ "$LINUX_ARM64_BASELINE" = true ] && stage native-arm64-baseline floci-aws-linux-arm64-baseline + selected darwin-arm64 && optional binary-darwin-arm64 floci-aws-darwin-arm64 selected darwin-amd64 && optional binary-darwin-amd64 floci-aws-darwin-amd64 selected windows-amd64 && optional binary-windows-amd64 floci-aws-windows-amd64.exe compgen -G "dist/floci-aws-*" > /dev/null || { echo "::error::nothing was built to publish"; exit 1; } diff --git a/.github/workflows/standalone-binaries.yml b/.github/workflows/standalone-binaries.yml index 6f1de65259..d51d74f2c7 100644 --- a/.github/workflows/standalone-binaries.yml +++ b/.github/workflows/standalone-binaries.yml @@ -3,15 +3,18 @@ name: Standalone Binaries # Builds and smoke-tests the macOS and Windows floci-aws binaries. The Linux release binaries are # the native artifacts release.yml builds for the images. # -# Releases build darwin-amd64 and windows-amd64 only. darwin-arm64 cannot build on the free -# macos-latest runner (native-image analysis needs about 6.6 GB, the runner gives it 5.68 GB), so -# Apple Silicon Macs run the darwin-amd64 binary under Rosetta 2 until a larger runner is in place. +# darwin-arm64 needs a native-image heap of about 7 GB for analysis. The free macos-latest runner +# comes with either about 16 GB or about 8 GB of memory: the first builds it with a 9 GB heap in +# about 15 minutes, the second cannot (it swaps until native-image's watchdog aborts), so the job +# checks the memory first and, on a small runner, skips the build with a warning. publish-binaries +# then releases without the binary; backfill it later (see release.yml), or pass +# macos-runner: macos-latest-xlarge to avoid the lottery. # # release.yml calls this for every version tag, and publish-binaries there uploads what it built. # Run it by hand (Actions > Standalone Binaries > Run workflow) to try a branch, a runner or a # native-image setting without cutting a release: a manual run only uploads workflow artifacts, # it never writes to a GitHub Release. Examples: -# platforms: darwin-arm64 native-args: -Dquarkus.native.native-image-xmx=6g +# platforms: darwin-arm64 native-args: -Dquarkus.native.native-image-xmx=10g # platforms: darwin-arm64 macos-runner: macos-latest-xlarge # platforms: darwin-amd64 macos-amd64-runner: macos-latest (builds under Rosetta 2) # @@ -103,11 +106,25 @@ jobs: timeout-minutes: ${{ fromJSON(format('{0}', inputs.timeout-minutes || 0)) > 0 && fromJSON(format('{0}', inputs.timeout-minutes || 0)) || 60 }} steps: + - name: Check the runner's memory + id: memory + run: | + gib=$(( $(sysctl -n hw.memsize) / 1073741824 )) + echo "Runner memory: ${gib} GiB" + if [ "$gib" -lt 12 ]; then + echo "::warning::This runner has ${gib} GiB; the darwin-arm64 build needs a 16 GiB one, so it is skipped. Backfill the binary later." + echo "enough=false" >> "$GITHUB_OUTPUT" + else + echo "enough=true" >> "$GITHUB_OUTPUT" + fi + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + if: steps.memory.outputs.enough == 'true' with: ref: ${{ inputs.ref }} - uses: graalvm/setup-graalvm@60e76998d25690099182b796e99b8804da582d90 # v1 + if: steps.memory.outputs.enough == 'true' with: java-version: '25' distribution: 'graalvm-community' @@ -115,19 +132,27 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} - name: Build native executable + if: steps.memory.outputs.enough == 'true' env: NATIVE_ARGS: ${{ inputs.native-args }} - # NATIVE_ARGS splits on spaces into separate Maven arguments. + # -Ob and two threads keep analysis at 6.8 GB of the 9 GB heap and the peak RSS at 7.5 GB. + # NATIVE_ARGS comes last, so a manual run can override either setting, and splits on spaces + # into separate Maven arguments. run: | read -ra extra <<< "$NATIVE_ARGS" - mvn clean package -Dnative -DskipTests -B ${extra[@]+"${extra[@]}"} + mvn clean package -Dnative -DskipTests -B \ + -Dquarkus.native.native-image-xmx=9g \ + -Dquarkus.native.additional-build-args-append=-Ob,--parallelism=2 \ + ${extra[@]+"${extra[@]}"} - name: Smoke-test the standalone binary + if: steps.memory.outputs.enough == 'true' env: EXPECTED_VERSION: ${{ needs.prepare.outputs.version }} run: .github/scripts/smoke-binary.sh "$(ls target/*-runner)" "$EXPECTED_VERSION" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + if: steps.memory.outputs.enough == 'true' with: name: binary-darwin-arm64 path: target/*-runner diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index c0271c19da..c80586a3d8 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -64,7 +64,8 @@ their own runners and are not in any image. | Linux x86_64 | `floci-aws-linux-amd64` | | Linux arm64 | `floci-aws-linux-arm64` | | Linux arm64 without LSE (Raspberry Pi 4 and older) | `floci-aws-linux-arm64-baseline` | -| macOS (Apple Silicon and Intel) | `floci-aws-darwin-amd64` | +| macOS on Apple Silicon | `floci-aws-darwin-arm64` | +| macOS on Intel | `floci-aws-darwin-amd64` | | Windows x86_64 | `floci-aws-windows-amd64.exe` | ```bash @@ -98,8 +99,8 @@ gh attestation verify "$ASSET" --repo floci-io/floci - **Linux:** glibc 2.34 or newer (RHEL 9, Ubuntu 22.04, Debian 12, Amazon Linux 2023). Older distributions (RHEL 8, Amazon Linux 2) and musl-based ones such as Alpine cannot run it; use the image there. -- **macOS on Apple Silicon:** there is no arm64 build yet, so the x86_64 binary runs under Rosetta 2. - Install it once with `softwareupdate --install-rosetta --agree-to-license` if macOS has not already. +- **macOS on Apple Silicon:** if a release has no `floci-aws-darwin-arm64` yet, the x86_64 binary runs + under Rosetta 2. Install it once with `softwareupdate --install-rosetta --agree-to-license` if macOS has not already. - **macOS:** a binary downloaded with a browser is quarantined by Gatekeeper. Clear it once with `xattr -d com.apple.quarantine floci-aws`. Downloads made with `curl` are not quarantined. - **Docker is optional.** Without it every service that does not run containers works as usual. The