Merge remote-tracking branch 'isis/bug25185'
[tor.git] / .travis.yml
blob6c6e1ace2bd318356102816f612ca242de0b4529
1 language: c
3 ## Comment out the compiler list for now to allow an explicit build
4 ## matrix.
5 # compiler:
6 #   - gcc
7 #   - clang
9 notifications:
10   irc:
11     channels:
12       - "irc.oftc.net#tor-ci"
13     template:
14       - "%{repository} %{branch} %{commit} - %{author}: %{commit_subject}"
15       - "Build #%{build_number} %{result}. Details: %{build_url}"
16     on_success: change
17     on_failure: change
18   email:
19     on_success: never
20     on_failure: change
22 os:
23   - linux
24   ## Uncomment the following line to also run the entire build matrix on OSX.
25   ## This will make your CI builds take roughly ten times longer to finish.
26   # - osx
28 ## Use the Ubuntu Trusty images.
29 dist: trusty
31 ## We don't need sudo. (The "apt:" stanza after this allows us to not need sudo;
32 ## otherwise, we would need it for getting dependencies.)
34 ## We override this in the explicit build matrix to work around a
35 ## Travis CI environment regression
36 ## https://github.com/travis-ci/travis-ci/issues/9033
37 sudo: false
39 ## (Linux only) Download our dependencies
40 addons:
41   apt:
42     packages:
43       ## Required dependencies
44       - libevent-dev
45       - libseccomp2
46       - zlib1g-dev
47       ## Optional dependencies
48       - liblzma-dev
49       - libscrypt-dev
50       ## zstd doesn't exist in Ubuntu Trusty
51       #- libzstd
53 ## The build matrix in the following two stanzas expands into four builds (per OS):
55 ##  * with GCC, with Rust
56 ##  * with GCC, without Rust
57 ##  * with Clang, with Rust
58 ##  * with Clang, without Rust
59 env:
60   global:
61     ## The Travis CI environment allows us two cores, so let's use both.
62     - MAKEFLAGS="-j 2"
63   matrix:
64     ## Leave at least one entry here or Travis seems to generate a
65     ## matrix entry with empty matrix environment variables.  Leaving
66     ## more than one entry causes unwanted matrix entries with
67     ## unspecified compilers.
68     - RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
69     # - RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
70     # - RUST_OPTIONS=""
72 matrix:
73   ## If one build in the matrix fails (e.g. if building withour Rust and Clang
74   ## fails, but building with Rust and GCC is still going), then cancel the
75   ## entire job early and call the whole thing a failure.
76   fast_finish: true
78   ## Create explicit matrix entries to work around a Travis CI
79   ## environment issue.  Missing keys inherit from the first list
80   ## entry under that key outside the "include" clause.
81   include:
82     - compiler: gcc
83     - compiler: gcc
84       env: RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
85     - compiler: gcc
86       env: RUST_OPTIONS=""
87     ## The "sudo: required" forces non-containerized builds, working
88     ## around a Travis CI environment issue: clang LeakAnalyzer fails
89     ## because it requires ptrace and the containerized environment no
90     ## longer allows ptrace.
91     - compiler: clang
92       sudo: required
93     - compiler: clang
94       sudo: required
95       env: RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
96     - compiler: clang
97       sudo: required
98       env: RUST_OPTIONS=""
100 before_install:
101   ## If we're on OSX, homebrew usually needs to updated first
102   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
103   ## Download rustup
104   - if [[ "$RUST_OPTIONS" != "" ]]; then curl -Ssf -o rustup.sh https://sh.rustup.rs; fi
106 install:
107   ## If we're on OSX use brew to install required dependencies (for Linux, see the "apt:" section above)
108   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl    || brew upgrade openssl;    }; fi
109   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libevent   || brew upgrade libevent;   }; fi
110   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated pkg-config || brew upgrade pkg-config; }; fi
111   ## If we're on OSX also install the optional dependencies
112   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated xz         || brew upgrade xz;         }; fi
113   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libscrypt  || brew upgrade libscrypt;  }; fi
114   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated zstd       || brew upgrade zstd;       }; fi
115   ## Install the nightly channels of rustc and cargo and setup our toolchain environment
116   - if [[ "$RUST_OPTIONS" != "" ]]; then sh rustup.sh -y --default-toolchain nightly; fi
117   - if [[ "$RUST_OPTIONS" != "" ]]; then source $HOME/.cargo/env; fi
118   ## Get some info about rustc and cargo
119   - if [[ "$RUST_OPTIONS" != "" ]]; then which rustc; fi
120   - if [[ "$RUST_OPTIONS" != "" ]]; then which cargo; fi
121   - if [[ "$RUST_OPTIONS" != "" ]]; then rustc --version; fi
122   - if [[ "$RUST_OPTIONS" != "" ]]; then cargo --version; fi
123   ## If we're testing rust builds in offline-mode, then set up our vendored dependencies
124   - if [[ "$RUST_OPTIONS" == "--enable-rust" ]]; then git submodule init  ; fi
125   - if [[ "$RUST_OPTIONS" == "--enable-rust" ]]; then git submodule update; fi
126   - if [[ "$TOR_RUST_DEPENDENCIES" == "true" ]]; then export TOR_RUST_DEPENDENCIES=$PWD/src/ext/rust/crates; fi
128 script:
129   - ./autogen.sh
130   - ./configure $RUST_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules --enable-fragile-hardening
131   ## We run `make check` because that's what https://jenkins.torproject.org does.
132   - make check
134 after_failure:
135   ## `make check` will leave a log file with more details of test failures.
136   - cat test-suite.log