ds323x-rs/ci/script.sh

27 lines
733 B
Bash
Raw Normal View History

2018-10-28 09:31:28 +00:00
set -exo pipefail
main() {
2018-11-16 17:46:38 +00:00
export CARGO_OPTIONS="--target $TARGET"
2018-10-28 09:31:28 +00:00
if [[ ! $TARGET =~ .*linux.* ]]; then
sed -i "s/linux-embedded-hal/#linux-embedded-hal/g" Cargo.toml
sed -i "s/embedded-hal-mock/#embedded-hal-mock/g" Cargo.toml
fi
if [ ! -z $FEATURES ]; then
2018-11-16 17:46:38 +00:00
export CARGO_OPTIONS="$CARGO_OPTIONS --features $FEATURES"
2018-10-28 09:31:28 +00:00
fi
2018-11-16 17:46:38 +00:00
cargo check $CARGO_OPTIONS
cargo build $CARGO_OPTIONS
2018-10-28 09:31:28 +00:00
if [ -z $DISABLE_EXAMPLES ] && [[ $TARGET =~ .*linux.* ]]; then
2018-11-16 17:46:38 +00:00
cargo build $CARGO_OPTIONS --examples
2018-10-28 09:31:28 +00:00
fi
2018-11-16 17:46:38 +00:00
cargo doc $CARGO_OPTIONS
2018-10-28 09:31:28 +00:00
if [ -z $DISABLE_TESTS ] && [ $TRAVIS_RUST_VERSION = nightly ] && [[ $TARGET =~ .*linux.* ]]; then
2018-11-16 17:46:38 +00:00
cargo test $CARGO_OPTIONS
2018-10-28 09:31:28 +00:00
fi
}
main