Skip to content

[ci] use cross for testing #211

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

Closed
wants to merge 5 commits into from
Closed
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
6 changes: 1 addition & 5 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@ install:
build: false

test_script:
- C:\msys64\usr\bin\sh ci\run.sh

branches:
only:
- master
- C:\msys64\usr\bin\sh ci\windows.sh
28 changes: 10 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
language: rust
sudo: false
rust: nightly
services: docker

matrix:
fast_finish: true
include:
- env: TARGET=i586-unknown-linux-gnu
- env: TARGET=i686-unknown-linux-gnu
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
- env: TARGET=x86_64-unknown-linux-gnu-emulated NO_ADD=1 STDSIMD_TEST_EVERYTHING=1 FEATURES="intel_sde"
- env: TARGET=arm-unknown-linux-gnueabihf
- env: TARGET=x86_64-unknown-linux-gnu
- env: TARGET=armv7-unknown-linux-gnueabihf
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed arm-unknown-linux-gnueabihf temporarily, it is currently not supported by cross but a PR is in progress.

- env: TARGET=aarch64-unknown-linux-gnu
- env: TARGET=x86_64-unknown-linux-gnu-emulated
- os: osx
env: TARGET=x86_64-apple-darwin NO_ADD=1
script: ci/run.sh
env: TARGET=x86_64-apple-darwin
- env: DOCUMENTATION
install: true
script: ci/dox.sh
- env: RUSTFMT=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
script: |
cargo install rustfmt-nightly
cargo fmt --all -- --write-mode=diff
- env: CLIPPY=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
script: |
cargo install clippy
cargo clippy --all -- -D clippy-pedantic
- env: RUSTFMT=On TARGET=x86_64-unknown-linux-gnu
- env: CLIPPY=On TARGET=x86_64-unknown-linux-gnu
allow_failures:
- env: RUSTFMT=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
- env: CLIPPY=On TARGET=x86_64-unknown-linux-gnu NO_ADD=1
- env: RUSTFMT=On TARGET=x86_64-unknown-linux-gnu
- env: CLIPPY=On TARGET=x86_64-unknown-linux-gnu
install:
- if [ "$NO_ADD" == "" ]; then rustup target add $TARGET; fi
- source ci/ci.sh && ci_install

script:
- cargo generate-lockfile
- ci/run-docker.sh $TARGET $FEATURES
- source ci/ci.sh && ci_run

notifications:
email:
Expand Down
14 changes: 14 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[build.env]
passthrough = [
"RUST_BACKTRACE",
"RUST_LOG",
"TRAVIS"
]

[target.aarch64-unknown-linux-gnu]
image = "stdsimd_aarch64-unknown-linux-gnu"
passthrough = [ "OBJDUMP" ]

[target.armv7-unknown-linux-gnueabihf]
image = "stdsimd_armv7-unknown-linux-gnueabihf"
passthrough = [ "OBJDUMP" ]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to tweak these two images slightly to pass the correct OBJDUMP.

79 changes: 79 additions & 0 deletions ci/ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
set -ex

function ci_install() {
echo "TARGET=${TARGET}"
echo "RUSTFMT=${RUSTFMT}"
echo "CLIPPY=${CLIPPY}"

if [[ "${RUSTFMT}" == "On" ]]; then
cargo install rustfmt-nightly;
fi

if [[ "${CLIPPY}" == "On" ]]; then
cargo install clippy;
fi

if [[ "${TARGET}" == x86_64-unknown-linux-gnu-emulated ]]; then
# Install Intel's Software Development Emulator
INTEL_SDE=sde-external-8.12.0-2017-10-23-lin
INTEL_SDE_URL=https://github.com/gnzlbg/intel_sde/raw/master/$INTEL_SDE.tar.bz2
wget $INTEL_SDE_URL
tar -xjf $INTEL_SDE.tar.bz2
export TARGET=$(echo $TARGET | sed 's/-emulated//')
export FEATURES="intel_sde"
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="$(pwd)/$INTEL_SDE/sde64 -knm --"
fi

if [[ "${TARGET}" == arm-unknown-linux-gnueabihf ]] \
|| [[ "${TARGET}" == armv7-unknown-linux-gnueabihf ]] \
|| [[ "${TARGET}" == aarch64-unknown-linux-gnu ]]; then
docker build -t stdsimd_${TARGET} ci/docker/${TARGET}
fi

if [[ "${TARGET}" == x86_64-unknown-linux-gnu ]] \
|| [[ "${TARGET}" == x86_64-apple-darwin ]] \
|| [[ "${TARGET}" == x86_64-pc-windows-msvc ]]; then
export CARGO_DRIVER=cargo
else
export CARGO_DRIVER=cross
fi

if [[ "${CARGO_DRIVER}" == "cross" ]]; then
rustup target add $TARGET
cargo install cross
fi

export FEATURES="strict,${FEATURES}"
export RUST_BACKTRACE=1
}

