summaryrefslogtreecommitdiffstats
path: root/.travis.yml
blob: fd3a6f6e0acf5966fc62a2bc866a38f5693a19a9 (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
sudo: false
language: rust
rust:
    - beta
    - nightly
    - stable

matrix:
    allow_failures:
        - rust: nightly

before_install:
    - |
      c=$(git diff $TRAVIS_BRANCH..$TRAVIS_COMMIT --name-only | cut -d "/" -f 1 | uniq)
      if [[ "$c" == "doc" ]]; then
          echo "Only changes in DOC, exiting 0"
          exit 0
      else
        echo "Changes in other directories than ./doc"
        echo "continue build..."
      fi

before_script:
    - |
        pip install 'travis-cargo<0.2' --user &&
        export PATH=$HOME/.local/bin:$PATH

script:
    - |
        changes_in() {
            [[ $(git diff --name-only $TRAVIS_BRANCH..$TRAVIS_COMMIT | \
                cut -d "/" -f 1 | \
                grep "$n") ]] > /dev/null
        }

        travis_cargo_run_in() {
            [[ -d "$1" ]] &&
            cd "$1" &&
            {
              travis-cargo build &&
              travis-cargo test &&
              travis-cargo bench &&
              travis-cargo --only stable doc &&
              cd -
            } || exit 1
        }

        [[ $(changes_in "doc") ]] && echo "Changes in ./doc are not build by CI"

        for d in $(find -name "Cargo.toml" | grep -vE "^.$"); do
            dir=$(dirname $d)
            {
              changes_in $dir &&                  \
                  echo -e "\nRunning in $d\n" &&  \
                  travis_cargo_run_in $dir
            } || true
        done

addons:
    apt:
        packages:
            - libcurl4-openssl-dev
            - libelf-dev
            - libdw-dev

after_success:
    - travis-cargo --only stable doc-upload

notifications:
    email:
        on_success: never

env:
    global:
        - TRAVIS_CARGO_NIGHTLY_FEATURE=dev