Skip to content

cache Cargo artifacts #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cache: cargo
dist: trusty
language: rust
services: docker
Expand Down Expand Up @@ -45,13 +46,13 @@ install:
script:
- cargo generate-lockfile
- 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mysterious

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was never needed AFAIK

else
cargo test --target $TARGET &&
cargo test --target $TARGET --release;
fi
# Travis can't cache files that are not readable by "others"
- chmod -R a+r $HOME/.cargo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in case we ever add a dependency that brings a file that doesn't have the o+r bit set. FWIW, I originally found this problem with the bitflags crate; its .gitignore was rwx------ iirc.


branches:
only:
Expand Down
1 change: 0 additions & 1 deletion ci/docker/aarch64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ RUN apt-get install -y --no-install-recommends \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
qemu-user-static
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/aarch64-linux-gnu \
RUST_TEST_THREADS=1
1 change: 0 additions & 1 deletion ci/docker/arm-unknown-linux-gnueabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
gcc-arm-linux-gnueabi libc6-dev-armel-cross qemu-user-static
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabi-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/arm-linux-gnueabi \
RUST_TEST_THREADS=1

1 change: 0 additions & 1 deletion ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \
RUST_TEST_THREADS=1
1 change: 0 additions & 1 deletion ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \
RUST_TEST_THREADS=1
1 change: 0 additions & 1 deletion ci/docker/i586-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc-multilib libc6-dev ca-certificates
ENV PATH=$PATH:/rust/bin
1 change: 0 additions & 1 deletion ci/docker/i686-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc-multilib libc6-dev ca-certificates
ENV PATH=$PATH:/rust/bin
1 change: 0 additions & 1 deletion ci/docker/mips-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ RUN apt-get install -y --no-install-recommends \
binfmt-support qemu-user-static qemu-system-mips

ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/mips-linux-gnu \
RUST_TEST_THREADS=1
1 change: 0 additions & 1 deletion ci/docker/mipsel-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ RUN apt-get install -y --no-install-recommends \
binfmt-support qemu-user-static

ENV CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER=mipsel-linux-gnu-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/mipsel-linux-gnu \
RUST_TEST_THREADS=1
1 change: 0 additions & 1 deletion ci/docker/powerpc-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ RUN apt-get install -y --no-install-recommends \
qemu-system-ppc

ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/powerpc-linux-gnu \
RUST_TEST_THREADS=1
1 change: 0 additions & 1 deletion ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ RUN apt-get install -y --no-install-recommends \

ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \
CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc \
PATH=$PATH:/rust/bin \
QEMU_LD_PREFIX=/usr/powerpc64-linux-gnu \
RUST_TEST_THREADS=1
2 changes: 0 additions & 2 deletions ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ RUN apt-get install -y --no-install-recommends \
qemu-system-ppc

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 \
RUST_TEST_THREADS=1
1 change: 0 additions & 1 deletion ci/docker/thumbv6m-none-eabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ RUN apt-get install -y --no-install-recommends \
ENV AR_thumbv6m_none_eabi=arm-none-eabi-ar \
CARGO_TARGET_THUMBV6M_NONE_EABI_LINKER=arm-none-eabi-gcc \
CC_thumbv6m_none_eabi=arm-none-eabi-gcc \
PATH=$PATH:/rust/bin
1 change: 0 additions & 1 deletion ci/docker/thumbv7em-none-eabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ RUN apt-get install -y --no-install-recommends \
ENV AR_thumbv7em_none_eabi=arm-none-eabi-ar \
CARGO_TARGET_THUMBV7EM_NONE_EABI_LINKER=arm-none-eabi-gcc \
CC_thumbv7em_none_eabi=arm-none-eabi-gcc \
PATH=$PATH:/rust/bin
1 change: 0 additions & 1 deletion ci/docker/thumbv7em-none-eabihf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ RUN apt-get install -y --no-install-recommends \
ENV AR_thumbv7em_none_eabihf=arm-none-eabi-ar \
CARGO_TARGET_THUMBV7EM_NONE_EABIHF_LINKER=arm-none-eabi-gcc \
CC_thumbv7em_none_eabihf=arm-none-eabi-gcc \
PATH=$PATH:/rust/bin
1 change: 0 additions & 1 deletion ci/docker/thumbv7m-none-eabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ RUN apt-get install -y --no-install-recommends \
ENV AR_thumbv7m_none_eabi=arm-none-eabi-ar \
CARGO_TARGET_THUMBV7M_NONE_EABI_LINKER=arm-none-eabi-gcc \
CC_thumbv7m_none_eabi=arm-none-eabi-gcc \
PATH=$PATH:/rust/bin
2 changes: 0 additions & 2 deletions ci/docker/x86_64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates
ENV PATH=$PATH:/rust/bin

29 changes: 20 additions & 9 deletions ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,27 @@
set -ex

run() {
echo $1
docker build -t $1 ci/docker/$1
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 \
-v `rustc --print sysroot`:/rust:ro \
-v `pwd`:/checkout:ro \
-e CARGO_TARGET_DIR=/tmp/target \
-w /checkout \
--privileged \
-it $1 \
sh ci/run.sh $1
--rm \
--user $(id -u):$(id -g) \
-e CARGO_HOME=/cargo \
-e CARGO_TARGET_DIR=/target \
-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"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks funny. Is there a way to extend PATH using the -e flag?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, maybe:

-e PATH=\$PATH:/rust/bin

I'm not sure if that works but if it doesn't my assumption would be no :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This results in PATH='$PATH:/rust/bin' with a literal $PATH in there 😆.

}

if [ -z "$1" ]; then
Expand Down
5 changes: 2 additions & 3 deletions ci/run.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ esac

case $TRAVIS_OS_NAME in
osx)
NM=gnm

# NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
# Use GNU nm instead
NM=gnm
brew install binutils
;;
*)
Expand All @@ -56,7 +55,7 @@ case $TRAVIS_OS_NAME in
esac

# 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 __'

if test $? = 0; then
Expand Down