Skip to content

Commit

Permalink
Use docker for all CI tests and images
Browse files Browse the repository at this point in the history
Previously we were somewhat half-Docker, half-Travis, half apt-get, etc. This
commit alters the CI infrastructure to use Docker images for each target. This
should make it much easier to update the images and tweak various bits and
pieces of installed software. Additionally, it's also much clearer now what's
needed for each suite of tests!

Some images were updated a bit (e.g. musl is now 1.1.14), but other images
encountered failures when updating so they're not getting updated just yet.
  • Loading branch information
alexcrichton committed Jun 15, 2016
1 parent 70dce05 commit 3eb4a48
Show file tree
Hide file tree
Showing 20 changed files with 267 additions and 319 deletions.
103 changes: 72 additions & 31 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,106 @@
language: rust
sudo: required
dist: trusty
rust:
- 1.0.0
- stable
- beta
- nightly
services:
- docker
install:
- curl https://static.rust-lang.org/rustup.sh |
sh -s -- --add-target=$TARGET --disable-sudo -y --prefix=`rustc --print sysroot`
script:
- if [[ $TRAVIS_RUST_VERSION = nightly* ]]; then
sh ci/run-travis.sh;
elif [[ $TRAVIS_RUST_VERSION = "1.0.0" ]]; then
cargo build;
- cargo build
- cargo build --no-default-features
- cargo generate-lockfile --manifest-path libc-test/Cargo.toml
- if [[ $TRAVIS_OS_NAME = "linux" ]]; then
sh ci/run-docker.sh $TARGET;
else
cargo build &&
cargo build --no-default-features &&
rustc ci/style.rs && ./style src;
export CARGO_TARGET_DIR=`pwd`/target;
sh ci/run.sh $TARGET;
fi
- rustc ci/style.rs && ./style src
osx_image: xcode7.3
os:
- linux
- osx
env:
matrix:
- ARCH=x86_64
- ARCH=i686
global:
secure: eIDEoQdTyglcsTD13zSGotAX2HDhRSXIaaTnVZTThqLSrySOc3/6KY3qmOc2Msf7XaBqfFy9QA+alk7OwfePp253eiy1Kced67ffjjFOytEcRT7FlQiYpcYQD6WNHZEj62/bJBO4LTM9sGtWNCTJVEDKW0WM8mUK7qNuC+honPM=
matrix:
include:
# 1.0.0 compat
- os: linux
env: TARGET=arm-linux-androideabi DOCKER=alexcrichton/rust-slave-android:2015-11-22
rust: nightly
env: TARGET=x86_64-unknown-linux-gnu
rust: 1.0.0
script: cargo build
install:

# build documentation
- os: linux
env: TARGET=x86_64-unknown-linux-gnu
rust: stable
script: sh ci/dox.sh

# stable compat
- os: linux
env: TARGET=x86_64-unknown-linux-gnu
rust: stable
- os: linux
env: TARGET=i686-unknown-linux-gnu
rust: stable
- os: osx
env: TARGET=x86_64-apple-darwin
rust: stable
- os: osx
env: TARGET=i686-apple-darwin
rust: stable
- os: linux
env: TARGET=arm-linux-androideabi
rust: stable
- os: linux
env: TARGET=x86_64-unknown-linux-musl
rust: nightly
rust: stable
- os: linux
env: TARGET=arm-unknown-linux-gnueabihf
rust: nightly
- os: linux
env: TARGET=mips-unknown-linux-gnu DOCKER=alexcrichton/rust-libc-mips:2016-01-10
rust: nightly
rust: stable
- os: linux
env: TARGET=aarch64-unknown-linux-gnu
rust: nightly
rust: stable
- os: osx
env: TARGET=i386-apple-ios
rust: nightly
rust: stable
- os: osx
env: TARGET=x86_64-apple-ios
rust: nightly
rust: stable
- os: linux
env: TARGET=x86_64-rumprun-netbsd
rust: stable

# beta
- os: linux
env: TARGET=x86_64-unknown-linux-gnu
rust: beta
- os: osx
env: TARGET=x86_64-apple-darwin
rust: beta

# nightly
- os: linux
env: TARGET=x86_64-rumprun-netbsd DOCKER=alexcrichton/rust-libc-rumprun:2015-11-27
env: TARGET=x86_64-unknown-linux-gnu
rust: nightly
- os: osx
env: TARGET=x86_64-apple-darwin
rust: nightly
- os: linux
env: TARGET=x86_64-unknown-freebsd QEMU=freebsd.qcow2
env: TARGET=mips-unknown-linux-gnu
# not sure why this has to be nightly...
rust: nightly

