1language: rust
2# sudo is required to enable kcov to use the personality syscall
3sudo: required
4dist: trusty
5cache: cargo
6
7rust:
8  - nightly
9  - beta
10  - stable
11  - 1.31.0
12
13env:
14  matrix:
15    - FEATURES='--features "regexp regexp_macros"'
16
17before_script:
18  - eval git pull --rebase https://github.com/Geal/nom master
19  - eval git log --pretty=oneline HEAD~5..HEAD
20
21matrix:
22  include:
23    - rust: nightly
24      env: FEATURES='--no-default-features'
25    - rust: nightly
26      env: FEATURES='--no-default-features --features "alloc"'
27    - rust: stable
28      env: FEATURES=''
29    - rust: nightly
30      env: DOC_FEATURES='--features "std lexical regexp regexp_macros" --no-default-features'
31      before_script:
32        - export PATH=$HOME/.cargo/bin:$PATH
33      script:
34        - eval cargo doc --verbose $DOC_FEATURES
35    - rust: nightly
36      env: FEATURES=''
37      before_script:
38        - export PATH=$HOME/.cargo/bin:$PATH
39        - cargo install cargo-update   || echo "cargo-update already installed"
40        - cargo install cargo-travis   || echo "cargo-travis already installed"
41        - cargo install-update -a
42        - mkdir -p target/kcov-master
43      script:
44        cargo coveralls --verbose --all-features
45  allow_failures:
46    - rust: stable
47      env: FEATURES=''
48      before_script:
49        - export PATH=$HOME/.cargo/bin:$PATH
50        - rustup component add rustfmt-preview
51      script:
52        - eval cargo fmt -- --write-mode=diff
53
54notifications:
55  webhooks:
56    urls:
57      - https://webhooks.gitter.im/e/9c035a194ac4fd4cc061
58    on_success: change
59    on_failure: always
60    on_start: false
61
62
63addons:
64  apt:
65    packages:
66      - libcurl4-openssl-dev
67      - libelf-dev
68      - libdw-dev
69      - binutils-dev
70      - cmake
71    sources:
72      - kalakris-cmake
73
74cache:
75  directories:
76    - /home/travis/.cargo
77
78before_cache:
79  - rm -rf /home/travis/.cargo/registry
80
81script:
82  - eval cargo build --verbose $FEATURES
83  - eval cargo test --verbose $FEATURES
84
85after_success: |
86  case "$TRAVIS_RUST_VERSION" in
87    nightly)
88      if [ "${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}" != "master" ]; then
89        git fetch &&
90        git checkout master &&
91        cargo bench --verbose
92      fi
93
94      if [ "$FEATURES" == '--features "regexp regexp_macros"' ]; then
95        cargo bench --verbose
96      fi
97      ;;
98
99    *)
100      ;;
101  esac
102