File tree Expand file tree Collapse file tree 4 files changed +34
-0
lines changed
Expand file tree Collapse file tree 4 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 4646 fetch-depth : 1
4747 - name : Build binaries
4848 run : ./scripts/build.sh
49+ - name : Print binaries size
50+ run : ls -lh ./bin
51+ - name : Check binary size
52+ run : ./scripts/check-size.sh ./bin/*linux-x86_64
4953
5054 docker-tests :
5155 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ builds:
2222 - goos : darwin
2323 goarch : 386
2424 ldflags :
25+ - -s -w
2526 - -X main.Version={{ .Version }}
2627 - -X main.BuildDate={{ .Date }}
2728 - -X main.GitBranch={{ .Branch }}
Original file line number Diff line number Diff line change 22
33export CGO_ENABLED=0
44LDFLAGS=(
5+ -s
56 -w
67 -extldflags
78 -static
Original file line number Diff line number Diff line change 1+ # /bin/env bash
2+
3+ MAX_BINARY_SIZE=25000000
4+
5+ SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
6+
7+ function usage() {
8+ echo " Usage:"
9+ echo " $SCRIPT_DIR [BINARY_FILE]"
10+
11+ echo " "
12+ exit " $1 " ;
13+ }
14+
15+ if [[ $# -ne 1 ]]; then
16+ usage
17+ fi
18+
19+ BINARY_SIZE=$( stat -c %s $1 )
20+
21+ echo " Binary size: $BINARY_SIZE "
22+
23+ if (( $BINARY_SIZE > $MAX_BINARY_SIZE )) ; then
24+ echo " Size is greater than limit"
25+ exit 1
26+ else
27+ echo " Size is valid"
28+ fi
You can’t perform that action at this time.
0 commit comments