summaryrefslogtreecommitdiff
path: root/ci/run-travis.sh
blob: 5be6372e5135a5c2569c2fdae6ac36648c7d3f7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
#
# Entry point for all travis builds, this will set up the Travis environment by
# downloading any dependencies. It will then execute the `run.sh` script to
# build and execute all tests.
#
# Much of this script was liberally stolen from rust-lang/libc
#
# Key variables that may be set from Travis:
# - TRAVIS_RUST_VERSION: 1.1.0 ... stable/nightly/beta
# - TRAVIS_OS_NAME: linux/osx
# - DOCKER_IMAGE: posborne/rust-cross:arm
# - TARGET: e.g. arm-unknown-linux-gnueabihf

set -ex

BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

if [ "$TRAVIS_OS_NAME" = "linux" ]; then
  OS=unknown-linux-gnu
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
  OS=apple-darwin
else
  echo "Unexpected TRAVIS_OS_NAME: $TRAVIS_OS_NAME"
  exit 1
fi

export HOST=$ARCH-$OS
if [ "$TARGET" = "" ]; then
  TARGET=$HOST
fi

if [ "$DOCKER_IMAGE" = "" ]; then
  export RUST_TEST_THREADS=1
  curl -sSL "https://raw.githubusercontent.com/carllerche/travis-rust-matrix/master/test" | bash
else
  export RUST_VERSION=${TRAVIS_RUST_VERSION}
  export RUST_TARGET=${TARGET}
  export DOCKER_IMAGE=${DOCKER_IMAGE}
  ${BASE_DIR}/ci/run-docker.sh
fi