travis: simplify ci scripts
This commit is contained in:
parent
948ada48b5
commit
1ac627839d
|
@ -42,9 +42,6 @@ matrix:
|
||||||
- env: TARGET=x86_64-unknown-linux-gnu
|
- env: TARGET=x86_64-unknown-linux-gnu
|
||||||
os: linux
|
os: linux
|
||||||
|
|
||||||
before_install:
|
|
||||||
- export PATH="$PATH:$HOME/.cargo/bin"
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- bash ci/install.sh
|
- bash ci/install.sh
|
||||||
|
|
||||||
|
|
95
ci/env.sh
95
ci/env.sh
|
@ -1,60 +1,49 @@
|
||||||
case $TRAVIS_OS_NAME in
|
case $TRAVIS_OS_NAME in
|
||||||
linux)
|
linux)
|
||||||
export HOST=x86_64-unknown-linux-gnu
|
HOST=x86_64-unknown-linux-gnu
|
||||||
export NM=nm
|
NM=nm
|
||||||
export OBJDUMP=objdump
|
OBJDUMP=objdump
|
||||||
|
LINUX=y
|
||||||
;;
|
;;
|
||||||
osx)
|
osx)
|
||||||
export HOST=x86_64-apple-darwin
|
HOST=x86_64-apple-darwin
|
||||||
export NM=gnm
|
NM=gnm
|
||||||
export OBJDUMP=gobjdump
|
OBJDUMP=gobjdump
|
||||||
|
OSX=y
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case $TARGET in
|
# NOTE For rustup
|
||||||
aarch64-unknown-linux-gnu)
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
export PREFIX=aarch64-linux-gnu-
|
|
||||||
export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu
|
CARGO=cargo
|
||||||
;;
|
RUN_TESTS=y
|
||||||
arm*-unknown-linux-gnueabi)
|
|
||||||
export PREFIX=arm-linux-gnueabi-
|
# NOTE For the host and its 32-bit variants we don't need prefixed tools or QEMU
|
||||||
export QEMU_LD_PREFIX=/usr/arm-linux-gnueabi
|
if [[ $TARGET != $HOST && ! $TARGET =~ ^i.86- ]]; then
|
||||||
;;
|
GCC_TRIPLE=${TARGET//unknown-/}
|
||||||
arm-unknown-linux-gnueabihf)
|
|
||||||
export PREFIX=arm-linux-gnueabihf-
|
case $TARGET in
|
||||||
export QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
|
armv7-unknown-linux-gnueabihf)
|
||||||
;;
|
GCC_TRIPLE=arm-linux-gnueabihf
|
||||||
armv7-unknown-linux-gnueabihf)
|
;;
|
||||||
export PREFIX=arm-linux-gnueabihf-
|
powerpc64le-unknown-linux-gnu)
|
||||||
export QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
|
# QEMU crashes even when executing the simplest cross compiled C program:
|
||||||
;;
|
# `int main() { return 0; }`
|
||||||
mips-unknown-linux-gnu)
|
RUN_TESTS=n
|
||||||
export PREFIX=mips-linux-gnu-
|
;;
|
||||||
export QEMU_LD_PREFIX=/usr/mips-linux-gnu
|
thumbv*-none-eabi)
|
||||||
;;
|
CARGO=xargo
|
||||||
mipsel-unknown-linux-gnu)
|
GCC_TRIPLE=arm-none-eabi
|
||||||
export PREFIX=mipsel-linux-gnu-
|
# Bare metal targets. No `std` or `test` crates for these targets.
|
||||||
export QEMU_LD_PREFIX=/usr/mipsel-linux-gnu
|
RUN_TESTS=n
|
||||||
;;
|
;;
|
||||||
powerpc-unknown-linux-gnu)
|
esac
|
||||||
export PREFIX=powerpc-linux-gnu-
|
|
||||||
export QEMU_LD_PREFIX=/usr/powerpc-linux-gnu
|
if [[ $RUN_TESTS == y ]]; then
|
||||||
;;
|
# NOTE(export) so this can reach the processes that `cargo test` spawns
|
||||||
powerpc64-unknown-linux-gnu)
|
export QEMU_LD_PREFIX=/usr/$GCC_TRIPLE
|
||||||
export PREFIX=powerpc64-linux-gnu-
|
fi
|
||||||
export QEMU_LD_PREFIX=/usr/powerpc64-linux-gnu
|
|
||||||
;;
|
PREFIX=$GCC_TRIPLE-
|
||||||
powerpc64le-unknown-linux-gnu)
|
fi
|
||||||
export PREFIX=powerpc64le-linux-gnu-
|
|
||||||
export QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu
|
|
||||||
# QEMU crashes, even running the simplest cross compiled C program:
|
|
||||||
# `int main() { return 0; }`
|
|
||||||
export RUN_TESTS=n
|
|
||||||
;;
|
|
||||||
thumbv*-none-eabi)
|
|
||||||
export CARGO=xargo
|
|
||||||
export PREFIX=arm-none-eabi-
|
|
||||||
# Bare metal targets. No `std` or `test` crates for these targets.
|
|
||||||
export RUN_TESTS=n
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ set -ex
|
||||||
. $(dirname $0)/env.sh
|
. $(dirname $0)/env.sh
|
||||||
|
|
||||||
install_qemu() {
|
install_qemu() {
|
||||||
if [[ $TRAVIS_OS_NAME = "linux" ]]; then
|
if [[ $QEMU_LD_PREFIX ]]; then
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
binfmt-support qemu-user-static
|
binfmt-support qemu-user-static
|
||||||
|
@ -15,13 +15,13 @@ install_gist() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_binutils() {
|
install_binutils() {
|
||||||
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
|
if [[ $OSX ]]; then
|
||||||
brew install binutils
|
brew install binutils
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_rust() {
|
install_rust() {
|
||||||
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
|
if [[ $OSX ]]; then
|
||||||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=nightly
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=nightly
|
||||||
else
|
else
|
||||||
rustup default nightly
|
rustup default nightly
|
||||||
|
@ -33,20 +33,20 @@ install_rust() {
|
||||||
}
|
}
|
||||||
|
|
||||||
add_rustup_target() {
|
add_rustup_target() {
|
||||||
if [[ $TARGET != $HOST && ${CARGO:-cargo} == "cargo" ]]; then
|
if [[ $TARGET != $HOST && $CARGO == cargo ]]; then
|
||||||
rustup target add $TARGET
|
rustup target add $TARGET
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_xargo() {
|
install_xargo() {
|
||||||
if [[ $CARGO == "xargo" ]]; then
|
if [[ $CARGO == xargo ]]; then
|
||||||
curl -sf "https://raw.githubusercontent.com/japaric/rust-everywhere/master/install.sh" | \
|
curl -sf "https://raw.githubusercontent.com/japaric/rust-everywhere/master/install.sh" | \
|
||||||
bash -s -- --from japaric/xargo --at /root/.cargo/bin
|
bash -s -- --from japaric/xargo --at /root/.cargo/bin
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if [[ $TRAVIS_OS_NAME == "osx" || ${IN_DOCKER_CONTAINER:-n} == "y" ]]; then
|
if [[ $OSX || ${IN_DOCKER_CONTAINER:-n} == y ]]; then
|
||||||
install_qemu
|
install_qemu
|
||||||
install_gist
|
install_gist
|
||||||
install_binutils
|
install_binutils
|
||||||
|
|
14
ci/script.sh
14
ci/script.sh
|
@ -8,8 +8,8 @@ gist_it() {
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
${CARGO:-cargo} build --target $TARGET
|
$CARGO build --tartet $TARGET
|
||||||
${CARGO:-cargo} build --target $TARGET --release
|
$CARGO build --target $TARGET --release
|
||||||
}
|
}
|
||||||
|
|
||||||
inspect() {
|
inspect() {
|
||||||
|
@ -20,7 +20,7 @@ inspect() {
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Check presence of weak symbols
|
# Check presence of weak symbols
|
||||||
if [[ $TRAVIS_OS_NAME = "linux" ]]; then
|
if [[ $LINUX ]]; then
|
||||||
local symbols=( memcmp memcpy memmove memset )
|
local symbols=( memcmp memcpy memmove memset )
|
||||||
for symbol in "${symbols[@]}"; do
|
for symbol in "${symbols[@]}"; do
|
||||||
$PREFIX$NM target/**/debug/deps/librlibc*.rlib | grep -q "W $symbol"
|
$PREFIX$NM target/**/debug/deps/librlibc*.rlib | grep -q "W $symbol"
|
||||||
|
@ -34,14 +34,14 @@ run_tests() {
|
||||||
export RUST_TEST_THREADS=1
|
export RUST_TEST_THREADS=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${RUN_TESTS:-y} == "y" ]]; then
|
if [[ $RUN_TESTS == y ]]; then
|
||||||
cargo test --target $TARGET
|
cargo test --target $TARGET
|
||||||
cargo test --target $TARGET --release
|
cargo test --target $TARGET --release
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if [[ $TRAVIS_OS_NAME == "linux" && ${IN_DOCKER_CONTAINER:-n} == "n" ]]; then
|
if [[ $LINUX && ${IN_DOCKER_CONTAINER:-n} == n ]]; then
|
||||||
local tag=2016-08-24
|
local tag=2016-08-24
|
||||||
|
|
||||||
docker run \
|
docker run \
|
||||||
|
@ -53,9 +53,7 @@ main() {
|
||||||
-e TRAVIS_OS_NAME=$TRAVIS_OS_NAME \
|
-e TRAVIS_OS_NAME=$TRAVIS_OS_NAME \
|
||||||
-v $(pwd):/mnt \
|
-v $(pwd):/mnt \
|
||||||
japaric/rustc-builtins:$tag \
|
japaric/rustc-builtins:$tag \
|
||||||
sh -c 'set -ex;
|
sh -c 'cd /mnt;
|
||||||
cd /mnt;
|
|
||||||
export PATH="$PATH:/root/.cargo/bin";
|
|
||||||
bash ci/install.sh;
|
bash ci/install.sh;
|
||||||
bash ci/script.sh'
|
bash ci/script.sh'
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue