Skip to content

Commit b6e859c

Browse files
committed
Add CI configuration
Some of these tests will fail for now!
1 parent ae1e2aa commit b6e859c

File tree

5 files changed

+277
-0
lines changed

5 files changed

+277
-0
lines changed

.travis.yml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
language: rust
2+
sudo: false
3+
4+
matrix:
5+
include:
6+
- rust: 1.28.0
7+
env: DESCRIPTION="Linux, 1.28.0"
8+
os: linux
9+
10+
- rust: 1.28.0
11+
env: DESCRIPTION="OSX, 1.22.0"
12+
os: osx
13+
14+
- rust: stable
15+
env: DESCRIPTION="Linux, stable"
16+
17+
- rust: stable
18+
env: DESCRIPTION="OSX+iOS, stable"
19+
os: osx
20+
install:
21+
- rustup target add aarch64-apple-ios
22+
23+
- rust: beta
24+
env: DESCRIPTION="Linux, beta"
25+
26+
- rust: nightly
27+
os: linux
28+
env: DESCRIPTION="Linux, nightly, docs"
29+
install:
30+
- cargo --list | egrep "^\s*deadlinks$" -q || cargo install cargo-deadlinks
31+
- cargo deadlinks -V
32+
before_script:
33+
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
34+
script:
35+
# Differs from standard script: alloc feature, all features, doc build
36+
- cargo test --lib --no-default-features --features=alloc
37+
- cargo test --all-features
38+
- cargo test --benches --features=nightly
39+
- cargo test --examples
40+
- cargo test --manifest-path rand_core/Cargo.toml
41+
- cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc
42+
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
43+
- cargo test --manifest-path rand_pcg/Cargo.toml --features=serde1
44+
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
45+
- cargo test --manifest-path rand_xoshiro/Cargo.toml
46+
- cargo test --manifest-path rand_chacha/Cargo.toml
47+
- cargo test --manifest-path rand_hc/Cargo.toml
48+
- cargo test --manifest-path rand_jitter/Cargo.toml
49+
- cargo test --manifest-path rand_os/Cargo.toml
50+
# remove cached documentation, otherwise files from previous PRs can get included
51+
- rm -rf target/doc
52+
- cargo doc --no-deps --all --all-features
53+
- cargo deadlinks --dir target/doc
54+
after_success:
55+
- travis-cargo --only nightly doc-upload
56+
57+
- rust: nightly
58+
os: osx
59+
env: DESCRIPTION="OSX, nightly, docs"
60+
install:
61+
- cargo --list | egrep "^\s*deadlinks$" -q || cargo install cargo-deadlinks
62+
- cargo deadlinks -V
63+
script:
64+
- cargo test
65+
- cargo test --benches
66+
- cargo test --examples
67+
# remove cached documentation, otherwise files from previous PRs can get included
68+
- rm -rf target/doc
69+
- cargo doc --no-deps --all --all-features
70+
- cargo deadlinks --dir target/doc
71+
72+
- rust: nightly
73+
env: DESCRIPTION="WASM via emscripten, stdweb and wasm-bindgen"
74+
install:
75+
- rustup target add wasm32-unknown-unknown
76+
- rustup target add wasm32-unknown-emscripten
77+
- nvm install 9
78+
- ./utils/ci/install_cargo_web.sh
79+
- cargo web prepare-emscripten
80+
- cargo web -V
81+
- cargo list | grep install-update || cargo install -f cargo-update
82+
- cargo install-update -i cargo-update wasm-bindgen-cli wasm-pack
83+
addons:
84+
chrome: stable
85+
script:
86+
# Testing wasm32-unknown-emscripten fails because of rust-lang/rust#49877
87+
# However, we can still build and link all tests to make sure that works.
88+
# This is actually useful as it finds stuff such as rust-random/rand#669
89+
- EMCC_CFLAGS="-s ERROR_ON_UNDEFINED_SYMBOLS=0" cargo web test --target wasm32-unknown-emscripten --no-run
90+
#- cargo web test --target wasm32-unknown-emscripten
91+
#- cargo web test --nodejs --target wasm32-unknown-emscripten
92+
#- cargo build --target wasm32-unknown-unknown # without any features
93+
- cargo build --target wasm32-unknown-unknown --features=wasm-bindgen
94+
- cargo web test --target wasm32-unknown-unknown --features=stdweb
95+
- cargo build --manifest-path tests/wasm_bindgen/Cargo.toml --target wasm32-unknown-unknown
96+
- wasm-bindgen --nodejs target/wasm32-unknown-unknown/debug/rand_wasm_bindgen_test.wasm --out-dir tests/wasm_bindgen/js
97+
- node tests/wasm_bindgen/js/index.js
98+
- wasm-pack test --node tests/wasm_bindgen
99+
100+
- rust: nightly
101+
env: DESCRIPTION="cross-platform build only"
102+
install:
103+
- rustup target add x86_64-sun-solaris
104+
- rustup target add x86_64-unknown-cloudabi
105+
- rustup target add x86_64-unknown-freebsd
106+
- rustup target add x86_64-unknown-fuchsia
107+
- rustup target add x86_64-unknown-netbsd
108+
- rustup target add x86_64-unknown-redox
109+
script:
110+
- cargo build --target=x86_64-sun-solaris --all-features
111+
- cargo build --target=x86_64-unknown-cloudabi --all-features
112+
- cargo build --target=x86_64-unknown-freebsd --all-features
113+
- cargo build --target=x86_64-unknown-fuchsia --all-features
114+
- cargo build --target=x86_64-unknown-netbsd --all-features
115+
- cargo build --target=x86_64-unknown-redox --all-features
116+
117+
# Trust cross-built/emulated targets. We must repeat all non-default values.
118+
- rust: stable
119+
sudo: required
120+
dist: trusty
121+
services: docker
122+
env: DESCRIPTION="Linux (MIPS, big-endian)" TARGET=mips-unknown-linux-gnu
123+
install:
124+
- sh utils/ci/install.sh
125+
- source ~/.cargo/env || true
126+
script:
127+
- bash utils/ci/script.sh
128+
129+
- rust: stable
130+
sudo: required
131+
dist: trusty
132+
services: docker
133+
env: DESCRIPTION="Android (ARMv7)" TARGET=armv7-linux-androideabi
134+
install:
135+
- sh utils/ci/install.sh
136+
- source ~/.cargo/env || true
137+
script:
138+
- bash utils/ci/script.sh
139+
140+
before_install:
141+
- set -e
142+
- rustup self update
143+
144+
script:
145+
- cargo test
146+
- cargo test --benches
147+
- cargo test --examples
148+
149+
after_script: set +e
150+
151+
cache:
152+
cargo: true
153+
directories:
154+
- .local/share/cargo-web
155+
156+
before_cache:
157+
# Travis can't cache files that are not readable by "others"
158+
- chmod -R a+r $HOME/.cargo
159+
160+
notifications:
161+
email:
162+
on_success: never

