14 ## The build matrix in the following stanza expands into builds for each
18 ## The Travis CI environment allows us two cores, so let's use both.
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"
26 ## We want to use each build option at least once
28 ## We don't list default variable values, because we set the defaults
29 ## in global (or the default is unset)
33 ## include creates builds with gcc, linux
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
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
56 ## gcc on OSX is less useful, because the default compiler is clang.
59 ## gcc on Linux with no env is redundant, because all the custom builds use
65 ## (Linux only) Use the latest Linux image (Ubuntu Trusty)
68 ## Download our dependencies
73 ## Required dependencies
75 ## Ubuntu comes with OpenSSL by default
78 ## Optional dependencies
82 ## Conditional build dependencies
83 ## Always installed, so we don't need sudo
91 ## Required dependencies
93 ## The OSX version of OpenSSL is way too old
95 ## OSX comes with zlib by default
96 ## to use a newer zlib, pass the keg path to configure (like OpenSSL)
98 ## Optional dependencies
100 ## Required build dependencies
101 ## Tor needs pkg-config to find some dependencies at build time
103 ## Optional build dependencies
105 ## Conditional build dependencies
106 ## Always installed, because manual brew installs are hard to get right
110 ## (OSX only) Use the default OSX image
111 ## See https://docs.travis-ci.com/user/reference/osx#os-x-version
112 ## Default is Xcode 9.4 on macOS 10.13 as of August 2018
116 ## If we're on OSX, configure ccache (ccache is automatically installed and configured on Linux)
117 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
118 ## 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
119 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then OPENSSL_OPTIONS=--with-openssl-dir=`brew --prefix openssl`; fi
120 ## Install conditional features
122 - if [[ "$COVERAGE_OPTIONS" != "" ]]; then pip install --user cpp-coveralls; fi
123 ## If we're on OSX, and using asciidoc, configure asciidoc
124 - if [[ "$ASCIIDOC_OPTIONS" == "" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"; fi
126 ## Finally, list installed package versions
127 - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then dpkg-query --show; fi
128 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list --versions; fi
132 - CONFIGURE_FLAGS="$ASCIIDOC_OPTIONS $COVERAGE_OPTIONS $HARDENING_OPTIONS $OPENSSL_OPTIONS --enable-fatal-warnings --disable-silent-rules"
133 - echo "Configure flags are $CONFIGURE_FLAGS"
134 - ./configure $CONFIGURE_FLAGS
135 ## We run `make check` because that's what https://jenkins.torproject.org does.
136 - if [[ "$DISTCHECK" == "" ]]; then make check; fi
137 - if [[ "$DISTCHECK" != "" ]]; then make distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS"; fi
138 ## If this build was one that produced coverage, upload it.
139 - if [[ "$COVERAGE_OPTIONS" != "" ]]; then coveralls -b . --exclude src/test --exclude src/trunnel --gcov-options '\-p' || echo "Coverage failed"; fi
142 ## configure will leave a log file with more details of config failures.
143 ## But the log is too long for travis' rendered view, so tail it.
144 - tail -1000 config.log || echo "tail failed"
145 ## `make check` will leave a log file with more details of test failures.
146 - if [[ "$DISTCHECK" == "" ]]; then cat test-suite.log || echo "cat failed"; fi
147 ## `make distcheck` puts it somewhere different.
148 - if [[ "$DISTCHECK" != "" ]]; then make show-distdir-testlog || echo "make failed"; fi
151 ## Delete all gcov files.
152 - if [[ "$COVERAGE_OPTIONS" != "" ]]; then make reset-gcov; fi
157 - "irc.oftc.net#tor-ci"
159 - "%{repository} %{branch} %{commit} - %{author}: %{commit_subject}"
160 - "Build #%{build_number} %{result}. Details: %{build_url}"