mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-12-05 19:18:01 -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.
This commit is contained in:
3 files changed
+75
-3
No files matched your search
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# Runs a freshly built floci binary through the paths a native image can get wrong while the JVM
|
||||
# build stays green: startup, every product tree's command wiring, a Jackson read, and the
|
||||
# parameter-error path. No emulator or Docker daemon is needed.
|
||||
#
|
||||
# .github/scripts/smoke.sh <binary> [expected-version]
|
||||
set -euo pipefail
|
||||
|
||||
bin="$1"
|
||||
expected="${2:-}"
|
||||
|
||||
"$bin" version
|
||||
|
||||
if [ -n "$expected" ]; then
|
||||
reported=$("$bin" version -o json | tr -d ' \r\n')
|
||||
case "$reported" in
|
||||
*"\"cli\":\"$expected\""*) ;;
|
||||
*) echo "::error::$bin reports $reported, expected cli version $expected"; exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for tree in aws gcp az oci; do
|
||||
"$bin" "$tree" --help > /dev/null
|
||||
done
|
||||
|
||||
"$bin" config profile list -o json > /dev/null
|
||||
|
||||
# An unknown profile is a usage error: exit 2, not a crash.
|
||||
set +e
|
||||
"$bin" start --profile floci-smoke-no-such-profile > /dev/null 2>&1
|
||||
code=$?
|
||||
set -e
|
||||
if [ "$code" -ne 2 ]; then
|
||||
echo "::error::'start --profile <missing>' exited $code, expected 2"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "smoke test passed: $bin"
|
||||
@@ -67,8 +67,30 @@ jobs:
|
||||
awk -v b="$bytes" -v max="$NATIVE_SIZE_BUDGET_MB" 'BEGIN { exit (b / 1048576 > max) }' \
|
||||
|| { echo "::error::Native binary is ${mb} MB, over the ${NATIVE_SIZE_BUDGET_MB} MB budget."; exit 1; }
|
||||
|
||||
- name: Smoke test — version
|
||||
run: ./target/floci version
|
||||
- name: Smoke test
|
||||
run: .github/scripts/smoke.sh ./target/floci
|
||||
|
||||
- name: Smoke test — doctor
|
||||
run: ./target/floci doctor || true
|
||||
|
||||
# The release builds linux/amd64 too; building it here catches an amd64-only native failure in
|
||||
# review instead of at release time.
|
||||
native-linux-amd64:
|
||||
name: Native image (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 }}
|
||||
|
||||
- name: Build native binary
|
||||
run: mvn clean package -Pnative -DskipTests -B
|
||||
|
||||
- name: Smoke test
|
||||
run: .github/scripts/smoke.sh ./target/floci
|
||||
@@ -1,7 +1,8 @@
|
||||
name: Release
|
||||
|
||||
# Triggered when a SemVer tag (e.g. 0.1.0) is pushed.
|
||||
# Builds native binaries for 4 platform targets and creates a GitHub Release.
|
||||
# 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:
|
||||
@@ -30,6 +31,8 @@ jobs:
|
||||
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
|
||||
@@ -49,6 +52,8 @@ jobs:
|
||||
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
|
||||
@@ -68,6 +73,8 @@ jobs:
|
||||
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
|
||||
@@ -107,6 +114,8 @@ jobs:
|
||||
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
|
||||
@@ -126,6 +135,9 @@ jobs:
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user