summaryrefslogtreecommitdiff
path: root/rand/.travis.yml
blob: f3790dc080426a367a3e9073a2320cfccc0e3810 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
language: rust
sudo: false

# We support too many combinations of Rust releases, crate features, operating
# systems, and architectures to even remotely test all combinations.
# Yet it turns out we can test most of these independent of each other, because
# they serve different goals or test different pieces of code.
#
# RUST RELEASES
# Goal: make sure we don't use language features unavailable on a certain
#       version, and build without warnings.
# We have different builders use 4 Rust releases, a pinned stable release,
# the latest stable, beta and nightly.
#
# ARCHITECTURES
# Goal: test against issues caused by differences in endianness, pointer sizes,
#       etc.
# We run tests on 4 different architectures.
# - x64_84, default on Travis (Linux) and AppVeyor (Windows)
# - i686, second AppVeyor (Windows) configuration
# - MIPS, big-endian Linux emulated with QEMU (thanks to Trust)
# - ARMv7, Android emulated with QEMU (thanks to Trust)
#
# OPERATING SYSTEMS
# Goal: test on many operating systems, to verify the OsRng code, which is
#       mostly architecture-independent.
# We run tests on Linux, OS X, Windows, Android (emulated), and Node.js (using
# cargo-web).
# One builder cross-compiles for many of the remaining OSes, which ensures we
# keep building, but doesn't run tests.
# OSes supported by Rand but which we can't cross-compile because there
# is no pre-built standard library available: Dragonfly BSD, Haiku, OpenBSD.
#
# CRATE FEATURES, TESTS, AND SUB-CRATES
# Goal: Run unit tests, doctests, examples, and test benchmarks for all crates,
#       in configurations that cover all interesting combinations of features.
# Tests run on rand:
# - test no_std support, but only the unit tests:
#   `cargo test --tests --no-default-features`
# - test no_std support, including the alloc feature:
#   cargo test --tests --no-default-features --features=alloc
# - run unit tests and doctests with all features which are available on stable:
#   `cargo test --features=serde1,log`
# - test examples:
#   `cargo test --examples`
# Additional tests on nightly:
# - run unit tests and doctests with all features which are available on nightly:
#   `cargo test --all-features`
# - run benchmarks as tests:
#   `cargo test --benches --features=nightly`
# Tests on subcrates:
# - select crates via --manifest-path (more reliable than --package)
# - test appropriate feature matrix
#
# TODO: SIMD support on stable releases
# NOTE: SIMD support is unreliable on nightly; we track the latest release
# NOTE: Test for alloc feature in no_std is not included here because it depends
#       on the alloc crate stabilized in Rust 1.36.
matrix:
  include:
    - rust: 1.32.0
      env: DESCRIPTION="Linux, 1.32.0"
      os: linux
      script:
        # Differs from standard script: rand_pcg features
        - cargo test --tests --no-default-features
        # TODO: add simd_support feature:
        - cargo test --features=serde1,log
        - cargo test --examples
        - cargo test --manifest-path rand_core/Cargo.toml
        - cargo test --manifest-path rand_core/Cargo.toml --no-default-features
        - cargo test --manifest-path rand_distr/Cargo.toml
        - cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
        # TODO: cannot test rand_pcg due to explicit dependency on i128
        - 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

    - rust: 1.32.0
      env: DESCRIPTION="OSX, 1.32.0"
      os: osx
      script:
        # Differs from standard script: rand_pcg features
        - cargo test --tests --no-default-features
        # TODO: add simd_support feature:
        - cargo test --features=serde1,log
        - cargo test --examples
        - cargo test --manifest-path rand_core/Cargo.toml
        - cargo test --manifest-path rand_core/Cargo.toml --no-default-features
        - cargo test --manifest-path rand_distr/Cargo.toml
        - cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
        # TODO: cannot test rand_pcg due to explicit dependency on i128
        - 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

    - rust: stable
      env: DESCRIPTION="Linux, stable"

    - rust: stable
      env: DESCRIPTION="OSX+iOS, stable"
      os: osx
      install:
        - rustup target add aarch64-apple-ios
      script:
        # Differs from standard script: includes aarch64-apple-ios cross-build
        - cargo test --tests --no-default-features
        # TODO: add simd_support feature:
        - cargo test --features=serde1,log
        - cargo test --examples
        - cargo test --manifest-path rand_core/Cargo.toml
        - cargo test --manifest-path rand_core/Cargo.toml --no-default-features
        - cargo test --manifest-path rand_distr/Cargo.toml
        - 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
        - cargo build --target=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: all features, doc build
        - cargo test --tests --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_distr/Cargo.toml
        - 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:
        # Differs from standard script: all features, doc build
        - cargo test --tests --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_distr/Cargo.toml
        - 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

    - 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 builder (doesn't run tests)"
      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:
        # Test the top-level crate with all features:
        - 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
    - rust: nightly
      env: DESCRIPTION="no_std platform test"
      install:
        - rustup target add thumbv6m-none-eabi
      script:
        # Test the top-level crate with all features:
        - cargo build --target=thumbv6m-none-eabi --no-default-features

    - rust: nightly
      os: linux
      env: DESCRIPTION="Miri, nightly"
      script:
        - sh utils/ci/miri.sh

before_install:
  - set -e
  - rustup self update

script:
  - cargo test --tests --no-default-features
  - cargo test --tests --no-default-features --features getrandom
  - cargo test --tests --no-default-features --features=alloc
  # TODO: add simd_support feature:
  - cargo test --features=serde1,log
  - cargo test --examples
  - cargo test --manifest-path rand_core/Cargo.toml
  - cargo test --manifest-path rand_core/Cargo.toml --no-default-features
  - cargo test --manifest-path rand_core/Cargo.toml --no-default-features --features=alloc
  - cargo test --manifest-path rand_distr/Cargo.toml
  - 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

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

env:
  global:
    secure: "BdDntVHSompN+Qxz5Rz45VI4ZqhD72r6aPl166FADlnkIwS6N6FLWdqs51O7G5CpoMXEDvyYrjmRMZe/GYLIG9cmqmn/wUrWPO+PauGiIuG/D2dmfuUNvSTRcIe7UQLXrfP3yyfZPgqsH6pSnNEVopquQKy3KjzqepgriOJtbyY="

notifications:
  email:
    on_success: never