From d863037e60340e9765c13bf707092dd32f958a42 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Sun, 4 Nov 2018 21:34:05 +0100 Subject: Add CI --- ci/install.sh | 13 +++++++++++++ ci/script.sh | 24 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 ci/install.sh create mode 100644 ci/script.sh (limited to 'ci') diff --git a/ci/install.sh b/ci/install.sh new file mode 100644 index 0000000..42c96b4 --- /dev/null +++ b/ci/install.sh @@ -0,0 +1,13 @@ +set -euxo pipefail + +main() { + rustup component add rust-src + SYSROOT=$(rustc --print sysroot) + if [[ ! "$SYSROOT" =~ "$TARGET" ]]; then + rustup target add $TARGET + else + echo "Target $TARGET is already installed" + fi +} + +main diff --git a/ci/script.sh b/ci/script.sh new file mode 100644 index 0000000..9ad8677 --- /dev/null +++ b/ci/script.sh @@ -0,0 +1,24 @@ +set -exo pipefail + +main() { + 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 + export FEATURES="--features $FEATURES" + fi + + cargo check --target $TARGET $FEATURES + cargo build --target $TARGET --release $FEATURES + if [ -z $DISABLE_EXAMPLES ] && [[ $TARGET =~ .*linux.* ]]; then + cargo build --target $TARGET $FEATURES --examples + fi + + if [ -z $DISABLE_TESTS ] && [ $TRAVIS_RUST_VERSION = nightly ] && [[ $TARGET =~ .*linux.* ]]; then + cargo test --target $TARGET $FEATURES + fi +} + +main -- cgit v1.2.3-54-g00ecf