storj/scripts/test-wasm-size.sh
Egon Elbre bc517cae2f go.mod: bump common
This brings in common/grant that doesn't depend on protobuf anymore.
This ends up causing the console wasm bundle from ~11MB to ~4.7MB.

Change-Id: I145dcb9239952a7a9e352c8793c111acb61ff0cc
2023-09-15 17:43:44 +00:00

20 lines
485 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=5000000
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)"