diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2f14090..5b69a0a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -54,6 +54,19 @@ jobs:
- 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 — version
run: ./target/floci version
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index a588268..ae0b945 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -170,6 +170,16 @@ jobs:
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:
diff --git a/AGENTS.md b/AGENTS.md
index 913c965..73a9c1d 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -137,6 +137,7 @@ Rules when touching this:
- **New Jackson DTOs** (anything `ObjectMapper` serializes/deserializes by field name) must be added to `src/main/resources/META-INF/native-image/io.floci/floci-cli/reflect-config.json`. Prefer passing `Map`/`JsonNode` to `printer.structured(...)` — those need no registration.
- **`@Command` classes** do not need manual reflect-config entries — `picocli-codegen` (the annotation processor in `pom.xml`) generates them automatically at compile time.
- **Do not remove** `--enable-url-protocols=http,https` from `native-image.properties`; `java.net.http.HttpClient` requires it.
+- The native profile builds with `-Os` (about 17% smaller with GraalVM Community, about 35% with Oracle GraalVM, for about 10 ms more startup). `ci.yml` fails the native job when the linux/arm64 binary exceeds `NATIVE_SIZE_BUDGET_MB`; raise the budget deliberately in the PR that needs the room, and say why.
---
diff --git a/pom.xml b/pom.xml
index 3279233..5a0424d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -157,6 +157,10 @@
--no-fallback
-H:+ReportExceptionStackTraces
-H:IncludeResources=.*\.properties
+
+ -Os