travis CI

This commit is contained in:
Jorge Aparicio 2016-08-07 16:55:30 -05:00
parent e82b7bec40
commit b1846b794b
4 changed files with 163 additions and 0 deletions

61
.travis.yml Normal file
View File

@ -0,0 +1,61 @@
language: generic
matrix:
include:
- 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
- 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
- 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=x86_64-apple-darwin
os: osx
- env: TARGET=x86_64-unknown-linux-gnu
os: linux
install:
- bash ci/install.sh
script:
- bash ci/script.sh
notifications:
email:
on_success: never

23
ci/env.sh Normal file
View File

@ -0,0 +1,23 @@
case $TRAVIS_OS_NAME in
linux)
export HOST=x86_64-unknown-linux-gnu
;;
osx)
export HOST=x86_64-apple-darwin
;;
esac
case $TARGET in
aarch64-unknown-linux-gnu)
export PREFIX=aarch64-linux-gnu-
export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu
;;
arm*-unknown-linux-gnueabi)
export PREFIX=arm-linux-gnueabi-
export QEMU_LD_PREFIX=/usr/arm-linux-gnueabi
;;
arm*-unknown-linux-gnueabihf)
export PREFIX=arm-linux-gnueabihf-
export QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
;;
esac

31
ci/install.sh Normal file
View File

@ -0,0 +1,31 @@
set -ex
. $(dirname $0)/env.sh
build() {
cargo build --target $TARGET
cargo build --target $TARGET --release
}
run_tests() {
if [[ $QEMU_LD_PREFIX ]]; then
export RUST_TEST_THREADS=1
fi
cargo test --target $TARGET
cargo test --target $TARGET --release
}
inspect() {
${PREFIX}nm -g --defined-only target/**/debug/*.rlib
${PREFIX}objdump target/**/debug/*.rlib
${PREFIX}objdump target/**/release/*.rlib
}
main() {
build
run_tests
inspect
}
main

48
ci/script.sh Normal file
View File

@ -0,0 +1,48 @@
set -ex
. $(dirname $0)/env.sh
install_c_toolchain() {
case $TARGET in
aarch64-unknown-linux-gnu)
sudo apt-get install -y --no-install-recommends \
gcc-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross
;;
*)
;;
esac
}
install_rust() {
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=nightly
rustc -V
cargo -V
}
add_rustup_target() {
if [[ $TARGET != $HOST ]]; then
rustup target add $TARGET
fi
}
configure_cargo() {
if [[ $PREFIX ]]; then
${PREFIX}gcc -v
mkdir -p .cargo
cat >>.cargo/config <<EOF
[target.$TARGET]
linker = "${PREFIX}gcc"
EOF
fi
}
main() {
install_c_toolchain
install_rust
add_rustup_target
configure_cargo
}
main