Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ jobs:
fetch-depth: 1
- name: Build binaries
run: ./scripts/build.sh
- name: Print binaries size
run: ls -lh ./bin
- name: Check binary size
run: ./scripts/check-size.sh ./bin/*linux-x86_64

docker-tests:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ builds:
- goos: darwin
goarch: 386
ldflags:
- -s -w
- -X main.Version={{ .Version }}
- -X main.BuildDate={{ .Date }}
- -X main.GitBranch={{ .Branch }}
Expand Down
1 change: 1 addition & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export CGO_ENABLED=0
LDFLAGS=(
-s
-w
-extldflags
-static
Expand Down
26 changes: 26 additions & 0 deletions scripts/check-size.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#/bin/env bash

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

function usage() {
echo "Usage:"
echo " $SCRIPT_DIR [BINARY_FILE]"

echo ""
exit "$1";
}

if [[ $# -ne 1 ]]; then
usage
fi

BINARY_SIZE=$(stat -c %s $1)

echo "Binary size: $BINARY_SIZE"

if (( $BINARY_SIZE > 25000000 )); then
echo "Size is greater than limit"
exit 1
else
echo "Size is valid"
fi