mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-23 06:00:47 -05:00
* ci: run every release binary before publishing and build linux/amd64 natively in CI A shared smoke script runs each binary: version (checked against the tag in release.yml), --help for all four product trees, a profile list and the bad-profile exit code. Every release job runs it before uploading, so a binary that cannot start fails the release instead of shipping. CI gains a linux/amd64 native job next to linux/arm64. * ci: round-trip a profile in the smoke test and run CI when the script changes
208 lines
7.0 KiB
YAML
208 lines
7.0 KiB
YAML
name: Release
|
|
|
|
# Triggered when a SemVer tag (e.g. 0.1.0) is pushed.
|
|
# Builds native binaries for 5 platform targets, runs each one (.github/scripts/smoke.sh) and
|
|
# creates a GitHub Release. A binary that does not start fails its job before anything is published.
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '[0-9]+.[0-9]+.[0-9]+'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-linux-amd64:
|
|
name: Build — linux/amd64
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 45
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: graalvm/setup-graalvm@v1
|
|
with:
|
|
java-version: '25'
|
|
distribution: 'graalvm-community'
|
|
cache: maven
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- run: mvn clean package -Pnative -DskipTests -B
|
|
- run: mv target/floci target/floci-linux-amd64
|
|
- name: Smoke test
|
|
run: .github/scripts/smoke.sh target/floci-linux-amd64 "$GITHUB_REF_NAME"
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: floci-linux-amd64
|
|
path: target/floci-linux-amd64
|
|
|
|
build-linux-arm64:
|
|
name: Build — linux/arm64
|
|
runs-on: ubuntu-24.04-arm
|
|
timeout-minutes: 45
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: graalvm/setup-graalvm@v1
|
|
with:
|
|
java-version: '25'
|
|
distribution: 'graalvm-community'
|
|
cache: maven
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- run: mvn clean package -Pnative -DskipTests -B
|
|
- run: mv target/floci target/floci-linux-arm64
|
|
- name: Smoke test
|
|
run: .github/scripts/smoke.sh target/floci-linux-arm64 "$GITHUB_REF_NAME"
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: floci-linux-arm64
|
|
path: target/floci-linux-arm64
|
|
|
|
build-darwin-arm64:
|
|
name: Build — darwin/arm64
|
|
runs-on: macos-latest
|
|
timeout-minutes: 45
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: graalvm/setup-graalvm@v1
|
|
with:
|
|
java-version: '25'
|
|
distribution: 'graalvm-community'
|
|
cache: maven
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- run: mvn clean package -Pnative -DskipTests -B
|
|
- run: mv target/floci target/floci-darwin-arm64
|
|
- name: Smoke test
|
|
run: .github/scripts/smoke.sh target/floci-darwin-arm64 "$GITHUB_REF_NAME"
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: floci-darwin-arm64
|
|
path: target/floci-darwin-arm64
|
|
|
|
build-darwin-amd64:
|
|
name: Build — darwin/amd64 (Rosetta)
|
|
# GraalVM native-image cannot cross-compile architectures, and GitHub's Intel
|
|
# macOS runners (macos-13) queue for hours and are being deprecated — a past
|
|
# release sat 9.5h on macos-13 before being cancelled. Instead we run an
|
|
# x86_64 GraalVM under Rosetta 2 on the reliable Apple Silicon runner.
|
|
# setup-graalvm has no arch override, so the x86_64 JDK is installed manually.
|
|
runs-on: macos-latest
|
|
timeout-minutes: 45
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rosetta 2
|
|
run: sudo softwareupdate --install-rosetta --agree-to-license
|
|
|
|
- name: Install x86_64 GraalVM
|
|
run: |
|
|
curl -fsSL -o "$RUNNER_TEMP/graalvm-x64.tar.gz" \
|
|
https://download.oracle.com/graalvm/25/latest/graalvm-jdk-25_macos-x64_bin.tar.gz
|
|
mkdir -p "$RUNNER_TEMP/graalvm-x64"
|
|
tar -xzf "$RUNNER_TEMP/graalvm-x64.tar.gz" -C "$RUNNER_TEMP/graalvm-x64" --strip-components 1
|
|
echo "JAVA_HOME=$RUNNER_TEMP/graalvm-x64/Contents/Home" >> "$GITHUB_ENV"
|
|
echo "$RUNNER_TEMP/graalvm-x64/Contents/Home/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Verify x86_64 toolchain
|
|
run: arch -x86_64 "$JAVA_HOME/bin/java" -XshowSettings:properties -version 2>&1 | grep 'os.arch'
|
|
|
|
- name: Build native binary (x86_64 under Rosetta)
|
|
run: arch -x86_64 mvn clean package -Pnative -DskipTests -B
|
|
|
|
- name: Verify binary is x86_64
|
|
run: file target/floci | grep -q x86_64
|
|
|
|
- run: mv target/floci target/floci-darwin-amd64
|
|
- name: Smoke test
|
|
run: .github/scripts/smoke.sh target/floci-darwin-amd64 "$GITHUB_REF_NAME"
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: floci-darwin-amd64
|
|
path: target/floci-darwin-amd64
|
|
|
|
build-windows-amd64:
|
|
name: Build — windows/amd64
|
|
runs-on: windows-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: graalvm/setup-graalvm@v1
|
|
with:
|
|
java-version: '25'
|
|
distribution: 'graalvm-community'
|
|
cache: maven
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- run: mvn clean package -Pnative -DskipTests -B
|
|
- run: mv target/floci.exe target/floci-windows-amd64.exe
|
|
- name: Smoke test
|
|
shell: bash
|
|
run: .github/scripts/smoke.sh target/floci-windows-amd64.exe "$GITHUB_REF_NAME"
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: floci-windows-amd64
|
|
path: target/floci-windows-amd64.exe
|
|
|
|
build-jar:
|
|
name: Build — JVM jar
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '25'
|
|
distribution: 'temurin'
|
|
cache: maven
|
|
- run: mvn clean package -DskipTests -B
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: floci-jar
|
|
path: target/floci.jar
|
|
|
|
release:
|
|
name: Create GitHub Release
|
|
needs: [build-linux-amd64, build-linux-arm64, build-darwin-amd64, build-darwin-arm64, build-windows-amd64, build-jar]
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Extract version
|
|
id: version
|
|
run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: dist/
|
|
|
|
- name: Generate checksums
|
|
run: |
|
|
cd dist
|
|
find . -type f \( -name "floci-*" \) | sort | xargs sha256sum > sha256sums.txt
|
|
cat sha256sums.txt
|
|
|
|
- name: Report binary sizes
|
|
run: |
|
|
{
|
|
echo "| Asset | Size (MB) |"
|
|
echo "|---|---|"
|
|
find dist -type f -name "floci*" ! -name "*.txt" | sort | while read -r f; do
|
|
echo "| $(basename "$f") | $(awk -v b="$(stat -c %s "$f")" 'BEGIN { printf "%.1f", b / 1048576 }') |"
|
|
done
|
|
} | tee -a "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: "floci ${{ steps.version.outputs.version }}"
|
|
files: |
|
|
dist/floci-linux-amd64/floci-linux-amd64
|
|
dist/floci-linux-arm64/floci-linux-arm64
|
|
dist/floci-darwin-amd64/floci-darwin-amd64
|
|
dist/floci-darwin-arm64/floci-darwin-arm64
|
|
dist/floci-windows-amd64/floci-windows-amd64.exe
|
|
dist/floci-jar/floci.jar
|
|
dist/sha256sums.txt
|
|
|