Avoid using labs() on time_t in channeltls.c
[tor.git] / .travis.yml
blob456b5abc56a9e4db8b7ef7bd026918d9f28a221e
1 language: c
3 cache:
4   ccache: true
6 compiler:
7   - gcc
8   - clang
10 os:
11   - linux
12   - osx
14 ## The build matrix in the following stanza expands into builds for each
15 ## OS and compiler.
16 env:
17   global:
18     ## The Travis CI environment allows us two cores, so let's use both.
19     - MAKEFLAGS="-j 2"
20     ## We turn on hardening by default
21     ## Also known as --enable-fragile-hardening in 0.3.0.3-alpha and later
22     - HARDENING_OPTIONS="--enable-expensive-hardening"
23     ## We turn off asciidoc by default, because it's slow
24     - ASCIIDOC_OPTIONS="--disable-asciidoc"
25   matrix:
26     ## We want to use each build option at least once
27     ##
28     ## We don't list default variable values, because we set the defaults
29     ## in global (or the default is unset)
30     -
32 matrix:
33   ## include creates builds with gcc, linux, sudo: false
34   include:
35     ## We include a single coverage build with the best options for coverage
36     - env: COVERAGE_OPTIONS="--enable-coverage" HARDENING_OPTIONS=""
37     ## We only want to check these build option combinations once
38     ## (they shouldn't vary by compiler or OS)
39     ## We run coverage with hardening off, which seems like enough
40     # - env: HARDENING_OPTIONS=""
41     ## We check asciidoc with distcheck, to make sure we remove doc products
42     - env: DISTCHECK="yes" ASCIIDOC_OPTIONS=""
44   ## Uncomment to allow the build to report success (with non-required
45   ## sub-builds continuing to run) if all required sub-builds have
46   ## succeeded.  This is somewhat buggy currently: it can cause
47   ## duplicate notifications and prematurely report success if a
48   ## single sub-build has succeeded.  See
49   ## https://github.com/travis-ci/travis-ci/issues/1696
50   # fast_finish: true
52   ## Careful! We use global envs, which makes it hard to exclude or
53   ## allow failures by env:
54   ## https://docs.travis-ci.com/user/customizing-the-build#matching-jobs-with-allow_failures
55   exclude:
56     ## Clang doesn't work in containerized builds, see below.
57     - compiler: clang
58       sudo: false
59     ## Non-containerized gcc are slow and redundant.
60     - compiler: gcc
61       sudo: required
62     ## gcc on OSX is less useful, because the default compiler is clang.
63     - compiler: gcc
64       os: osx
65     ## gcc on Linux with no env is redundant, because all the custom builds use
66     ## gcc on Linux
67     - compiler: gcc
68       os: linux
69       env:
71 ## We don't need sudo. (The "apt:" stanza after this allows us to not need
72 ## sudo; otherwise, we would need it for getting dependencies.)
74 ## But we use "sudo: required" to force non-containerized builds, working
75 ## around a Travis CI environment issue: clang LeakAnalyzer fails
76 ## because it requires ptrace and the containerized environment no
77 ## longer allows ptrace.
78 ## https://github.com/travis-ci/travis-ci/issues/9033
80 ## In the matrix above, we exclude redundant combinations.
81 sudo:
82   - false
83   - required
85 ## (Linux only) Use the latest Linux image (Ubuntu Trusty)
86 dist: trusty
88 ## Download our dependencies
89 addons:
90   ## (Linux only)
91   apt:
92     packages:
93       ## Required dependencies
94       - libevent-dev
95       ## Ubuntu comes with OpenSSL by default
96       #- libssl-dev
97       - zlib1g-dev
98       ## Optional dependencies
99       - libcap-dev
100       - libscrypt-dev
101       - libseccomp-dev
102       ## Conditional build dependencies
103       ## Always installed, so we don't need sudo
104       - asciidoc
105       - docbook-xsl
106       - docbook-xml
107       - xmlto
108   ## (OSX only)
109   homebrew:
110     packages:
111       ## Required dependencies
112       - libevent
113       ## The OSX version of OpenSSL is way too old
114       - openssl
115       ## OSX comes with zlib by default
116       ## to use a newer zlib, pass the keg path to configure (like OpenSSL)
117       #- zlib
118       ## Optional dependencies
119       - libscrypt
120       ## Required build dependencies
121       ## Tor needs pkg-config to find some dependencies at build time
122       - pkg-config
123       ## Optional build dependencies
124       - ccache
125       ## Conditional build dependencies
126       ## Always installed, because manual brew installs are hard to get right
127       - asciidoc
128       - xmlto
130 ## (OSX only) Use the default OSX image
131 ## See https://docs.travis-ci.com/user/reference/osx#os-x-version
132 ## Default is Xcode 9.4 on macOS 10.13 as of August 2018
133 #osx_image: xcode9.4
135 install:
136   ## If we're on OSX, configure ccache (ccache is automatically installed and configured on Linux)
137   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
138   ## 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
139   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then OPENSSL_OPTIONS=--with-openssl-dir=`brew --prefix openssl`; fi
140   ## Install conditional features
141   ## Install coveralls
142   - if [[ "$COVERAGE_OPTIONS" != "" ]]; then pip install --user cpp-coveralls; fi
143   ## If we're on OSX, and using asciidoc, configure asciidoc
144   - if [[ "$ASCIIDOC_OPTIONS" == "" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"; fi
145   ##
146   ## Finally, list installed package versions
147   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then dpkg-query --show; fi
148   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list --versions; fi
150 script:
151   - ./autogen.sh
152   - CONFIGURE_FLAGS="$ASCIIDOC_OPTIONS $COVERAGE_OPTIONS $HARDENING_OPTIONS $OPENSSL_OPTIONS --enable-fatal-warnings --disable-silent-rules"
153   - echo "Configure flags are $CONFIGURE_FLAGS"
154   - ./configure $CONFIGURE_FLAGS
155   ## We run `make check` because that's what https://jenkins.torproject.org does.
156   - if [[ "$DISTCHECK" == "" ]]; then make check; fi
157   - if [[ "$DISTCHECK" != "" ]]; then make distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS"; fi
158   ## If this build was one that produced coverage, upload it.
159   - if [[ "$COVERAGE_OPTIONS" != "" ]]; then coveralls -b . --exclude src/test --exclude src/trunnel --gcov-options '\-p' || echo "Coverage failed"; fi
161 after_failure:
162   ## configure will leave a log file with more details of config failures.
163   ## But the log is too long for travis' rendered view, so tail it.
164   - tail -1000 config.log || echo "tail failed"
165   ## `make check` will leave a log file with more details of test failures.
166   - if [[ "$DISTCHECK" == "" ]]; then cat test-suite.log || echo "cat failed"; fi
167   ## `make distcheck` puts it somewhere different.
168   - if [[ "$DISTCHECK" != "" ]]; then make show-distdir-testlog || echo "make failed"; fi
170 before_cache:
171   ## Delete all gcov files.
172   - if [[ "$COVERAGE_OPTIONS" != "" ]]; then make reset-gcov; fi
174 notifications:
175   irc:
176     channels:
177       - "irc.oftc.net#tor-ci"
178     template:
179       - "%{repository} %{branch} %{commit} - %{author}: %{commit_subject}"
180       - "Build #%{build_number} %{result}. Details: %{build_url}"
181     on_success: change
182     on_failure: change
183   email:
184     on_success: never
185     on_failure: change