Skip to content

travis CI #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
language: generic
sudo: false

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
- 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=x86_64-apple-darwin
os: osx
- env: TARGET=x86_64-unknown-linux-gnu
os: linux

before_install:
- export PATH="$PATH:$HOME/.cargo/bin"

install:
- bash ci/install.sh

script:
- bash ci/script.sh

branches:
only:
- master

notifications:
email:
on_success: never
27 changes: 27 additions & 0 deletions ci/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
case $TRAVIS_OS_NAME in
linux)
export HOST=x86_64-unknown-linux-gnu
export NM=nm
export OBJDUMP=objdump
;;
osx)
export HOST=x86_64-apple-darwin
export NM=gnm
export OBJDUMP=gobjdump
;;
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
59 changes: 59 additions & 0 deletions ci/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
set -ex

. $(dirname $0)/env.sh

install_binutils() {
case $TRAVIS_OS_NAME in
osx)
brew install binutils
;;
*)
;;
esac
}

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_binutils
install_c_toolchain
install_rust
add_rustup_target
configure_cargo
}

main
33 changes: 33 additions & 0 deletions ci/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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
set +e
$PREFIX$OBJDUMP -Cd target/**/debug/*.rlib
$PREFIX$OBJDUMP -Cd target/**/release/*.rlib
set -e
}

main() {
build
run_tests
inspect
}

main