Skip to content

Commit

Permalink
Cleanup run tests CI script (yewstack#709)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry authored and llebout committed Jan 20, 2020
1 parent 968ee52 commit bcfb64d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 59 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ install:
script:
- ./ci/run_checks.sh
- CHROMEDRIVER=$(pwd)/chromedriver ./ci/run_tests.sh
- CHROMEDRIVER=$(pwd)/chromedriver ./ci/check_examples.sh
10 changes: 10 additions & 0 deletions ci/check_examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -euxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/

# Showcase includes all other examples
cd examples/showcase
# TODO Can't build some demos with release, need fix
cargo web build --target asmjs-unknown-emscripten
cargo web build --target wasm32-unknown-emscripten
# TODO showcase doesn't support wasm-bindgen yet
cargo web build --target wasm32-unknown-unknown
63 changes: 4 additions & 59 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,65 +1,10 @@
#!/usr/bin/env bash
set -euxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/

# 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"

echo "Testing for asmjs-unknown-emscripten..."
cargo web test --features web_test --target=asmjs-unknown-emscripten

echo "Testing for wasm32-unknown-emscripten..."
cargo web test --features web_test --target=wasm32-unknown-emscripten

echo "Testing for wasm32-unknown-unknown..."
cargo test --features wasm_test --target=wasm32-unknown-unknown

echo "Testing html macro..."
cargo web test --features web_test --target asmjs-unknown-emscripten
cargo web test --features web_test --target wasm32-unknown-emscripten
cargo test --features wasm_test --target wasm32-unknown-unknown
cargo test --test macro_test

echo "Testing derive props macro..."
cargo test --test derive_props_test

echo "Testing docs"
cargo doc_test

echo "Testing macro docs..."
(cd crates/macro && cargo doc_test)

check_example() {
echo "Checking example [$2]"
pushd $2 > /dev/null
cargo web build --target=$1
popd > /dev/null

# TODO Can't build some demos with release, need fix
# cargo web build --release $CARGO_WEB_ARGS
}

check_all_examples() {
echo "Checking examples on $1..."
for EXAMPLE in $(pwd)/examples/showcase/sub/*; do
if [ -d "$EXAMPLE" ]; then
check_example $1 $EXAMPLE
fi
done
}

# Check showcase only to speed up a building with CI
# Showcase includes all other examples
SHOWCASE=$(pwd)/examples/showcase
check_example asmjs-unknown-emscripten $SHOWCASE
check_example wasm32-unknown-emscripten $SHOWCASE
check_example wasm32-unknown-unknown $SHOWCASE

0 comments on commit bcfb64d

Please sign in to comment.