From 112dca300c2e4a15c99b8d92963c370d0ac0c693 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Fri, 8 Dec 2017 08:21:15 -0800 Subject: Support building and testing multiple targets at once Specifying multiple targets can be done by setting the environment variable to a semi-colon delimited list of targets. --- .travis.yml | 2 +- ci/install.sh | 38 +++++++++++++++++++++----------------- ci/script.sh | 22 +++++++++++++--------- 3 files changed, 35 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1553ce4f..69c2cde0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -100,7 +100,7 @@ matrix: before_install: set -e install: - - sh ci/install.sh + - bash ci/install.sh - source ~/.cargo/env || true script: diff --git a/ci/install.sh b/ci/install.sh index 80e18e47..5997c7cb 100644 --- a/ci/install.sh +++ b/ci/install.sh @@ -1,3 +1,4 @@ +#!/bin/bash set -ex main() { @@ -12,23 +13,26 @@ main() { # Builds for iOS are done on OSX, but require the specific target to be # installed. - case $TARGET in - aarch64-apple-ios) - rustup target install aarch64-apple-ios - ;; - armv7-apple-ios) - rustup target install armv7-apple-ios - ;; - armv7s-apple-ios) - rustup target install armv7s-apple-ios - ;; - i386-apple-ios) - rustup target install i386-apple-ios - ;; - x86_64-apple-ios) - rustup target install x86_64-apple-ios - ;; - esac + IFS=';' read -ra TARGET_ARRAY <<< "$TARGET" + for t in "${TARGET_ARRAY[@]}"; do + case $t in + aarch64-apple-ios) + rustup target install aarch64-apple-ios + ;; + armv7-apple-ios) + rustup target install armv7-apple-ios + ;; + armv7s-apple-ios) + rustup target install armv7s-apple-ios + ;; + i386-apple-ios) + rustup target install i386-apple-ios + ;; + x86_64-apple-ios) + rustup target install x86_64-apple-ios + ;; + esac + done # This fetches latest stable release local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \ diff --git a/ci/script.sh b/ci/script.sh index df61c35a..e1d1ab7e 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -1,3 +1,4 @@ +#!/bin/bash # This script takes care of testing your crate set -ex @@ -8,17 +9,20 @@ main() { export RUSTFLAGS=--cfg=travis fi - # Build debug and release targets - cross build --target $TARGET - cross build --target $TARGET --release + IFS=';' read -ra TARGET_ARRAY <<< "$TARGET" + for t in "${TARGET_ARRAY[@]}"; do + # Build debug and release targets + cross build --target $t + cross build --target $t --release - if [ ! -z $DISABLE_TESTS ]; then - return - fi + if [ ! -z $DISABLE_TESTS ]; then + continue + fi - # Run tests on debug and release targets. - cross test --target $TARGET - cross test --target $TARGET --release + # Run tests on debug and release targets. + cross test --target $t + cross test --target $t --release + done } # we don't run the "test phase" when doing deploys -- cgit v1.2.3