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