appveyor.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
environment:
2+
3+
# At the time this was added AppVeyor was having troubles with checking
4+
# revocation of SSL certificates of sites like static.rust-lang.org and what
5+
# we think is crates.io. The libcurl HTTP client by default checks for
6+
# revocation on Windows and according to a mailing list [1] this can be
7+
# disabled.
8+
#
9+
# The `CARGO_HTTP_CHECK_REVOKE` env var here tells cargo to disable SSL
10+
# revocation checking on Windows in libcurl. Note, though, that rustup, which
11+
# we're using to download Rust here, also uses libcurl as the default backend.
12+
# Unlike Cargo, however, rustup doesn't have a mechanism to disable revocation
13+
# checking. To get rustup working we set `RUSTUP_USE_HYPER` which forces it to
14+
# use the Hyper instead of libcurl backend. Both Hyper and libcurl use
15+
# schannel on Windows but it appears that Hyper configures it slightly
16+
# differently such that revocation checking isn't turned on by default.
17+
#
18+
# [1]: https://curl.haxx.se/mail/lib-2016-03/0202.html
19+
RUSTUP_USE_HYPER: 1
20+
CARGO_HTTP_CHECK_REVOKE: false
21+
22+
matrix:
23+
- TARGET: x86_64-pc-windows-msvc
24+
- TARGET: i686-pc-windows-msvc
25+
install:
26+
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
27+
- rustup-init.exe -y --default-host %TARGET% --default-toolchain nightly
28+
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
29+
- rustc -V
30+
- cargo -V
31+
32+
build: false
33+
34+
test_script:
35+
- cargo test
36+
- cargo test --benches
37+
- cargo test --examples

utils/ci/install.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# From https://github.com/japaric/trust
2+
3+
set -ex
4+
5+
main() {
6+
local target=
7+
if [ $TRAVIS_OS_NAME = linux ]; then
8+
target=x86_64-unknown-linux-musl
9+
sort=sort
10+
else
11+
target=x86_64-apple-darwin
12+
sort=gsort # for `sort --sort-version`, from brew's coreutils.
13+
fi
14+
15+
# Builds for iOS are done on OSX, but require the specific target to be
16+
# installed.
17+
case $TARGET in
18+
aarch64-apple-ios)
19+
rustup target install aarch64-apple-ios
20+
;;
21+
armv7-apple-ios)
22+
rustup target install armv7-apple-ios
23+
;;
24+
armv7s-apple-ios)
25+
rustup target install armv7s-apple-ios
26+
;;
27+
i386-apple-ios)
28+
rustup target install i386-apple-ios
29+
;;
30+
x86_64-apple-ios)
31+
rustup target install x86_64-apple-ios
32+
;;
33+
esac
34+
35+
# This fetches latest stable release
36+
local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \
37+
| cut -d/ -f3 \
38+
| grep -E '^v[0.1.0-9.]+$' \
39+
| $sort --version-sort \
40+
| tail -n1)
41+
curl -LSfs https://japaric.github.io/trust/install.sh | \
42+
sh -s -- \
43+
--force \
44+
--git japaric/cross \
45+
--tag $tag \
46+
--target $target
47+
}
48+
49+
main

utils/ci/install_cargo_web.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
IFS=$'\n\t'
5+
6+
CARGO_WEB_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/koute/cargo-web/releases/latest)
7+
CARGO_WEB_VERSION=$(echo $CARGO_WEB_RELEASE | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
8+
CARGO_WEB_URL="https://github.com/koute/cargo-web/releases/download/$CARGO_WEB_VERSION/cargo-web-x86_64-unknown-linux-gnu.gz"
9+
10+
echo "Downloading cargo-web from: $CARGO_WEB_URL"
11+
curl -L $CARGO_WEB_URL | gzip -d > cargo-web
12+
chmod +x cargo-web
13+
14+
mkdir -p ~/.cargo/bin
15+
mv cargo-web ~/.cargo/bin

utils/ci/script.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Derived from https://github.com/japaric/trust
2+
3+
set -ex
4+
5+
main() {
6+
- cross test --target $TARGET
7+
- cross test --target $TARGET --benches
8+
- cross test --target $TARGET --examples
9+
}
10+
11+
# we don't run the "test phase" when doing deploys
12+
if [ -z $TRAVIS_TAG ]; then
13+
main
14+
fi

0 commit comments

Comments
 (0)