CI: run all Linux targets inside docker
This commit is contained in:
parent
b4e474f417
commit
0c2ef10160
65
.travis.yml
65
.travis.yml
@ -1,97 +1,39 @@
|
||||
language: generic
|
||||
sudo: false
|
||||
sudo: required
|
||||
services: docker
|
||||
|
||||
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=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=x86_64-apple-darwin
|
||||
os: osx
|
||||
- env: TARGET=x86_64-unknown-linux-gnu
|
||||
@ -107,9 +49,6 @@ matrix:
|
||||
- env: TARGET=armv7-unknown-linux-gnueabihf
|
||||
os: linux
|
||||
|
||||
before_install:
|
||||
- export PATH="$PATH:$HOME/.cargo/bin"
|
||||
|
||||
install:
|
||||
- bash ci/install.sh
|
||||
|
||||
|
26
ci/env.sh
26
ci/env.sh
@ -28,26 +28,14 @@ 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=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=qemu-mipsel
|
||||
export QEMU_LD_PREFIX=/usr/mipsel-linux-gnu
|
||||
;;
|
||||
powerpc-unknown-linux-gnu)
|
||||
@ -55,19 +43,13 @@ 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=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=qemu-ppc64le
|
||||
export QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu
|
||||
# Issue #2. QEMU doesn't work
|
||||
export RUN_TESTS=n
|
||||
|
@ -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" ]]
|
||||
install_qemu
|
||||
install_binutils
|
||||
install_c_toolchain
|
||||
install_rust
|
||||
add_rustup_target
|
||||
install_xargo
|
||||
configure_cargo
|
||||
fi
|
||||
}
|
||||
|
||||
|
25
ci/script.sh
25
ci/script.sh
@ -7,6 +7,14 @@ build() {
|
||||
${CARGO:-cargo} build --target $TARGET --release
|
||||
}
|
||||
|
||||
inspect() {
|
||||
$PREFIX$NM -g --defined-only target/**/debug/*.rlib
|
||||
set +e
|
||||
$PREFIX$OBJDUMP -Cd target/**/debug/*.rlib
|
||||
$PREFIX$OBJDUMP -Cd target/**/release/*.rlib
|
||||
set -e
|
||||
}
|
||||
|
||||
run_tests() {
|
||||
if [[ $QEMU_LD_PREFIX ]]; then
|
||||
export RUST_TEST_THREADS=1
|
||||
@ -27,25 +35,20 @@ run_tests() {
|
||||
fi
|
||||
}
|
||||
|
||||
inspect() {
|
||||
$PREFIX$NM -g --defined-only target/**/debug/*.rlib
|
||||
set +e
|
||||
$PREFIX$OBJDUMP -Cd target/**/debug/*.rlib
|
||||
$PREFIX$OBJDUMP -Cd target/**/release/*.rlib
|
||||
set -e
|
||||
}
|
||||
|
||||
main() {
|
||||
if [[ $DOCKER == "y" ]]; 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
Block a user