mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
375c35c5a1
* chore: update to go 1.22 Only go toolchain version is updated. We compile with go 1.22, but we allow others to compile using language version 1.21 if they wish to. If we also updated the go version in go.mod everyone would be forced to update, as that is enforced as a minimum allowed version. This comment explains the difference well enough https://news.ycombinator.com/item?id=36455759 Signed-off-by: Andrei Aaron <aaaron@luxoft.com> * chore: fix freeBSD AMD64 build Looks like they made some cleanup in the logic allowing buildmode pie on various platforms. Related to https://github.com/golang/go/issues/31544 See the code at: https://cs.opensource.google/go/go/+/master:src/internal/platform/supported.go;l=222-231;drc=d7fcb5cf80953f1d63246f1ae9defa60c5ce2d76;bpv=1;bpt=0 Signed-off-by: Andrei Aaron <aaaron@luxoft.com> --------- Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
95 lines
3.9 KiB
YAML
95 lines
3.9 KiB
YAML
name: "Check binary size increase"
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions: read-all
|
|
|
|
jobs:
|
|
compare-binary-sizes:
|
|
runs-on: ubuntu-latest
|
|
name: compare-with-main
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
cache: false
|
|
go-version: 1.22.x
|
|
- name: Checkout zot (main branch)
|
|
run: |
|
|
mkdir -p $GITHUB_WORKSPACE/zot_main
|
|
git clone https://github.com/project-zot/zot zot_main/
|
|
- name: Check if zot-minimal binary increased with more than 1%
|
|
run: |
|
|
echo "Building zot-minimal and check size"
|
|
cd $GITHUB_WORKSPACE
|
|
make binary-minimal
|
|
BINSIZE=$(stat -c%s "bin/zot-linux-amd64-minimal")
|
|
|
|
echo "Building zot-minimal on main branch and check size"
|
|
cd zot_main
|
|
make binary-minimal
|
|
BINSIZE_MAIN=$(stat -c%s "bin/zot-linux-amd64-minimal")
|
|
|
|
echo "PR binary size: $BINSIZE Bytes"
|
|
echo "main branch binary size: $BINSIZE_MAIN Bytes"
|
|
[[ $BINSIZE -eq $BINSIZE_MAIN ]] && echo "zot-minimal binary size is not affected by PR" && exit 0
|
|
|
|
if [[ $BINSIZE -gt $BINSIZE_MAIN ]]; then \
|
|
PERCENTAGE=$(printf '%.*f\n' 2 $(echo "scale=2; (($BINSIZE-$BINSIZE_MAIN)*100)/$BINSIZE_MAIN" | bc)); \
|
|
echo "zot minimal binary increased by $PERCENTAGE% comparing with main"; \
|
|
if ((`bc <<< "$PERCENTAGE>=1.0"`)); then exit 1; fi; \
|
|
else \
|
|
PERCENTAGE=$(printf '%.*f\n' 2 $(echo "scale=2; (($BINSIZE_MAIN-$BINSIZE)*100)/$BINSIZE_MAIN" | bc)); \
|
|
echo "zot minimal binary decreased by $PERCENTAGE% comparing with main"; \
|
|
fi
|
|
- if: always()
|
|
name: Check if zb binary increased with more than 1%
|
|
run: |
|
|
echo "Building zb and check size"
|
|
cd $GITHUB_WORKSPACE
|
|
make bench
|
|
BINSIZE=$(stat -c%s "bin/zb-linux-amd64")
|
|
|
|
echo "Building zb on main branch and check size"
|
|
cd zot_main
|
|
make bench
|
|
BINSIZE_MAIN=$(stat -c%s "bin/zb-linux-amd64")
|
|
|
|
echo "PR binary size: $BINSIZE Bytes"
|
|
echo "main branch binary size: $BINSIZE_MAIN Bytes"
|
|
[[ $BINSIZE -eq $BINSIZE_MAIN ]] && echo "zb binary size is not affected by PR" && exit 0
|
|
|
|
if [[ $BINSIZE -gt $BINSIZE_MAIN ]]; then \
|
|
PERCENTAGE=$(printf '%.*f\n' 2 $(echo "scale=2; (($BINSIZE-$BINSIZE_MAIN)*100)/$BINSIZE_MAIN" | bc)); \
|
|
echo "zb binary increased by $PERCENTAGE% comparing with main"; \
|
|
if ((`bc <<< "$PERCENTAGE>=1.0"`)); then exit 1; fi; \
|
|
else \
|
|
PERCENTAGE=$(printf '%.*f\n' 2 $(echo "scale=2; (($BINSIZE_MAIN-$BINSIZE)*100)/$BINSIZE_MAIN" | bc)); \
|
|
echo "zb binary decreased by $PERCENTAGE% comparing with main"; \
|
|
fi
|
|
- if: always()
|
|
name: Check if zli binary increased with more than 1%
|
|
run: |
|
|
echo "Building zli and check size"
|
|
cd $GITHUB_WORKSPACE
|
|
make cli
|
|
BINSIZE=$(stat -c%s "bin/zli-linux-amd64")
|
|
|
|
echo "Building zli on main branch and check size"
|
|
cd zot_main
|
|
make cli
|
|
BINSIZE_MAIN=$(stat -c%s "bin/zli-linux-amd64")
|
|
|
|
echo "PR binary size: $BINSIZE Bytes"
|
|
echo "main branch binary size: $BINSIZE_MAIN Bytes"
|
|
[[ $BINSIZE -eq $BINSIZE_MAIN ]] && echo "zli binary size is not affected by PR" && exit 0
|
|
|
|
if [[ $BINSIZE -gt $BINSIZE_MAIN ]]; then \
|
|
PERCENTAGE=$(printf '%.*f\n' 2 $(echo "scale=2; (($BINSIZE-$BINSIZE_MAIN)*100)/$BINSIZE_MAIN" | bc)); \
|
|
echo "zli binary increased by $PERCENTAGE% comparing with main"; \
|
|
if ((`bc <<< "$PERCENTAGE>=1.0"`)); then exit 1; fi; \
|
|
else \
|
|
PERCENTAGE=$(printf '%.*f\n' 2 $(echo "scale=2; (($BINSIZE_MAIN-$BINSIZE)*100)/$BINSIZE_MAIN" | bc)); \
|
|
echo "zli binary decreased by $PERCENTAGE% comparing with main"; \
|
|
fi
|