mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 04:48:26 +08:00
f5b63963be
Signed-off-by: Alexei Dodon <adodon@cisco.com>
41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
name: "zot minimal binary size"
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions: read-all
|
|
|
|
jobs:
|
|
zot-minimal-size:
|
|
runs-on: ubuntu-latest
|
|
name: compare-binary-size
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v4
|
|
with:
|
|
cache: false
|
|
go-version: 1.20.x
|
|
- 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"
|
|
mkdir -p zot_main
|
|
git clone https://github.com/project-zot/zot zot_main/
|
|
cd zot_main
|
|
make binary-minimal
|
|
BINSIZE_MAIN=$(stat -c%s "bin/zot-linux-amd64-minimal")
|
|
cd $GITHUB_WORKSPACE && rm -rf zot_main
|
|
|
|
[[ $BINSIZE -gt $BINSIZE_MAIN ]] || exit 0
|
|
echo "PR changes increased size of zot-minimal binary"
|
|
echo "PR binary size: $BINSIZE Bytes"
|
|
echo "main branch binary size: $BINSIZE_MAIN Bytes"
|
|
|
|
PERCENTACE=$(echo "scale=2; (($BINSIZE-$BINSIZE_MAIN)*100)/$BINSIZE_MAIN" | bc)
|
|
if ((`bc <<< "$PERCENTACE>=1.0"`)); then echo "zot minimal binary increased by $PERCENTACE% comparing with main"; exit 1; fi
|
|
|