Add CI configuration

Some of these tests will fail for now!
This commit is contained in:
Diggory Hardy 2019-02-25 10:35:19 +00:00
parent ae1e2aab25
commit b6e859cf0f
5 changed files with 277 additions and 0 deletions

162
.travis.yml Normal file
View File

@ -0,0 +1,162 @@
language: rust
sudo: false
matrix:
include:
- rust: 1.28.0
env: DESCRIPTION="Linux, 1.28.0"
os: linux
- rust: 1.28.0
env: DESCRIPTION="OSX, 1.22.0"
os: osx
- rust: stable
env: DESCRIPTION="Linux, stable"
- rust: stable
env: DESCRIPTION="OSX+iOS, stable"
os: osx
install:
- rustup target add aarch64-apple-ios
- rust: beta
env: DESCRIPTION="Linux, beta"
- rust: nightly
os: linux
env: DESCRIPTION="Linux, nightly, docs"
install:
- cargo --list | egrep "^\s*deadlinks$" -q || cargo install cargo-deadlinks
- cargo deadlinks -V
before_script:
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
script:
# Differs from standard script: alloc feature, all features, doc build
- cargo test --lib --no-default-features --features=alloc
- cargo test --all-features
- cargo test --benches --features=nightly
- cargo test --examples
- cargo test --manifest-path rand_core/Cargo.toml
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xoshiro/Cargo.toml
- cargo test --manifest-path rand_chacha/Cargo.toml
- cargo test --manifest-path rand_hc/Cargo.toml
- cargo test --manifest-path rand_jitter/Cargo.toml
- cargo test --manifest-path rand_os/Cargo.toml
# remove cached documentation, otherwise files from previous PRs can get included
- rm -rf target/doc
- cargo doc --no-deps --all --all-features
- cargo deadlinks --dir target/doc
after_success:
- travis-cargo --only nightly doc-upload
- rust: nightly
os: osx
env: DESCRIPTION="OSX, nightly, docs"
install:
- cargo --list | egrep "^\s*deadlinks$" -q || cargo install cargo-deadlinks
- cargo deadlinks -V
script:
- cargo test
- cargo test --benches
- cargo test --examples
# remove cached documentation, otherwise files from previous PRs can get included
- rm -rf target/doc
- cargo doc --no-deps --all --all-features
- cargo deadlinks --dir target/doc
- rust: nightly
env: DESCRIPTION="WASM via emscripten, stdweb and wasm-bindgen"
install:
- rustup target add wasm32-unknown-unknown
- rustup target add wasm32-unknown-emscripten
- nvm install 9
- ./utils/ci/install_cargo_web.sh
- cargo web prepare-emscripten
- cargo web -V
- cargo list | grep install-update || cargo install -f cargo-update
- cargo install-update -i cargo-update wasm-bindgen-cli wasm-pack
addons:
chrome: stable
script:
# Testing wasm32-unknown-emscripten fails because of rust-lang/rust#49877
# However, we can still build and link all tests to make sure that works.
# This is actually useful as it finds stuff such as rust-random/rand#669
- EMCC_CFLAGS="-s ERROR_ON_UNDEFINED_SYMBOLS=0" cargo web test --target wasm32-unknown-emscripten --no-run
#- cargo web test --target wasm32-unknown-emscripten
#- cargo web test --nodejs --target wasm32-unknown-emscripten
#- cargo build --target wasm32-unknown-unknown # without any features
- cargo build --target wasm32-unknown-unknown --features=wasm-bindgen
- cargo web test --target wasm32-unknown-unknown --features=stdweb
- cargo build --manifest-path tests/wasm_bindgen/Cargo.toml --target wasm32-unknown-unknown
- wasm-bindgen --nodejs target/wasm32-unknown-unknown/debug/rand_wasm_bindgen_test.wasm --out-dir tests/wasm_bindgen/js
- node tests/wasm_bindgen/js/index.js
- wasm-pack test --node tests/wasm_bindgen
- rust: nightly
env: DESCRIPTION="cross-platform build only"
install:
- rustup target add x86_64-sun-solaris
- rustup target add x86_64-unknown-cloudabi
- rustup target add x86_64-unknown-freebsd
- rustup target add x86_64-unknown-fuchsia
- rustup target add x86_64-unknown-netbsd
- rustup target add x86_64-unknown-redox
script:
- cargo build --target=x86_64-sun-solaris --all-features
- cargo build --target=x86_64-unknown-cloudabi --all-features
- cargo build --target=x86_64-unknown-freebsd --all-features
- cargo build --target=x86_64-unknown-fuchsia --all-features
- cargo build --target=x86_64-unknown-netbsd --all-features
- cargo build --target=x86_64-unknown-redox --all-features
# Trust cross-built/emulated targets. We must repeat all non-default values.
- rust: stable
sudo: required
dist: trusty
services: docker
env: DESCRIPTION="Linux (MIPS, big-endian)" TARGET=mips-unknown-linux-gnu
install:
- sh utils/ci/install.sh
- source ~/.cargo/env || true
script:
- bash utils/ci/script.sh
- rust: stable
sudo: required
dist: trusty
services: docker
env: DESCRIPTION="Android (ARMv7)" TARGET=armv7-linux-androideabi
install:
- sh utils/ci/install.sh
- source ~/.cargo/env || true
script:
- bash utils/ci/script.sh
before_install:
- set -e
- rustup self update
script:
- cargo test
- cargo test --benches
- cargo test --examples
after_script: set +e
cache:
cargo: true
directories:
- .local/share/cargo-web
before_cache:
# Travis can't cache files that are not readable by "others"
- chmod -R a+r $HOME/.cargo
notifications:
email:
on_success: never

