mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-12-01 17:33:04 -05:00
perf(native): build smaller binaries with -Os and enforce a size budget (#28)
This commit is contained in:
1 parent
ac57626481
commit
3c4118ff1a
4 files changed
+28
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user