Skip to content

Commit b6db8e1

Browse files
committed
Check lib size in CI
1 parent 6e6e1f0 commit b6db8e1

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

ci/cloudbuild/vizzu-devenv-prebuild-docker.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,33 @@ steps:
5656
waitFor:
5757
- wasm_cmake
5858
timeout: 1800s
59+
- name: gcr.io/cloud-builders/gsutil
60+
args:
61+
- cp
62+
- 'gs://vizzu-lib-main/lib-size/size.txt'
63+
- '/workspace/build/cmake-wasm/weblib/size_downloaded.txt'
64+
id: download_size
65+
waitFor:
66+
- wasm_make
67+
- name: vizzu/vizzu-devenv:v0.8.x
68+
args:
69+
- bash
70+
- '-c'
71+
- |
72+
threshold=1.05
73+
while IFS= read -r line; do
74+
file=$(echo "$line" | cut -d ' ' -f 1)
75+
actual_size=$(echo "$line" | cut -d ' ' -f 2)
76+
downloaded_size=$(grep "$file" /workspace/build/cmake-wasm/weblib/size_downloaded.txt | cut -d ' ' -f 2)
77+
if [[ -n "$downloaded_size" && $(echo "$actual_size > $downloaded_size * $threshold" | bc -l) -eq 1 ]]; then
78+
echo "Error: File $file size exceeds the threshold."
79+
exit 1
80+
fi
81+
done < /workspace/build/cmake-wasm/weblib/size.txt
82+
id: check_size
83+
dir: /workspace/build/cmake-wasm
84+
waitFor:
85+
- download_size
5986
- name: vizzu/vizzu-devenv:v0.8.x
6087
args:
6188
- node
@@ -106,6 +133,7 @@ steps:
106133
- .
107134
id: test_integration
108135
waitFor:
136+
- check_size
109137
- test_jsUnit
110138
- test_desktopUnit
111139
- test_wasmUnit
@@ -141,6 +169,7 @@ steps:
141169
if [ $BRANCH_NAME == "main" ]
142170
then
143171
gsutil -m cp -r '/workspace/example/lib/*' 'gs://vizzu-lib-main/lib'
172+
gsutil -m cp '/workspace/build/cmake-wasm/weblib/size.txt' 'gs://vizzu-lib-main/lib-size/size.txt'
144173
fi
145174
id: lib_upload
146175
waitFor:

project/cmake/weblib/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ if(EMSCRIPTEN)
3838

3939
add_custom_command(TARGET cvizzu POST_BUILD
4040
COMMAND gzip -9 < "$<TARGET_FILE_DIR:cvizzu>/cvizzu.wasm" > "$<TARGET_FILE_DIR:cvizzu>/cvizzu.wasm.gz"
41-
COMMAND stat -c "%s : %n" "$<TARGET_FILE_DIR:cvizzu>/cvizzu.*")
41+
COMMAND stat -c "%s : %n" "$<TARGET_FILE_DIR:cvizzu>/cvizzu.*"
42+
COMMAND stat -c "%n %s" "$<TARGET_FILE_DIR:cvizzu>/cvizzu.*" > $<TARGET_FILE_DIR:cvizzu>/size.txt)
4243

4344

4445
endif()

0 commit comments

Comments
 (0)