# QEMU based targets that compile in an emulator
- os: linux
env: TARGET=x86_64-unknown-freebsd
rust: stable
- os: linux
env: TARGET=x86_64-unknown-openbsd QEMU=openbsd.qcow2
rust: nightly
rust: stable
script: sh ci/run-docker.sh $TARGET
install:

notifications:
email:
on_success: never
Expand Down
13 changes: 0 additions & 13 deletions ci/cargo-config

This file was deleted.

7 changes: 7 additions & 0 deletions ci/docker/aarch64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
PATH=$PATH:/rust/bin
4 changes: 4 additions & 0 deletions ci/docker/arm-linux-androideabi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM alexcrichton/rust-slave-android:2015-11-22
ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
PATH=$PATH:/rust/bin
ENTRYPOINT ["sh"]
7 changes: 7 additions & 0 deletions ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
PATH=$PATH:/rust/bin
5 changes: 5 additions & 0 deletions ci/docker/i686-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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
13 changes: 13 additions & 0 deletions ci/docker/mips-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ubuntu:15.10

RUN apt-get update
RUN apt-get install -y --no-install-recommends \
software-properties-common gcc libc6-dev qemu-user
RUN add-apt-repository ppa:angelsl/mips-cross
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc-5-mips-linux-gnu libc6-dev-mips-cross

ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc-5 \
CC_mips_unknown_linux_gnu=mips-linux-gnu-gcc-5 \
PATH=$PATH:/rust/bin
6 changes: 6 additions & 0 deletions ci/docker/x86_64-rumprun-netbsd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM mato/rumprun-toolchain-hw-x86_64
USER root
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
qemu
ENV PATH=$PATH:/rust/bin
13 changes: 13 additions & 0 deletions ci/docker/x86_64-unknown-freebsd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM alexcrichton/rust-slave-linux-cross:2016-04-15
USER root

RUN apt-get update
RUN apt-get install -y --no-install-recommends \
qemu qemu-kvm kmod cpu-checker

ENTRYPOINT ["sh"]

ENV PATH=$PATH:/rust/bin \
QEMU=freebsd.qcow2 \
CAN_CROSS=1 \
CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc
5 changes: 5 additions & 0 deletions ci/docker/x86_64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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
13 changes: 13 additions & 0 deletions ci/docker/x86_64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ubuntu:16.04

RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates
RUN curl https://www.musl-libc.org/releases/musl-1.1.14.tar.gz | \
tar xzf - && \
cd musl-1.1.14 && \
./configure --prefix=/musl-x86_64 && \
make install -j4 && \
cd .. && \
rm -rf musl-1.1.14
ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin
7 changes: 7 additions & 0 deletions ci/docker/x86_64-unknown-openbsd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:16.04

RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc libc6-dev qemu qemu-kvm curl ca-certificates kmod cpu-checker
ENV PATH=$PATH:/rust/bin \
QEMU=openbsd.qcow2
12 changes: 0 additions & 12 deletions ci/mips/Dockerfile

This file was deleted.

12 changes: 0 additions & 12 deletions ci/rumprun/Dockerfile

This file was deleted.

48 changes: 0 additions & 48 deletions ci/run-all.sh

This file was deleted.

25 changes: 25 additions & 0 deletions ci/run-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Small script to run tests for a target (or all targets) inside all the
# respective docker images.

set -ex

run() {
echo $1
docker build -t libc ci/docker/$1
docker run \
-v `rustc --print sysroot`:/rust:ro \
-v `pwd`:/checkout:ro \
-e CARGO_TARGET_DIR=/tmp/target \
-w /checkout \
--privileged \
-it libc \
ci/run.sh $1
}

if [ -z "$1" ]; then
for d in `ls ci/docker/`; do
run $d
done
else
run $1
fi
5 changes: 1 addition & 4 deletions ci/run-qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ cp -r $ROOT/libc /tmp/libc
cd /tmp/libc

TARGET=$(cat $ROOT/TARGET)
export CARGO_TARGET_DIR=/tmp

case $TARGET in
*-freebsd)
sudo pkg install -y rust cargo
;;

*-openbsd)
pkg_add rust curl gcc-4.8.4p4
curl https://static.rust-lang.org/cargo-dist/2015-04-02/cargo-nightly-x86_64-unknown-openbsd.tar.gz | \
Expand Down
Loading

0 comments on commit 3eb4a48

Please sign in to comment.