cargo_test() {
cmd="$CARGO_DRIVER test --all --target=$TARGET --features $FEATURES --verbose $1 -- --nocapture $2"
$cmd
}

function ci_run() {
echo "TARGET=${TARGET}"
echo "RUSTFMT=${RUSTFMT}"
echo "CLIPPY=${CLIPPY}"
echo "CARGO_DRIVER=${CARGO_DRIVER}"
echo "RUSTFLAGS=${RUSTFLAGS}"
echo "RUST_BACKTRACE=${RUST_BACKTRACE}"
echo "OBJDUMP=${OBJDUMP}"
echo "FEATURES=${FEATURES}"

cargo generate-lockfile

# Tests are all super fast anyway, and they fault often enough on travis that
# having only one thread increases debuggability to be worth it.
export RUST_TEST_THREADS=1

if [[ "${RUSTFMT}" == "On" ]]; then
cargo fmt --all -- --write-mode=diff
elif [[ "${CLIPPY}" == "On" ]]; then
cargo clippy --all -- -D clippy-pedantic
else
cargo_test
cargo_test "--release"
fi
}
14 changes: 3 additions & 11 deletions ci/docker/aarch64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
FROM ubuntu:17.10
FROM japaric/aarch64-unknown-linux-gnu:latest

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
ca-certificates \
libc6-dev \
gcc-aarch64-linux-gnu \
libc6-dev-arm64-cross \
qemu-user \
make \
file

ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu" \
OBJDUMP=aarch64-linux-gnu-objdump
ENV OBJDUMP=aarch64-linux-gnu-objdump
13 changes: 0 additions & 13 deletions ci/docker/arm-unknown-linux-gnueabihf/Dockerfile

This file was deleted.

12 changes: 2 additions & 10 deletions ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
FROM ubuntu:17.10
FROM japaric/armv7-unknown-linux-gnueabihf:latest
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
ca-certificates \
libc6-dev \
gcc-arm-linux-gnueabihf \
libc6-dev-armhf-cross \
qemu-user \
make \
file
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf" \
OBJDUMP=arm-linux-gnueabihf-objdump
ENV OBJDUMP=arm-linux-gnueabihf-objdump
7 changes: 0 additions & 7 deletions ci/docker/i686-unknown-linux-gnu/Dockerfile

This file was deleted.

13 changes: 0 additions & 13 deletions ci/docker/x86_64-unknown-linux-gnu-emulated/Dockerfile

This file was deleted.

7 changes: 0 additions & 7 deletions ci/docker/x86_64-unknown-linux-gnu/Dockerfile

This file was deleted.

4 changes: 2 additions & 2 deletions ci/dox.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#!/usr/bin/env bash

# Builds documentation for all target triples that we have a registered URL for
# in liblibc. This scrapes the list of triples to document from `src/lib.rs`
# in stdsimd. This scrapes the list of triples to document from `src/lib.rs`
# which has a bunch of `html_root_url` directives we pick up.

set -e
Expand Down
37 changes: 0 additions & 37 deletions ci/run-docker.sh

This file was deleted.

30 changes: 0 additions & 30 deletions ci/run.sh

This file was deleted.

5 changes: 5 additions & 0 deletions ci/windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

. ci/ci.sh
ci_install
ci_run
2 changes: 1 addition & 1 deletion coresimd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ is-it-maintained-open-issues = { repository = "BurntSushi/stdsimd" }
maintenance = { status = "experimental" }

[dev-dependencies]
cupid = "0.5.0"
cupid = { version = "0.5.0", features = [ "unstable" ] }
stdsimd-test = { version = "0.*", path = "../stdsimd-test" }

[features]
Expand Down
Loading