mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-23 14:10:50 -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
99 lines
2.8 KiB
YAML
99 lines
2.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'src/**'
|
|
- 'pom.xml'
|
|
- '.github/workflows/ci.yml'
|
|
- '.github/scripts/**'
|
|
pull_request:
|
|
paths:
|
|
- 'src/**'
|
|
- 'pom.xml'
|
|
- '.github/workflows/ci.yml'
|
|
- '.github/scripts/**'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
name: Build and Test (JVM)
|
|
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
|
|
|
|
- name: Run unit tests
|
|
run: mvn test -B
|
|
|
|
native-linux-arm64:
|
|
name: Native image — 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 }}
|
|
|
|
- name: Build native binary
|
|
run: mvn clean package -Pnative -DskipTests -B
|
|
|
|
# Fails when the binary outgrows the budget, so size regressions show up in review instead
|
|
# of in a release. Set about 5% over the 40.8 MB this job built when the budget was
|
|
# introduced (GraalVM Community, -Os); raise it deliberately in the PR that needs the room.
|
|
- name: Binary size budget
|
|
env:
|
|
NATIVE_SIZE_BUDGET_MB: 43
|
|
run: |
|
|
bytes=$(stat -c %s target/floci)
|
|
mb=$(awk -v b="$bytes" 'BEGIN { printf "%.1f", b / 1048576 }')
|
|
echo "Native binary (linux/arm64): ${mb} MB, budget ${NATIVE_SIZE_BUDGET_MB} MB" | tee -a "$GITHUB_STEP_SUMMARY"
|
|
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
|
|
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
|