Adjust log callback type to use log_domain_mask_t
[tor.git] / .travis.yml
blob5d5d95f6b38d19130de938c62be88d23cdb3c1e1
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     ## TOR_RUST_DEPENDENCIES is spelt RUST_DEPENDENCIES in 0.3.2
39     - RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
41 matrix:
42   ## include creates builds with gcc, linux
43   include:
44     ## We include a single coverage build with the best options for coverage
45     - env: COVERAGE_OPTIONS="--enable-coverage" HARDENING_OPTIONS="" TOR_TEST_RNG_SEED="636f766572616765"
46     ## We only want to check these build option combinations once
47     ## (they shouldn't vary by compiler or OS)
48     ## We run rust and coverage with hardening off, which seems like enough
49     # - env: HARDENING_OPTIONS=""
50     ## We check asciidoc with distcheck, to make sure we remove doc products
51     - env: DISTCHECK="yes" ASCIIDOC_OPTIONS=""
52     # We clone our stem repo and run `make test-stem`
53     - env: TEST_STEM="yes"
54     ## Check rust online with distcheck, to make sure we remove rust products
55     - env: DISTCHECK="yes" RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
56     ## Check disable module dirauth with and without rust
57     - env: MODULES_OPTIONS="--disable-module-dirauth" RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
58     - env: MODULES_OPTIONS="--disable-module-dirauth"
59     ## Check NSS
60     - env: NSS_OPTIONS="--enable-nss"
62   ## Uncomment to allow the build to report success (with non-required
63   ## sub-builds continuing to run) if all required sub-builds have
64   ## succeeded.  This is somewhat buggy currently: it can cause
65   ## duplicate notifications and prematurely report success if a
66   ## single sub-build has succeeded.  See
67   ## https://github.com/travis-ci/travis-ci/issues/1696
68   # fast_finish: true
70   ## Careful! We use global envs, which makes it hard to exclude or
71   ## allow failures by env:
72   ## https://docs.travis-ci.com/user/customizing-the-build#matching-jobs-with-allow_failures
73   allow_failures:
74     ## test-stem sometimes hangs on Travis
75     - env: TEST_STEM="yes"
77   exclude:
78     ## gcc on OSX is less useful, because the default compiler is clang.
79     - compiler: gcc
80       os: osx
81     ## gcc on Linux with no env is redundant, because all the custom builds use
82     ## gcc on Linux
83     - compiler: gcc
84       os: linux
85       env:
86     ## offline rust builds for gcc on Linux are redundant, because we do an
87     ## online rust build for gcc on Linux
88     - compiler: gcc
89       os: linux
90       ## TOR_RUST_DEPENDENCIES is spelt RUST_DEPENDENCIES in 0.3.2
91       env: RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true HARDENING_OPTIONS=""
93 ## (Linux only) Use the latest Linux image (Ubuntu Trusty)
94 dist: trusty
96 ## Download our dependencies
97 addons:
98   ## (Linux only)
99   apt:
100     packages:
101       ## Required dependencies
102       - libevent-dev
103       ## Ubuntu comes with OpenSSL by default
104       #- libssl-dev
105       - zlib1g-dev
106       ## Optional dependencies
107       - libcap-dev
108       - liblzma-dev
109       - libnss3-dev
110       - libscrypt-dev
111       - libseccomp-dev
112       ## zstd doesn't exist in Ubuntu Trusty
113       #- libzstd
114       - shellcheck
115       ## Conditional build dependencies
116       ## Always installed, so we don't need sudo
117       - asciidoc
118       - docbook-xsl
119       - docbook-xml
120       - xmlto
121       ## Utilities
122       ## preventing or diagnosing hangs
123       - timelimit
124   ## (OSX only)
125   homebrew:
126     packages:
127       ## Required dependencies
128       - libevent
129       ## The OSX version of OpenSSL is way too old
130       - openssl
131       ## OSX comes with zlib by default
132       ## to use a newer zlib, pass the keg path to configure (like OpenSSL)
133       #- zlib
134       ## Optional dependencies
135       - libscrypt
136       - xz
137       - zstd
138       ## Required build dependencies
139       ## Tor needs pkg-config to find some dependencies at build time
140       - pkg-config
141       ## Optional build dependencies
142       - ccache
143       - shellcheck
144       ## Conditional build dependencies
145       ## Always installed, because manual brew installs are hard to get right
146       - asciidoc
147       - xmlto
148       ## Utilities
149       ## preventing or diagnosing hangs
150       - timelimit
152 ## (OSX only) Use the default OSX image
153 ## See https://docs.travis-ci.com/user/reference/osx#os-x-version
154 ## Default is Xcode 9.4 on macOS 10.13 as of August 2018
155 #osx_image: xcode9.4
157 before_install:
158   ## Create empty rust directories for non-Rust builds, so caching succeeds
159   - if [[ "$RUST_OPTIONS" == "" ]]; then mkdir -p $HOME/.cargo $TRAVIS_BUILD_DIR/src/rust/target; fi
161 install:
162   ## If we're on OSX, configure ccache (ccache is automatically installed and configured on Linux)
163   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
164   ## 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
165   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then OPENSSL_OPTIONS=--with-openssl-dir=`brew --prefix openssl`; fi
166   ## Install conditional features
167   ## Install coveralls
168   - if [[ "$COVERAGE_OPTIONS" != "" ]]; then pip install --user cpp-coveralls; fi
169   ## If we're on OSX, and using asciidoc, configure asciidoc
170   - if [[ "$ASCIIDOC_OPTIONS" == "" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"; fi
171   ## If we're using Rust, download rustup
172   - if [[ "$RUST_OPTIONS" != "" ]]; then curl -Ssf -o rustup.sh https://sh.rustup.rs; fi
173   ## Install the nightly channels of rustc and cargo and setup our toolchain environment
174   - if [[ "$RUST_OPTIONS" != "" ]]; then sh rustup.sh -y --default-toolchain nightly; fi
175   - if [[ "$RUST_OPTIONS" != "" ]]; then source $HOME/.cargo/env; fi
176   ## If we're testing rust builds in offline-mode, then set up our vendored dependencies
177   - if [[ "$TOR_RUST_DEPENDENCIES" == "true" ]]; then export TOR_RUST_DEPENDENCIES=$PWD/src/ext/rust/crates; fi
178   - if [[ "$TEST_STEM" != "" ]]; then git clone --depth 1 https://github.com/torproject/stem.git ; export STEM_SOURCE_DIR=`pwd`/stem; fi
179   ##
180   ## Finally, list installed package versions
181   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then dpkg-query --show; fi
182   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list --versions; fi
183   ## Get some info about rustup, rustc and cargo
184   - if [[ "$RUST_OPTIONS" != "" ]]; then which rustup; fi
185   - if [[ "$RUST_OPTIONS" != "" ]]; then which rustc; fi
186   - if [[ "$RUST_OPTIONS" != "" ]]; then which cargo; fi
187   - if [[ "$RUST_OPTIONS" != "" ]]; then rustup --version; fi
188   - if [[ "$RUST_OPTIONS" != "" ]]; then rustc --version; fi
189   - if [[ "$RUST_OPTIONS" != "" ]]; then cargo --version; fi
190   ## Get python version
191   - python --version
192   ## run stem tests if they are enabled.
193   - if [[ "$TEST_STEM" != "" ]]; then pushd stem; python -c "from stem import stem; print(stem.__version__);"; git log -1; popd; fi
195 script:
196   # Skip test_rebind on macOS
197   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export TOR_SKIP_TEST_REBIND=true; fi
198   - ./autogen.sh
199   - CONFIGURE_FLAGS="$ASCIIDOC_OPTIONS $COVERAGE_OPTIONS $HARDENING_OPTIONS $MODULES_OPTIONS $NSS_OPTIONS $OPENSSL_OPTIONS $RUST_OPTIONS --enable-fatal-warnings --disable-silent-rules"
200   - echo "Configure flags are $CONFIGURE_FLAGS"
201   - ./configure $CONFIGURE_FLAGS
202   ## We run `make check` because that's what https://jenkins.torproject.org does.
203   - if [[ "$DISTCHECK" == "" && "$TEST_STEM" == "" ]]; then make check; fi
204   ## Diagnostic for bug 29437: kill stem if it hangs for 15 minutes
205   - if [[ "$TEST_STEM" != "" ]]; then make src/app/tor; timelimit -p -t 540 -s USR1 -T 30 -S ABRT python3 "$STEM_SOURCE_DIR"/run_tests.py --tor src/app/tor --integ --log notice --target RUN_ALL; fi
206   - if [[ "$DISTCHECK" != "" && "$TEST_STEM" == "" ]]; then make distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS"; fi
207   ## If this build was one that produced coverage, upload it.
208   - if [[ "$COVERAGE_OPTIONS" != "" ]]; then coveralls -b . --exclude src/test --exclude src/trunnel --gcov-options '\-p' || echo "Coverage failed"; fi
210 after_failure:
211   ## configure will leave a log file with more details of config failures.
212   ## But the log is too long for travis' rendered view, so tail it.
213   - tail -1000 config.log || echo "tail failed"
214   ## `make check` will leave a log file with more details of test failures.
215   - if [[ "$DISTCHECK" == "" ]]; then cat test-suite.log || echo "cat failed"; fi
216   ## `make distcheck` puts it somewhere different.
217   - if [[ "$DISTCHECK" != "" ]]; then make show-distdir-testlog || echo "make failed"; fi
218   - if [[ "$DISTCHECK" != "" ]]; then make show-distdir-core || echo "make failed"; fi
219   - if [[ "$TEST_STEM" != "" ]]; then cat "$STEM_SOURCE_DIR"/test/data/tor_log || echo "cat failed"; fi
221 before_cache:
222   ## Delete all gcov files.
223   - if [[ "$COVERAGE_OPTIONS" != "" ]]; then make reset-gcov; fi
224   ## Delete the cargo registry before caching .cargo, because it's cheaper to
225   ## download the registry and throw it away, rather than caching it
226   - rm -rf $HOME/.cargo/registry
228 notifications:
229   irc:
230     channels:
231       - "irc.oftc.net#tor-ci"
232     template:
233       - "%{repository} %{branch} %{commit} - %{author}: %{commit_subject}"
234       - "Build #%{build_number} %{result}. Details: %{build_url}"
235     on_success: change
236     on_failure: change
237   email:
238     on_success: never
239     on_failure: change