storj/scripts/test-wasm-size.sh
Jessica Grebenschikov 1f1d9fce58 satellite/console/wasm: add test to confirm wasm size isnt growing
Change-Id: I975a9f8ac3f6b98cc213140fdd7a99557efe14c8
2021-01-21 15:48:49 +00:00

20 lines
486 B
Bash
Executable File

#!/usr/bin/env bash
set -ueo pipefail
set +x
cleanup(){
rm main.wasm
echo "cleaned up test successfully"
}
trap cleanup EXIT
cd satellite/console/wasm && pwd && GOOS=js GOARCH=wasm go build -o main.wasm .
BUILD_SIZE=$(stat -c %s main.wasm)
CURRENT_SIZE=10000000
if [ $BUILD_SIZE -gt $CURRENT_SIZE ]; then
echo "Wasm size is too big, was $CURRENT_SIZE but now it is $BUILD_SIZE"
exit 1
fi
echo "Wasm size did not increase and it is $BUILD_SIZE (limit: $CURRENT_SIZE)"