#!/bin/bash set -e rustup component add clippy cargo clippy if [[ "$TARGET" != "" ]]; then rustup target install $TARGET; fi if [[ "$TARGET" == "wasm32-"* && "$TARGET" != "wasm32-wasi" ]]; then cargo-web --version || cargo install cargo-web cargo web test $FLAGS --target=$TARGET --no-default-features cargo web test $FLAGS --target=$TARGET cargo web test $FLAGS --target=$TARGET --all-features elif [[ "$TARGET" == *"-linux-android"* ]]; then export PATH=/usr/local/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH pushd linux-android cargo build --target=$TARGET --no-default-features cargo build --target=$TARGET cargo build --target=$TARGET --all-features # Don't test, can't run android emulators successfully on travis currently popd elif [[ "$TARGET" == *"-apple-ios" || "$TARGET" == "wasm32-wasi" ]]; then cargo build --target=$TARGET $FLAGS --no-default-features cargo build --target=$TARGET $FLAGS cargo build --target=$TARGET $FLAGS --all-features # Don't test! iOS simulator setup/teardown is complicated and cargo-web # doesn't support wasm32-wasi yet, nor can wasm-pack test specify a target elif [[ "$TARGET" == *"-unknown-linux-gnueabihf" ]]; then #sudo apt-get update #sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf pushd generic-cross cargo build --target=$TARGET $FLAGS --no-default-features cargo build --target=$TARGET $FLAGS cargo build --target=$TARGET $FLAGS --all-features # Don't test popd elif [[ "$TARGET" != "" ]]; then pushd generic-cross cargo test --target=$TARGET $FLAGS --no-default-features cargo test --target=$TARGET $FLAGS cargo test --target=$TARGET $FLAGS --all-features popd else # Push nothing, target host CPU architecture cargo test $FLAGS --no-default-features cargo test $FLAGS cargo test $FLAGS --all-features fi