Merge pull request #37 from japaric/docker
CI: run all Linux targets inside docker
This commit is contained in:
commit
f300480aa9
89
.travis.yml
89
.travis.yml
|
@ -1,111 +1,44 @@
|
|||
dist: trusty
|
||||
language: generic
|
||||
sudo: false
|
||||
services: docker
|
||||
sudo: required
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- env: TARGET=thumbv6m-none-eabi
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
- env: TARGET=thumbv7m-none-eabi
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
- env: TARGET=thumbv7em-none-eabi
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
- env: TARGET=i586-unknown-linux-gnu
|
||||
os: linux
|
||||
services: docker
|
||||
sudo: required
|
||||
- env: TARGET=aarch64-unknown-linux-gnu
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- binfmt-support
|
||||
- qemu-user-static
|
||||
- env: TARGET=arm-unknown-linux-gnueabi
|
||||
os: linux
|
||||
sudo: required
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- binfmt-support
|
||||
- gcc-arm-linux-gnueabi
|
||||
- libc6-armel-cross
|
||||
- libc6-dev-armel-cross
|
||||
- qemu-user-static
|
||||
- env: TARGET=arm-unknown-linux-gnueabihf
|
||||
os: linux
|
||||
sudo: required
|
||||
addons:
|
||||
apt:
|
||||
packages: &armhf
|
||||
- binfmt-support
|
||||
- gcc-arm-linux-gnueabihf
|
||||
- libc6-armhf-cross
|
||||
- libc6-dev-armhf-cross
|
||||
- qemu-user-static
|
||||
- env: TARGET=armv7-unknown-linux-gnueabihf
|
||||
os: linux
|
||||
sudo: required
|
||||
addons:
|
||||
apt:
|
||||
packages: *armhf
|
||||
- env: TARGET=i586-unknown-linux-gnu
|
||||
os: linux
|
||||
- env: TARGET=i686-apple-darwin
|
||||
os: osx
|
||||
- env: TARGET=i686-unknown-linux-gnu
|
||||
os: linux
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
- env: TARGET=mips-unknown-linux-gnu
|
||||
os: linux
|
||||
services: docker
|
||||
sudo: required
|
||||
- env: TARGET=mipsel-unknown-linux-gnu
|
||||
os: linux
|
||||
services: docker
|
||||
sudo: required
|
||||
- env: TARGET=powerpc-unknown-linux-gnu
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- binfmt-support
|
||||
- gcc-powerpc-linux-gnu
|
||||
- libc6-powerpc-cross
|
||||
- libc6-dev-powerpc-cross
|
||||
- qemu-user-static
|
||||
- env: TARGET=powerpc64-unknown-linux-gnu
|
||||
os: linux
|
||||
services: docker
|
||||
sudo: required
|
||||
- env: TARGET=powerpc64le-unknown-linux-gnu
|
||||
os: linux
|
||||
services: docker
|
||||
sudo: required
|
||||
- env: TARGET=thumbv6m-none-eabi
|
||||
os: linux
|
||||
- env: TARGET=thumbv7em-none-eabi
|
||||
os: linux
|
||||
- env: TARGET=thumbv7m-none-eabi
|
||||
os: linux
|
||||
- env: TARGET=x86_64-apple-darwin
|
||||
os: osx
|
||||
- env: TARGET=x86_64-unknown-linux-gnu
|
||||
os: linux
|
||||
allow_failures:
|
||||
# Issue #2. Flaky test
|
||||
- env: TARGET=arm-unknown-linux-gnueabi
|
||||
os: linux
|
||||
# Issue #2. Flaky test
|
||||
- env: TARGET=arm-unknown-linux-gnueabihf
|
||||
os: linux
|
||||
# Issue #2. Flaky test
|
||||
- env: TARGET=armv7-unknown-linux-gnueabihf
|
||||
os: linux
|
||||
|
||||
before_install:
|
||||
- export PATH="$PATH:$HOME/.cargo/bin"
|
||||
|
|
23
ci/env.sh
23
ci/env.sh
|
@ -28,26 +28,12 @@ case $TARGET in
|
|||
export PREFIX=arm-linux-gnueabihf-
|
||||
export QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
|
||||
;;
|
||||
i586-unknown-linux-gnu)
|
||||
# NOTE $DOCKER values: 'y' (yes, call docker), 'i' (inside a docker container) or 'n' ("no)
|
||||
if [[ -z $DOCKER ]]; then
|
||||
export DOCKER=y
|
||||
fi
|
||||
;;
|
||||
mips-unknown-linux-gnu)
|
||||
if [[ -z $DOCKER ]]; then
|
||||
export DOCKER=y
|
||||
fi
|
||||
export PREFIX=mips-linux-gnu-
|
||||
export QEMU=qemu-mips
|
||||
export QEMU_LD_PREFIX=/usr/mips-linux-gnu
|
||||
;;
|
||||
mipsel-unknown-linux-gnu)
|
||||
if [[ -z $DOCKER ]]; then
|
||||
export DOCKER=y
|
||||
fi
|
||||
export PREFIX=mipsel-linux-gnu-
|
||||
export QEMU=qemu-mipsel
|
||||
export QEMU_LD_PREFIX=/usr/mipsel-linux-gnu
|
||||
;;
|
||||
powerpc-unknown-linux-gnu)
|
||||
|
@ -55,21 +41,12 @@ case $TARGET in
|
|||
export QEMU_LD_PREFIX=/usr/powerpc-linux-gnu
|
||||
;;
|
||||
powerpc64-unknown-linux-gnu)
|
||||
if [[ -z $DOCKER ]]; then
|
||||
export DOCKER=y
|
||||
fi
|
||||
export PREFIX=powerpc64-linux-gnu-
|
||||
export QEMU=qemu-ppc64
|
||||
export QEMU_LD_PREFIX=/usr/powerpc64-linux-gnu
|
||||
;;
|
||||
powerpc64le-unknown-linux-gnu)
|
||||
if [[ -z $DOCKER ]]; then
|
||||
export DOCKER=y
|
||||
fi
|
||||
export PREFIX=powerpc64le-linux-gnu-
|
||||
export QEMU=qemu-ppc64le
|
||||
export QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu
|
||||
# Issue #2. QEMU doesn't work
|
||||
export RUN_TESTS=n
|
||||
;;
|
||||
thumbv*-none-eabi)
|
||||
|
|
|
@ -2,77 +2,33 @@ set -ex
|
|||
|
||||
. $(dirname $0)/env.sh
|
||||
|
||||
install_deps() {
|
||||
if [[ ${DOCKER} == "i" ]]; then
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates curl
|
||||
fi
|
||||
}
|
||||
|
||||
install_qemu() {
|
||||
case $TARGET in
|
||||
mipsel-unknown-linux-gnu | \
|
||||
powerpc64le-unknown-linux-gnu)
|
||||
case ${QEMU_ARCH:-$TRAVIS_OS_NAME} in
|
||||
i386)
|
||||
dpkg --add-architecture $QEMU_ARCH
|
||||
apt-get install -y --no-install-recommends \
|
||||
qemu-user
|
||||
binfmt-support qemu-user-static:$QEMU_ARCH
|
||||
;;
|
||||
mips-unknown-linux-gnu | \
|
||||
powerpc64-unknown-linux-gnu)
|
||||
dpkg --add-architecture i386
|
||||
linux)
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends \
|
||||
qemu-user:i386
|
||||
binfmt-support qemu-user-static
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_binutils() {
|
||||
case $TRAVIS_OS_NAME in
|
||||
osx)
|
||||
brew install binutils
|
||||
;;
|
||||
esac
|
||||
|
||||
case $TARGET in
|
||||
thumbv*-none-eabi)
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
gcc-arm-none-eabi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_c_toolchain() {
|
||||
case $TARGET in
|
||||
aarch64-unknown-linux-gnu)
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
gcc-aarch64-linux-gnu libc6-dev-arm64-cross
|
||||
;;
|
||||
i586-unknown-linux-gnu)
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc libc6-dev-i386 lib32gcc-5-dev
|
||||
;;
|
||||
mips-unknown-linux-gnu)
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc gcc-mips-linux-gnu libc6-dev libc6-dev-mips-cross
|
||||
;;
|
||||
mipsel-unknown-linux-gnu)
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc gcc-mipsel-linux-gnu libc6-dev libc6-dev-mipsel-cross
|
||||
;;
|
||||
powerpc64-unknown-linux-gnu)
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc gcc-powerpc64-linux-gnu libc6-dev libc6-dev-ppc64-cross
|
||||
;;
|
||||
powerpc64le-unknown-linux-gnu)
|
||||
apt-get install -y --no-install-recommends \
|
||||
gcc gcc-powerpc64le-linux-gnu libc6-dev libc6-dev-ppc64el-cross
|
||||
;;
|
||||
esac
|
||||
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
|
||||
brew install binutils
|
||||
fi
|
||||
}
|
||||
|
||||
install_rust() {
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=nightly
|
||||
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=nightly
|
||||
else
|
||||
rustup default nightly
|
||||
fi
|
||||
|
||||
rustc -V
|
||||
cargo -V
|
||||
|
@ -86,35 +42,18 @@ add_rustup_target() {
|
|||
|
||||
install_xargo() {
|
||||
if [[ $CARGO == "xargo" ]]; then
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
libssh2-1
|
||||
curl -sf "https://raw.githubusercontent.com/japaric/rust-everywhere/master/install.sh" | \
|
||||
bash -s -- --from japaric/xargo --at $HOME/.cargo/bin
|
||||
fi
|
||||
}
|
||||
|
||||
configure_cargo() {
|
||||
if [[ $PREFIX ]]; then
|
||||
${PREFIX}gcc -v
|
||||
|
||||
mkdir -p .cargo
|
||||
cat >>.cargo/config <<EOF
|
||||
[target.$TARGET]
|
||||
linker = "${PREFIX}gcc"
|
||||
EOF
|
||||
bash -s -- --from japaric/xargo --at /root/.cargo/bin
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
if [[ ${DOCKER:-n} != "y" ]]; then
|
||||
install_deps
|
||||
if [[ $TRAVIS_OS_NAME == "osx" || ${IN_DOCKER_CONTAINER:-n} == "y" ]]; then
|
||||
install_qemu
|
||||
install_binutils
|
||||
install_c_toolchain
|
||||
install_rust
|
||||
add_rustup_target
|
||||
install_xargo
|
||||
configure_cargo
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
42
ci/script.sh
42
ci/script.sh
|
@ -7,26 +7,6 @@ build() {
|
|||
${CARGO:-cargo} build --target $TARGET --release
|
||||
}
|
||||
|
||||
run_tests() {
|
||||
if [[ $QEMU_LD_PREFIX ]]; then
|
||||
export RUST_TEST_THREADS=1
|
||||
fi
|
||||
|
||||
if [[ $QEMU ]]; then
|
||||
cargo test --target $TARGET --no-run
|
||||
if [[ ${RUN_TESTS:-y} == "y" ]]; then
|
||||
$QEMU target/**/debug/rustc_builtins-*
|
||||
fi
|
||||
cargo test --target $TARGET --release --no-run
|
||||
if [[ ${RUN_TESTS:-y} == "y" ]]; then
|
||||
$QEMU target/**/release/rustc_builtins-*
|
||||
fi
|
||||
elif [[ ${RUN_TESTS:-y} == "y" ]]; then
|
||||
cargo test --target $TARGET
|
||||
cargo test --target $TARGET --release
|
||||
fi
|
||||
}
|
||||
|
||||
inspect() {
|
||||
$PREFIX$NM -g --defined-only target/**/debug/*.rlib
|
||||
set +e
|
||||
|
@ -35,17 +15,31 @@ inspect() {
|
|||
set -e
|
||||
}
|
||||
|
||||
run_tests() {
|
||||
if [[ $QEMU_LD_PREFIX ]]; then
|
||||
export RUST_TEST_THREADS=1
|
||||
fi
|
||||
|
||||
if [[ ${RUN_TESTS:-y} == "y" ]]; then
|
||||
cargo test --target $TARGET
|
||||
cargo test --target $TARGET --release
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
if [[ $DOCKER == "y" ]]; then
|
||||
if [[ $TRAVIS_OS_NAME == "linux" && ${IN_DOCKER_CONTAINER:-n} == "n" ]]; then
|
||||
local tag=2016-08-13
|
||||
|
||||
docker run \
|
||||
-e DOCKER=i \
|
||||
--privileged \
|
||||
-e IN_DOCKER_CONTAINER=y \
|
||||
-e TARGET=$TARGET \
|
||||
-e TRAVIS_OS_NAME=$TRAVIS_OS_NAME \
|
||||
-v $(pwd):/mnt \
|
||||
ubuntu:16.04 \
|
||||
japaric/rustc-builtins:$tag \
|
||||
sh -c 'set -ex;
|
||||
cd /mnt;
|
||||
export PATH="$PATH:$HOME/.cargo/bin";
|
||||
export PATH="$PATH:/root/.cargo/bin";
|
||||
bash ci/install.sh;
|
||||
bash ci/script.sh'
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue