8 ## where we point CARGO_TARGET_DIR in all our cargo invocations
9 - $TRAVIS_BUILD_DIR/src/rust/target
19 ## The build matrix in the following stanza expands into builds for each
23 ## The Travis CI environment allows us two cores, so let's use both.
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"
31 ## We want to use each build option at least once
33 ## We don't list default variable values, because we set the defaults
34 ## in global (or the default is unset)
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 ## TOR_RUST_DEPENDENCIES is spelt RUST_DEPENDENCIES in 0.3.2
41 - RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true HARDENING_OPTIONS=""
44 ## include creates builds with gcc, linux, sudo: false
46 ## We include a single coverage build with the best options for coverage
47 - env: COVERAGE_OPTIONS="--enable-coverage" HARDENING_OPTIONS=""
48 ## We only want to check these build option combinations once
49 ## (they shouldn't vary by compiler or OS)
50 ## We run rust and coverage with hardening off, which seems like enough
51 # - env: HARDENING_OPTIONS=""
52 ## We check asciidoc with distcheck, to make sure we remove doc products
53 - env: DISTCHECK="yes" ASCIIDOC_OPTIONS=""
54 # We clone our stem repo and run `make test-stem`
55 - env: TEST_STEM="yes"
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 - env: NSS_OPTIONS="--enable-nss"
65 ## Uncomment to allow the build to report success (with non-required
66 ## sub-builds continuing to run) if all required sub-builds have
67 ## succeeded. This is somewhat buggy currently: it can cause
68 ## duplicate notifications and prematurely report success if a
69 ## single sub-build has succeeded. See
70 ## https://github.com/travis-ci/travis-ci/issues/1696
73 ## Careful! We use global envs, which makes it hard to exclude or
74 ## allow failures by env:
75 ## https://docs.travis-ci.com/user/customizing-the-build#matching-jobs-with-allow_failures
77 ## Clang doesn't work in containerized builds, see below.
80 ## Non-containerized gcc are slow and redundant.
83 ## gcc on OSX is less useful, because the default compiler is clang.
86 ## gcc on Linux with no env is redundant, because all the custom builds use
91 ## offline rust builds for gcc on Linux are redundant, because we do an
92 ## online rust build for gcc on Linux
95 ## TOR_RUST_DEPENDENCIES is spelt RUST_DEPENDENCIES in 0.3.2
96 env: RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true HARDENING_OPTIONS=""
98 ## We don't need sudo. (The "apt:" stanza after this allows us to not need
99 ## sudo; otherwise, we would need it for getting dependencies.)
101 ## But we use "sudo: required" to force non-containerized builds, working
102 ## around a Travis CI environment issue: clang LeakAnalyzer fails
103 ## because it requires ptrace and the containerized environment no
104 ## longer allows ptrace.
105 ## https://github.com/travis-ci/travis-ci/issues/9033
107 ## In the matrix above, we exclude redundant combinations.
112 ## (Linux only) Use the latest Linux image (Ubuntu Trusty)
115 ## Download our dependencies
120 ## Required dependencies
122 ## Ubuntu comes with OpenSSL by default
125 ## Optional dependencies
131 ## zstd doesn't exist in Ubuntu Trusty
133 ## Conditional build dependencies
134 ## Always installed, so we don't need sudo
142 ## Required dependencies
144 ## The OSX version of OpenSSL is way too old
146 ## OSX comes with zlib by default
147 ## to use a newer zlib, pass the keg path to configure (like OpenSSL)
149 ## Optional dependencies
153 ## Required build dependencies
154 ## Tor needs pkg-config to find some dependencies at build time
156 ## Optional build dependencies
158 ## Conditional build dependencies
159 ## Always installed, because manual brew installs are hard to get right
163 ## (OSX only) Use the default OSX image
164 ## See https://docs.travis-ci.com/user/reference/osx#os-x-version
165 ## Default is Xcode 9.4 on macOS 10.13 as of August 2018
169 ## Create empty rust directories for non-Rust builds, so caching succeeds
170 - if [[ "$RUST_OPTIONS" == "" ]]; then mkdir -p $HOME/.cargo $TRAVIS_BUILD_DIR/src/rust/target; fi
173 ## If we're on OSX, configure ccache (ccache is automatically installed and configured on Linux)
174 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
175 ## 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
176 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then OPENSSL_OPTIONS=--with-openssl-dir=`brew --prefix openssl`; fi
177 ## Install conditional features
179 - if [[ "$COVERAGE_OPTIONS" != "" ]]; then pip install --user cpp-coveralls; fi
180 ## If we're on OSX, and using asciidoc, configure asciidoc
181 - if [[ "$ASCIIDOC_OPTIONS" == "" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"; fi
182 ## If we're using Rust, download rustup
183 - if [[ "$RUST_OPTIONS" != "" ]]; then curl -Ssf -o rustup.sh https://sh.rustup.rs; fi
184 ## Install the stable channels of rustc and cargo and setup our toolchain environment
185 - if [[ "$RUST_OPTIONS" != "" ]]; then sh rustup.sh -y --default-toolchain stable; fi
186 - if [[ "$RUST_OPTIONS" != "" ]]; then source $HOME/.cargo/env; fi
187 ## If we're testing rust builds in offline-mode, then set up our vendored dependencies
188 - if [[ "$TOR_RUST_DEPENDENCIES" == "true" ]]; then export TOR_RUST_DEPENDENCIES=$PWD/src/ext/rust/crates; fi
190 ## Finally, list installed package versions
191 - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then dpkg-query --show; fi
192 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list --versions; fi
193 ## Get some info about rustup, rustc and cargo
194 - if [[ "$RUST_OPTIONS" != "" ]]; then which rustup; fi
195 - if [[ "$RUST_OPTIONS" != "" ]]; then which rustc; fi
196 - if [[ "$RUST_OPTIONS" != "" ]]; then which cargo; fi
197 - if [[ "$RUST_OPTIONS" != "" ]]; then rustup --version; fi
198 - if [[ "$RUST_OPTIONS" != "" ]]; then rustc --version; fi
199 - if [[ "$RUST_OPTIONS" != "" ]]; then cargo --version; fi
203 - CONFIGURE_FLAGS="$ASCIIDOC_OPTIONS $COVERAGE_OPTIONS $HARDENING_OPTIONS $MODULES_OPTIONS $NSS_OPTIONS $OPENSSL_OPTIONS $RUST_OPTIONS --enable-fatal-warnings --disable-silent-rules"
204 - echo "Configure flags are $CONFIGURE_FLAGS"
205 - ./configure $CONFIGURE_FLAGS
206 ## We run `make check` because that's what https://jenkins.torproject.org does.
207 - if [[ "$DISTCHECK" == "" ]]; then make check; fi
208 - if [[ "$TEST_STEM" != "" ]]; then git clone --depth 1 https://github.com/torproject/stem.git ; export STEM_SOURCE_DIR=`pwd`/stem; make test-stem; fi
209 - if [[ "$DISTCHECK" != "" ]]; then make distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS"; fi
212 ## configure will leave a log file with more details of config failures.
213 ## But the log is too long for travis' rendered view, so tail it.
214 - tail -1000 config.log || echo "tail failed"
215 ## `make check` will leave a log file with more details of test failures.
216 - if [[ "$DISTCHECK" == "" ]]; then cat test-suite.log || echo "cat failed"; fi
217 ## `make distcheck` puts it somewhere different.
218 - if [[ "$DISTCHECK" != "" ]]; then make show-distdir-testlog || echo "make failed"; fi
219 - if [[ "$DISTCHECK" != "" ]]; then make show-distdir-core || echo "make failed"; fi
222 ## If this build was one that produced coverage, upload it.
223 - if [[ "$COVERAGE_OPTIONS" != "" ]]; then coveralls -b . --exclude src/test --exclude src/trunnel --gcov-options '\-p'; fi
228 - "irc.oftc.net#tor-ci"
230 - "%{repository} %{branch} %{commit} - %{author}: %{commit_subject}"
231 - "Build #%{build_number} %{result}. Details: %{build_url}"