37
appveyor.yml Normal file
View File

@ -0,0 +1,37 @@
environment:
# At the time this was added AppVeyor was having troubles with checking
# revocation of SSL certificates of sites like static.rust-lang.org and what
# we think is crates.io. The libcurl HTTP client by default checks for
# revocation on Windows and according to a mailing list [1] this can be
# disabled.
#
# The `CARGO_HTTP_CHECK_REVOKE` env var here tells cargo to disable SSL
# revocation checking on Windows in libcurl. Note, though, that rustup, which
# we're using to download Rust here, also uses libcurl as the default backend.
# Unlike Cargo, however, rustup doesn't have a mechanism to disable revocation
# checking. To get rustup working we set `RUSTUP_USE_HYPER` which forces it to
# use the Hyper instead of libcurl backend. Both Hyper and libcurl use
# schannel on Windows but it appears that Hyper configures it slightly
# differently such that revocation checking isn't turned on by default.
#
# [1]: https://curl.haxx.se/mail/lib-2016-03/0202.html
RUSTUP_USE_HYPER: 1
CARGO_HTTP_CHECK_REVOKE: false
matrix:
- TARGET: x86_64-pc-windows-msvc
- TARGET: i686-pc-windows-msvc
install:
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init.exe -y --default-host %TARGET% --default-toolchain nightly
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- rustc -V
- cargo -V
build: false
test_script:
- cargo test
- cargo test --benches
- cargo test --examples

49
utils/ci/install.sh Normal file
View File

@ -0,0 +1,49 @@
# From https://github.com/japaric/trust
set -ex
main() {
local target=
if [ $TRAVIS_OS_NAME = linux ]; then
target=x86_64-unknown-linux-musl
sort=sort
else
target=x86_64-apple-darwin
sort=gsort # for `sort --sort-version`, from brew's coreutils.
fi
# Builds for iOS are done on OSX, but require the specific target to be
# installed.
case $TARGET in
aarch64-apple-ios)
rustup target install aarch64-apple-ios
;;
armv7-apple-ios)
rustup target install armv7-apple-ios
;;
armv7s-apple-ios)
rustup target install armv7s-apple-ios
;;
i386-apple-ios)
rustup target install i386-apple-ios
;;
x86_64-apple-ios)
rustup target install x86_64-apple-ios
;;
esac
# This fetches latest stable release
local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \
| cut -d/ -f3 \
| grep -E '^v[0.1.0-9.]+$' \
| $sort --version-sort \
| tail -n1)
curl -LSfs https://japaric.github.io/trust/install.sh | \
sh -s -- \
--force \
--git japaric/cross \
--tag $tag \
--target $target
}
main

15
utils/ci/install_cargo_web.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
CARGO_WEB_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/koute/cargo-web/releases/latest)
CARGO_WEB_VERSION=$(echo $CARGO_WEB_RELEASE | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
CARGO_WEB_URL="https://github.com/koute/cargo-web/releases/download/$CARGO_WEB_VERSION/cargo-web-x86_64-unknown-linux-gnu.gz"
echo "Downloading cargo-web from: $CARGO_WEB_URL"
curl -L $CARGO_WEB_URL | gzip -d > cargo-web
chmod +x cargo-web
mkdir -p ~/.cargo/bin
mv cargo-web ~/.cargo/bin

14
utils/ci/script.sh Normal file
View File

@ -0,0 +1,14 @@
# Derived from https://github.com/japaric/trust
set -ex
main() {
- cross test --target $TARGET
- cross test --target $TARGET --benches
- cross test --target $TARGET --examples
}
# we don't run the "test phase" when doing deploys
if [ -z $TRAVIS_TAG ]; then
main
fi