satellite/console/wasm: add test to confirm wasm size isnt growing
Change-Id: I975a9f8ac3f6b98cc213140fdd7a99557efe14c8
This commit is contained in:
parent
6c3b7a233e
commit
1f1d9fce58
@ -57,6 +57,7 @@ pipeline {
|
||||
sh 'golangci-lint --config /go/ci/.golangci.yml -j=2 run'
|
||||
sh 'check-mod-tidy -mod .build/go.mod.orig'
|
||||
sh 'make check-monitoring'
|
||||
sh 'make test-wasm-size'
|
||||
}
|
||||
}
|
||||
|
||||
|
5
Makefile
5
Makefile
@ -129,6 +129,11 @@ check-monitoring: ## Check for locked monkit calls that have changed
|
||||
|| (echo "Locked monkit metrics have been changed. Notify #data-science and run \`go run github.com/storj/ci/check-monitoring -out monkit.lock ./...\` to update monkit.lock file." \
|
||||
&& exit 1)
|
||||
|
||||
.PHONY: test-wasm-size
|
||||
test-wasm-size: ## Test that the built .wasm code has not increased in size
|
||||
@echo "Running ${@}"
|
||||
@./scripts/test-wasm-size.sh
|
||||
|
||||
##@ Build
|
||||
|
||||
.PHONY: storagenode-console
|
||||
|
19
scripts/test-wasm-size.sh
Executable file
19
scripts/test-wasm-size.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/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)"
|
Loading…
Reference in New Issue
Block a user