diff options
-rw-r--r-- | .travis.yml | 17 | ||||
-rw-r--r-- | ci/docker/thumbv6m-none-eabi/Dockerfile | 9 | ||||
-rw-r--r-- | ci/docker/thumbv7em-none-eabi/Dockerfile | 9 | ||||
-rw-r--r-- | ci/docker/thumbv7em-none-eabihf/Dockerfile | 9 | ||||
-rw-r--r-- | ci/docker/thumbv7m-none-eabi/Dockerfile | 9 | ||||
-rw-r--r-- | ci/docker/x86_64-unknown-linux-gnu/Dockerfile | 5 | ||||
-rwxr-xr-x | ci/run-docker.sh | 35 | ||||
-rwxr-xr-x | ci/run.sh | 12 | ||||
-rw-r--r-- | ci/script.sh | 14 |
9 files changed, 24 insertions, 95 deletions
diff --git a/.travis.yml b/.travis.yml index 3d9953d..462a063 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -cache: cargo dist: trusty language: rust rust: nightly @@ -16,20 +15,24 @@ env: TARGET=x86_64-unknown-linux-gnu install: # NOTE(TRAVIS_BRANCH) Travis is configured to only build *pushes* (not PRs). - if [ $TRAVIS_BRANCH != master ] || [ $TRAVIS_EVENT_TYPE = cron ]; then - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TRAVIS_RUST_VERSION; + curl https://sh.rustup.rs -sSf | + sh -s -- -y --default-toolchain $TRAVIS_RUST_VERSION; + source ~/.cargo/env; - rustup component add rust-src; + + cargo install --git https://github.com/japaric/cross -f; fi script: # NOTE(TRAVIS_BRANCH) See the NOTE in the `install` section - # chmod: Travis can't cache files that are not readable by "others" - if [ $TRAVIS_BRANCH != master ] || [ $TRAVIS_EVENT_TYPE = cron ]; then - cargo generate-lockfile; - sh ci/run-docker.sh $TARGET; - chmod -R a+r $HOME/.cargo; + sh ci/script.sh fi +cache: cargo +before_cache: + - chmod -R a+r $HOME/.cargo; + branches: only: - auto diff --git a/ci/docker/thumbv6m-none-eabi/Dockerfile b/ci/docker/thumbv6m-none-eabi/Dockerfile deleted file mode 100644 index ee82ee6..0000000 --- a/ci/docker/thumbv6m-none-eabi/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ubuntu:16.04 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - libcurl4-openssl-dev \ - libssh2-1 -RUN curl -LSfs https://japaric.github.io/trust/install.sh | \ - sh -s -- --git japaric/xargo --tag v0.2.1 --target x86_64-unknown-linux-gnu --to /usr/bin diff --git a/ci/docker/thumbv7em-none-eabi/Dockerfile b/ci/docker/thumbv7em-none-eabi/Dockerfile deleted file mode 100644 index ee82ee6..0000000 --- a/ci/docker/thumbv7em-none-eabi/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ubuntu:16.04 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - libcurl4-openssl-dev \ - libssh2-1 -RUN curl -LSfs https://japaric.github.io/trust/install.sh | \ - sh -s -- --git japaric/xargo --tag v0.2.1 --target x86_64-unknown-linux-gnu --to /usr/bin diff --git a/ci/docker/thumbv7em-none-eabihf/Dockerfile b/ci/docker/thumbv7em-none-eabihf/Dockerfile deleted file mode 100644 index ee82ee6..0000000 --- a/ci/docker/thumbv7em-none-eabihf/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ubuntu:16.04 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - libcurl4-openssl-dev \ - libssh2-1 -RUN curl -LSfs https://japaric.github.io/trust/install.sh | \ - sh -s -- --git japaric/xargo --tag v0.2.1 --target x86_64-unknown-linux-gnu --to /usr/bin diff --git a/ci/docker/thumbv7m-none-eabi/Dockerfile b/ci/docker/thumbv7m-none-eabi/Dockerfile deleted file mode 100644 index ee82ee6..0000000 --- a/ci/docker/thumbv7m-none-eabi/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ubuntu:16.04 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - libcurl4-openssl-dev \ - libssh2-1 -RUN curl -LSfs https://japaric.github.io/trust/install.sh | \ - sh -s -- --git japaric/xargo --tag v0.2.1 --target x86_64-unknown-linux-gnu --to /usr/bin diff --git a/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/ci/docker/x86_64-unknown-linux-gnu/Dockerfile deleted file mode 100644 index dbbecfa..0000000 --- a/ci/docker/x86_64-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ubuntu:16.04 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - ca-certificates gcc libc6-dev -ENV PATH=$PATH:/rust/bin diff --git a/ci/run-docker.sh b/ci/run-docker.sh deleted file mode 100755 index 5a4762d..0000000 --- a/ci/run-docker.sh +++ /dev/null @@ -1,35 +0,0 @@ -set -ex - -run() { - local target=$1 - - echo $target - - # This directory needs to exist before calling docker, otherwise docker will create it but it - # will be owned by root - mkdir -p target - - docker build -t $target ci/docker/$target - docker run \ - --rm \ - --user $(id -u):$(id -g) \ - -e CARGO_HOME=/cargo \ - -e CARGO_TARGET_DIR=/target \ - -e HOME=/tmp \ - -v $HOME/.cargo:/cargo \ - -v `pwd`/target:/target \ - -v `pwd`:/checkout:ro \ - -v `rustc --print sysroot`:/rust:ro \ - -w /checkout \ - -it $target \ - sh -c "PATH=\$PATH:/rust/bin ci/run.sh $target" -} - - -if [ -z "$1" ]; then - for d in `ls ci/docker/`; do - run $d - done -else - run $1 -fi diff --git a/ci/run.sh b/ci/run.sh deleted file mode 100755 index fdd3fd2..0000000 --- a/ci/run.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -ex - -case $1 in - thumbv*) - xargo build --target $1 - ;; - *) - cargo test --target $1 - ;; -esac diff --git a/ci/script.sh b/ci/script.sh new file mode 100644 index 0000000..b27ef85 --- /dev/null +++ b/ci/script.sh @@ -0,0 +1,14 @@ +set -ex + +main() { + case $TARGET in + thumbv*-none-eabi*) + cross build --target $TARGET + ;; + *) + cross test --target $TARGET + ;; + esac +} + +main |