1---
2language: rust
3dist: trusty
4sudo: required
5
6matrix:
7  include:
8    - rust: 1.34.0
9    # cfg(doctest) is experimental in 1.39 but ignored with 1.34.0, and that snuck in when 1.39.0 wasn't tested
10    - rust: 1.39.0
11    - rust: stable
12    - rust: beta
13    - rust: nightly
14      addons:
15        apt:
16          packages:
17            # cargo-tarpaulin needs this
18            - libssl-dev
19      install:
20        # For test coverage. In install step so that it can use cache.
21        - cargo tarpaulin --version || RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install --force cargo-tarpaulin
22        - cargo +nightly install cargo-fuzz
23
24    # no_std
25    - rust: stable
26      env: TARGET="--target thumbv6m-none-eabi" FEATURES="--no-default-features --features alloc"
27      install:
28        - rustup target add thumbv6m-none-eabi
29
30cache: cargo
31
32env:
33  # prevent cargo fuzz list from printing with color
34  - TERM=dumb
35
36script:
37  - cargo build --verbose $TARGET --no-default-features
38  - cargo build --verbose $TARGET $FEATURES
39  - 'if [[ -z "$TARGET" ]]; then cargo test --verbose; fi'
40  - 'if [[ -z "$TARGET" ]]; then cargo doc --verbose; fi'
41  - 'if [[ "$TRAVIS_RUST_VERSION" = nightly ]]; then cargo bench --no-run; fi'
42  # run for just a second to confirm that it can build and run ok
43  - 'if [[ "$TRAVIS_RUST_VERSION" = nightly ]]; then cargo fuzz list | xargs -L 1 -I FUZZER cargo fuzz run FUZZER -- -max_total_time=1; fi'
44
45after_success: |
46  if [[ "$TRAVIS_RUST_VERSION" = nightly ]]; then
47    # Calculate test coverage
48    cargo tarpaulin --out Xml
49    bash <(curl -s https://codecov.io/bash)
50  fi
51