cache Cargo artifacts

notable changes in the docker-based testing infrastructure

- the docker containers can now modify $CARGO_HOME, to re-use the outer
  Cargo registry, and the target directory to re-use build artifacts.

- the docker containers are removed when their execution finishes
  because it's no longer necessary to re-start them to inspect them
  because all the interesting output is in the outer target directory
This commit is contained in:
Jorge Aparicio 2016-09-30 17:21:54 -05:00
parent cab88e6133
commit 43e019dfc4
19 changed files with 30 additions and 32 deletions

View File

@ -1,3 +1,4 @@
cache: cargo
dist: trusty dist: trusty
language: rust language: rust
services: docker services: docker
@ -45,14 +46,16 @@ install:
script: script:
- cargo generate-lockfile - cargo generate-lockfile
- if [[ $TRAVIS_OS_NAME = "linux" ]]; then - if [[ $TRAVIS_OS_NAME = "linux" ]]; then
sudo apt-get remove -y qemu-user-static &&
sudo apt-get install -y qemu-user-static &&
sh ci/run-docker.sh $TARGET; sh ci/run-docker.sh $TARGET;
else else
cargo test --target $TARGET && cargo test --target $TARGET &&
cargo test --target $TARGET --release; cargo test --target $TARGET --release;
fi fi
after_success:
# Travis can't cache files that are not readable by "others"
- chmod -R a+r /home/travis/.cargo
branches: branches:
only: only:
- auto - auto

View File

@ -5,6 +5,5 @@ RUN apt-get install -y --no-install-recommends \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross \ gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
qemu-user-static qemu-user-static
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/aarch64-linux-gnu \ QEMU_LD_PREFIX=/usr/aarch64-linux-gnu \
RUST_TEST_THREADS=1 RUST_TEST_THREADS=1

View File

@ -4,7 +4,6 @@ RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \ gcc libc6-dev ca-certificates \
gcc-arm-linux-gnueabi libc6-dev-armel-cross qemu-user-static gcc-arm-linux-gnueabi libc6-dev-armel-cross qemu-user-static
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabi-gcc \ ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabi-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/arm-linux-gnueabi \ QEMU_LD_PREFIX=/usr/arm-linux-gnueabi \
RUST_TEST_THREADS=1 RUST_TEST_THREADS=1

View File

@ -4,6 +4,5 @@ RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \ gcc libc6-dev ca-certificates \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \ ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \ QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \
RUST_TEST_THREADS=1 RUST_TEST_THREADS=1

View File

@ -4,6 +4,5 @@ RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \ gcc libc6-dev ca-certificates \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \ ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \ QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \
RUST_TEST_THREADS=1 RUST_TEST_THREADS=1

View File

@ -2,4 +2,3 @@ FROM ubuntu:16.04
RUN apt-get update RUN apt-get update
RUN apt-get install -y --no-install-recommends \ RUN apt-get install -y --no-install-recommends \
gcc-multilib libc6-dev ca-certificates gcc-multilib libc6-dev ca-certificates
ENV PATH=$PATH:/rust/bin

View File

@ -2,4 +2,3 @@ FROM ubuntu:16.04
RUN apt-get update RUN apt-get update
RUN apt-get install -y --no-install-recommends \ RUN apt-get install -y --no-install-recommends \
gcc-multilib libc6-dev ca-certificates gcc-multilib libc6-dev ca-certificates
ENV PATH=$PATH:/rust/bin

View File

@ -7,6 +7,5 @@ RUN apt-get install -y --no-install-recommends \
binfmt-support qemu-user-static qemu-system-mips binfmt-support qemu-user-static qemu-system-mips
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \ ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/mips-linux-gnu \ QEMU_LD_PREFIX=/usr/mips-linux-gnu \
RUST_TEST_THREADS=1 RUST_TEST_THREADS=1

View File

@ -7,6 +7,5 @@ RUN apt-get install -y --no-install-recommends \
binfmt-support qemu-user-static binfmt-support qemu-user-static
ENV CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER=mipsel-linux-gnu-gcc \ ENV CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER=mipsel-linux-gnu-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/mipsel-linux-gnu \ QEMU_LD_PREFIX=/usr/mipsel-linux-gnu \
RUST_TEST_THREADS=1 RUST_TEST_THREADS=1

View File

@ -7,6 +7,5 @@ RUN apt-get install -y --no-install-recommends \
qemu-system-ppc qemu-system-ppc
ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \ ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/powerpc-linux-gnu \ QEMU_LD_PREFIX=/usr/powerpc-linux-gnu \
RUST_TEST_THREADS=1 RUST_TEST_THREADS=1

View File

@ -8,6 +8,5 @@ RUN apt-get install -y --no-install-recommends \
ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \ ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \
CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc \ CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/powerpc64-linux-gnu \ QEMU_LD_PREFIX=/usr/powerpc64-linux-gnu \
RUST_TEST_THREADS=1 RUST_TEST_THREADS=1

View File

