forked from yewstack/yew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci.sh
executable file
·58 lines (46 loc) · 1.37 KB
/
ci.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Originally this ci script borrowed from https://github.com/koute/stdweb
# because both use `cargo-web` tool to check the compilation.
set -euo pipefail
IFS=$'\n\t'
set +e
echo "$(rustc --version)" | grep -q "nightly"
if [ "$?" = "0" ]; then
export IS_NIGHTLY=1
else
export IS_NIGHTLY=0
fi
set -e
echo "Is Rust from nightly: $IS_NIGHTLY"
if [ "$IS_NIGHTLY" = "0" ]; then
if [ "$TARGET" = "wasm32-unknown-unknown" ]; then
echo "Skipping tests; wasm32-unknown-unknown is only supported on nightly"
exit 0
fi
fi
cargo install cargo-web -f
if [ "$TARGET" = "asmjs-unknown-emscripten" ]; then
rustup target add asmjs-unknown-emscripten
export CARGO_WEB_ARGS="--target-asmjs-emscripten"
fi
if [ "$TARGET" = "wasm32-unknown-emscripten" ]; then
rustup target add wasm32-unknown-emscripten
export CARGO_WEB_ARGS="--target-webasm-emscripten"
fi
if [ "$TARGET" = "wasm32-unknown-unknown" ]; then
rustup target add wasm32-unknown-unknown
export CARGO_WEB_ARGS="--target-webasm"
fi
cargo web test --nodejs $CARGO_WEB_ARGS
check_example() {
echo "Checking example [$1]"
cd $1
cargo web build $CARGO_WEB_ARGS
# TODO Can't build some demos with release, need fix
# cargo web build --release $CARGO_WEB_ARGS
}
for EXAMPLE in $(pwd)/examples/*; do
if [ -d "$EXAMPLE" ]; then
check_example $EXAMPLE
fi
done