Bump to 0.3.3.10-dev.
[tor.git] / .travis.yml
blob2368a38d01fbb3135bc9dd129d1a42b213291f23
1 language: c
3 cache:
4   ccache: true
5   ## cargo: true
6   directories:
7     - $HOME/.cargo
8     ## where we point CARGO_TARGET_DIR in all our cargo invocations
9     - $TRAVIS_BUILD_DIR/src/rust/target
11 compiler:
12   - gcc
13   - clang
15 os:
16   - linux
17   - osx
19 ## The build matrix in the following stanza expands into builds for each
20 ## OS and compiler.
21 env:
22   global:
23     ## The Travis CI environment allows us two cores, so let's use both.
24     - MAKEFLAGS="-j 2"
25     ## We turn on hardening by default
26     ## Also known as --enable-fragile-hardening in 0.3.0.3-alpha and later
27     - HARDENING_OPTIONS="--enable-expensive-hardening"
28     ## We turn off asciidoc by default, because it's slow
29     - ASCIIDOC_OPTIONS="--disable-asciidoc"
30   matrix:
31     ## We want to use each build option at least once
32     ##
33     ## We don't list default variable values, because we set the defaults
34     ## in global (or the default is unset)
35     -
36     ## We turn off hardening for Rust builds, because they are incompatible,
37     ## and it's going to take a while for them to be fixed. See:
38     ##   https:/trac.torproject.org/projects/tor/ticket/25386
39     ##   https:/trac.torproject.org/projects/tor/ticket/26398
40     - RUST_OPTIONS="--enable-rust --enable-cargo-online-mode" HARDENING_OPTIONS=""
42 matrix:
43   ## include creates builds with gcc, linux, sudo: false
44   include:
45     ## We include a single coverage build with the best options for coverage
46     - env: COVERAGE_OPTIONS="--enable-coverage" HARDENING_OPTIONS=""
47     ## We only want to check these build option combinations once
48     ## (they shouldn't vary by compiler or OS)
49     ## We run rust and coverage with hardening off, which seems like enough
50     # - env: HARDENING_OPTIONS=""
51     ## We check asciidoc with distcheck, to make sure we remove doc products
52     - env: DISTCHECK="yes" ASCIIDOC_OPTIONS=""
53     ## Check rust offline with distcheck, to make sure we remove rust products
54     ## But without hardening (see above)
55     - env: DISTCHECK="yes" RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true HARDENING_OPTIONS=""
57   ## Uncomment to allow the build to report success (with non-required
58   ## sub-builds continuing to run) if all required sub-builds have
59   ## succeeded.  This is somewhat buggy currently: it can cause
60   ## duplicate notifications and prematurely report success if a
61   ## single sub-build has succeeded.  See
62   ## https://github.com/travis-ci/travis-ci/issues/1696
63   # fast_finish: true
65   ## Careful! We use global envs, which makes it hard to exclude or
66   ## allow failures by env:
67   ## https://docs.travis-ci.com/user/customizing-the-build#matching-jobs-with-allow_failures
68   exclude:
69     ## Clang doesn't work in containerized builds, see below.
70     - compiler: clang
71       sudo: false
72     ## We also exclude non-containerized gcc, because they're slow and redundant.
73     - compiler: gcc
74       sudo: required
76 ## We don't need sudo. (The "apt:" stanza after this allows us to not need
77 ## sudo; otherwise, we would need it for getting dependencies.)
79 ## But we use "sudo: required" to force non-containerized builds, working
80 ## around a Travis CI environment issue: clang LeakAnalyzer fails
81 ## because it requires ptrace and the containerized environment no
82 ## longer allows ptrace.
83 ## https://github.com/travis-ci/travis-ci/issues/9033
85 ## In the matrix above, we exclude redundant combinations.
86 sudo:
87   - false
88   - required
90 ## (Linux only) Use the latest Linux image (Ubuntu Trusty)
91 dist: trusty
93 ## (Linux only) Download our dependencies
94 addons:
95   apt:
96     packages:
97       ## Required dependencies
98       - libevent-dev
99       - zlib1g-dev
100       ## Optional dependencies
101       - libcap-dev
102       - liblzma-dev
103       - libscrypt-dev
104       - libseccomp-dev
105       ## zstd doesn't exist in Ubuntu Trusty
106       #- libzstd
107       ## Conditional dependencies
108       ## Always installed, so we don't need sudo
109       - asciidoc
110       - docbook-xsl
111       - docbook-xml
112       - xmlto
114 ## (OSX only) Use the default OSX image
115 ## See https://docs.travis-ci.com/user/reference/osx#os-x-version
116 ## Default is Xcode 9.4 on macOS 10.13 as of August 2018
117 #osx_image: xcode9.4
119 before_install:
120   ## If we're on OSX, homebrew usually needs to be updated first
121   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
122   ## We might be upgrading some useless packages, but that's better than missing an upgrade
123   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade; fi
124   ## Create empty rust directories for non-Rust builds, so caching succeeds
125   - if [[ "$RUST_OPTIONS" == "" ]]; then mkdir -p $HOME/.cargo $TRAVIS_BUILD_DIR/src/rust/target; fi
127 install:
128   ## If we're on OSX use brew to install ccache (ccache is automatically installed on Linux)
129   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ccache; fi
130   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
131   ## If we're on OSX use brew to install required dependencies (for Linux, see the "apt:" section above)
132   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install libevent; fi
133   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install openssl; fi
134   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install pkg-config; fi
135   ## macOS comes with zlib by default, so the homebrew install is keg-only
136   # - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install zlib; fi
137   ## If we're on OSX also install the optional dependencies
138   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install libscrypt; fi
139   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install xz; fi
140   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install zstd; fi
141   ## If we're on OSX, OpenSSL is keg-only, so tor 0.2.9 and later need to be configured --with-openssl-dir= to build
142   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then OPENSSL_OPTIONS=--with-openssl-dir=`brew --prefix openssl`; fi
143   ## Install conditional features
144   ## Install coveralls
145   - if [[ "$COVERAGE_OPTIONS" != "" ]]; then pip install --user cpp-coveralls; fi
146   ## If we're on OSX, and using asciidoc, install asciidoc
147   - if [[ "$ASCIIDOC_OPTIONS" == "" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install asciidoc; fi
148   - if [[ "$ASCIIDOC_OPTIONS" == "" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install xmlto; fi
149   - if [[ "$ASCIIDOC_OPTIONS" == "" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"; fi
150   ## If we're using Rust, download rustup
151   - if [[ "$RUST_OPTIONS" != "" ]]; then curl -Ssf -o rustup.sh https://sh.rustup.rs; fi
152   ## Install the stable channels of rustc and cargo and setup our toolchain environment
153   - if [[ "$RUST_OPTIONS" != "" ]]; then sh rustup.sh -y --default-toolchain stable; fi
154   - if [[ "$RUST_OPTIONS" != "" ]]; then source $HOME/.cargo/env; fi
155   ## If we're testing rust builds in offline-mode, then set up our vendored dependencies
156   - if [[ "$TOR_RUST_DEPENDENCIES" == "true" ]]; then export TOR_RUST_DEPENDENCIES=$PWD/src/ext/rust/crates; fi
157   ##
158   ## Finally, list installed package versions
159   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then dpkg-query --show; fi
160   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list --versions; fi
161   ## Get some info about rustup, rustc and cargo
162   - if [[ "$RUST_OPTIONS" != "" ]]; then which rustup; fi
163   - if [[ "$RUST_OPTIONS" != "" ]]; then which rustc; fi
164   - if [[ "$RUST_OPTIONS" != "" ]]; then which cargo; fi
165   - if [[ "$RUST_OPTIONS" != "" ]]; then rustup --version; fi
166   - if [[ "$RUST_OPTIONS" != "" ]]; then rustc --version; fi
167   - if [[ "$RUST_OPTIONS" != "" ]]; then cargo --version; fi
169 script:
170   - ./autogen.sh
171   - CONFIGURE_FLAGS="$ASCIIDOC_OPTIONS $COVERAGE_OPTIONS $HARDENING_OPTIONS $OPENSSL_OPTIONS $RUST_OPTIONS --enable-fatal-warnings --disable-silent-rules"
172   - echo "Configure flags are $CONFIGURE_FLAGS"
173   - ./configure $CONFIGURE_FLAGS
174   ## We run `make check` because that's what https://jenkins.torproject.org does.
175   - if [[ "$DISTCHECK" == "" ]]; then make check; fi
176   - if [[ "$DISTCHECK" != "" ]]; then make distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS"; fi
178 after_failure:
179   ## configure will leave a log file with more details of config failures.
180   ## But the log is too long for travis' rendered view, so tail it.
181   - tail -1000 config.log || echo "tail failed"
182   ## `make check` will leave a log file with more details of test failures.
183   - if [[ "$DISTCHECK" == "" ]]; then cat test-suite.log || echo "cat failed"; fi
184   ## `make distcheck` puts it somewhere different.
185   - if [[ "$DISTCHECK" != "" ]]; then make show-distdir-testlog || echo "make failed"; fi
187 after_success:
188   ## If this build was one that produced coverage, upload it.
189   - if [[ "$COVERAGE_OPTIONS" != "" ]]; then coveralls -b . --exclude src/test --exclude src/trunnel --gcov-options '\-p'; fi
191 notifications:
192   irc:
193     channels:
194       - "irc.oftc.net#tor-ci"
195     template:
196       - "%{repository} %{branch} %{commit} - %{author}: %{commit_subject}"
197       - "Build #%{build_number} %{result}. Details: %{build_url}"
198     on_success: change
199     on_failure: change
200   email:
201     on_success: never
202     on_failure: change