@ -7,7 +7,5 @@ RUN apt-get install -y --no-install-recommends \
qemu-system-ppc qemu-system-ppc
ENV CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc \ ENV CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc \
CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu \ QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu \
RUST_TEST_THREADS=1 RUST_TEST_THREADS=1

View File

@ -5,4 +5,3 @@ RUN apt-get install -y --no-install-recommends \
ENV AR_thumbv6m_none_eabi=arm-none-eabi-ar \ ENV AR_thumbv6m_none_eabi=arm-none-eabi-ar \
CARGO_TARGET_THUMBV6M_NONE_EABI_LINKER=arm-none-eabi-gcc \ CARGO_TARGET_THUMBV6M_NONE_EABI_LINKER=arm-none-eabi-gcc \
CC_thumbv6m_none_eabi=arm-none-eabi-gcc \ CC_thumbv6m_none_eabi=arm-none-eabi-gcc \
PATH=$PATH:/rust/bin

View File

@ -5,4 +5,3 @@ RUN apt-get install -y --no-install-recommends \
ENV AR_thumbv7em_none_eabi=arm-none-eabi-ar \ ENV AR_thumbv7em_none_eabi=arm-none-eabi-ar \
CARGO_TARGET_THUMBV7EM_NONE_EABI_LINKER=arm-none-eabi-gcc \ CARGO_TARGET_THUMBV7EM_NONE_EABI_LINKER=arm-none-eabi-gcc \
CC_thumbv7em_none_eabi=arm-none-eabi-gcc \ CC_thumbv7em_none_eabi=arm-none-eabi-gcc \
PATH=$PATH:/rust/bin

View File

@ -5,4 +5,3 @@ RUN apt-get install -y --no-install-recommends \
ENV AR_thumbv7em_none_eabihf=arm-none-eabi-ar \ ENV AR_thumbv7em_none_eabihf=arm-none-eabi-ar \
CARGO_TARGET_THUMBV7EM_NONE_EABIHF_LINKER=arm-none-eabi-gcc \ CARGO_TARGET_THUMBV7EM_NONE_EABIHF_LINKER=arm-none-eabi-gcc \
CC_thumbv7em_none_eabihf=arm-none-eabi-gcc \ CC_thumbv7em_none_eabihf=arm-none-eabi-gcc \
PATH=$PATH:/rust/bin

View File

@ -5,4 +5,3 @@ RUN apt-get install -y --no-install-recommends \
ENV AR_thumbv7m_none_eabi=arm-none-eabi-ar \ ENV AR_thumbv7m_none_eabi=arm-none-eabi-ar \
CARGO_TARGET_THUMBV7M_NONE_EABI_LINKER=arm-none-eabi-gcc \ CARGO_TARGET_THUMBV7M_NONE_EABI_LINKER=arm-none-eabi-gcc \
CC_thumbv7m_none_eabi=arm-none-eabi-gcc \ CC_thumbv7m_none_eabi=arm-none-eabi-gcc \
PATH=$PATH:/rust/bin

View File

@ -2,5 +2,3 @@ FROM ubuntu:16.04
RUN apt-get update RUN apt-get update
RUN apt-get install -y --no-install-recommends \ RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates gcc libc6-dev ca-certificates
ENV PATH=$PATH:/rust/bin

View File

@ -4,16 +4,30 @@
set -ex set -ex
run() { run() {
echo $1 local gid=$(id -g) \
docker build -t $1 ci/docker/$1 group=$(id -g -n) \
target=$1 \
uid=$(id -u) \
user=$(id -u -n)
echo $target
docker build -t $target ci/docker/$target
docker run \ docker run \
-v `rustc --print sysroot`:/rust:ro \ --rm \
-v `pwd`:/checkout:ro \ -e CARGO_HOME=/cargo \
-e CARGO_TARGET_DIR=/tmp/target \ -e CARGO_TARGET_DIR=/target \
-w /checkout \ -v $HOME/.cargo:/cargo \
--privileged \ -v `pwd`/target:/target \
-it $1 \ -v `pwd`:/checkout:ro \
sh ci/run.sh $1 -v `rustc --print sysroot`:/rust:ro \
-w /checkout \
-it $target \
sh -c "
groupadd -g $gid $group
useradd -m -g $gid -u $uid $user
chown $user /cargo /target
su -c 'PATH=\$PATH:/rust/bin ci/run.sh $target' $user
"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

5
ci/run.sh Normal file → Executable file
View File

@ -44,10 +44,9 @@ esac
case $TRAVIS_OS_NAME in case $TRAVIS_OS_NAME in
osx) osx)
NM=gnm
# NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent. # NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
# Use GNU nm instead # Use GNU nm instead
NM=gnm
brew install binutils brew install binutils
;; ;;
*) *)
@ -56,7 +55,7 @@ case $TRAVIS_OS_NAME in
esac esac
# NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it # NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it
$PREFIX$NM -g --defined-only /tmp/target/${1}/debug/librustc_builtins.rlib | \ $PREFIX$NM -g --defined-only /target/${1}/debug/librustc_builtins.rlib | \
sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __' sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __'
if test $? = 0; then if test $? = 0; then