.travis.yml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. language: c
  2. ## Comment out the compiler list for now to allow an explicit build
  3. ## matrix.
  4. # compiler:
  5. # - gcc
  6. # - clang
  7. notifications:
  8. irc:
  9. channels:
  10. - "irc.oftc.net#tor-ci"
  11. template:
  12. - "%{repository} %{branch} %{commit} - %{author}: %{commit_subject}"
  13. - "Build #%{build_number} %{result}. Details: %{build_url}"
  14. on_success: change
  15. on_failure: change
  16. email:
  17. on_success: never
  18. on_failure: change
  19. os:
  20. - linux
  21. ## Uncomment the following line to also run the entire build matrix on OSX.
  22. ## This will make your CI builds take roughly ten times longer to finish.
  23. # - osx
  24. ## Use the Ubuntu Trusty images.
  25. dist: trusty
  26. ## We don't need sudo. (The "apt:" stanza after this allows us to not need sudo;
  27. ## otherwise, we would need it for getting dependencies.)
  28. ##
  29. ## We override this in the explicit build matrix to work around a
  30. ## Travis CI environment regression
  31. ## https://github.com/travis-ci/travis-ci/issues/9033
  32. sudo: false
  33. ## (Linux only) Download our dependencies
  34. addons:
  35. apt:
  36. packages:
  37. ## Required dependencies
  38. - libevent-dev
  39. - zlib1g-dev
  40. ## Optional dependencies
  41. - libcap-dev
  42. - liblzma-dev
  43. - libscrypt-dev
  44. - libseccomp-dev
  45. ## zstd doesn't exist in Ubuntu Trusty
  46. #- libzstd
  47. ## The build matrix in the following two stanzas expands into four builds (per OS):
  48. ##
  49. ## * with GCC, with Rust
  50. ## * with GCC, without Rust
  51. ## * with Clang, with Rust
  52. ## * with Clang, without Rust
  53. env:
  54. global:
  55. ## The Travis CI environment allows us two cores, so let's use both.
  56. - MAKEFLAGS="-j 2"
  57. - HARDENING_OPTIONS="--enable-fragile-hardening"
  58. matrix:
  59. ## Leave at least one entry here or Travis seems to generate a
  60. ## matrix entry with empty matrix environment variables. Leaving
  61. ## more than one entry causes unwanted matrix entries with
  62. ## unspecified compilers.
  63. - RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
  64. # - RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
  65. # - RUST_OPTIONS=""
  66. matrix:
  67. ## Uncomment to allow the build to report success (with non-required
  68. ## sub-builds continuing to run) if all required sub-builds have
  69. ## succeeded. This is somewhat buggy currently: it can cause
  70. ## duplicate notifications and prematurely report success if a
  71. ## single sub-build has succeeded. See
  72. ## https://github.com/travis-ci/travis-ci/issues/1696
  73. # fast_finish: true
  74. ## Uncomment the appropriate lines below to allow the build to
  75. ## report success even if some less-critical sub-builds fail and it
  76. ## seems likely to take a while for someone to fix it. Currently
  77. ## Travis CI doesn't distinguish "all builds succeeded" from "some
  78. ## non-required sub-builds failed" except on the individual build's
  79. ## page, which makes it somewhat annoying to detect from the
  80. ## branches and build history pages. See
  81. ## https://github.com/travis-ci/travis-ci/issues/8716
  82. allow_failures:
  83. - env: RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
  84. - env: RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
  85. - env: DISTCHECK="yes" RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
  86. # - compiler: clang
  87. ## Create explicit matrix entries to work around a Travis CI
  88. ## environment issue. Missing keys inherit from the first list
  89. ## entry under that key outside the "include" clause.
  90. include:
  91. - compiler: gcc
  92. - compiler: gcc
  93. env: RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
  94. - compiler: gcc
  95. env: RUST_OPTIONS=""
  96. - compiler: gcc
  97. env: COVERAGE_OPTIONS="--enable-coverage"
  98. - compiler: gcc
  99. env: DISTCHECK="yes" RUST_OPTIONS=""
  100. - compiler: gcc
  101. env: DISTCHECK="yes" RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
  102. - compiler: gcc
  103. env: MODULES_OPTIONS="--disable-module-dirauth"
  104. - compiler: gcc
  105. env: HARDENING_OPTIONS="" RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
  106. - compiler: gcc
  107. env: DISTCHECK="yes" HARDENING_OPTIONS="" RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
  108. ## The "sudo: required" forces non-containerized builds, working
  109. ## around a Travis CI environment issue: clang LeakAnalyzer fails
  110. ## because it requires ptrace and the containerized environment no
  111. ## longer allows ptrace.
  112. - compiler: clang
  113. sudo: required
  114. - compiler: clang
  115. sudo: required
  116. env: RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
  117. - compiler: clang
  118. sudo: required
  119. env: RUST_OPTIONS=""
  120. - compiler: clang
  121. sudo: required
  122. env: MODULES_OPTIONS="--disable-module-dirauth"
  123. before_install:
  124. ## If we're on OSX, homebrew usually needs to updated first
  125. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
  126. ## Download rustup
  127. - if [[ "$RUST_OPTIONS" != "" ]]; then curl -Ssf -o rustup.sh https://sh.rustup.rs; fi
  128. - if [[ "$COVERAGE_OPTIONS" != "" ]]; then pip install --user cpp-coveralls; fi
  129. install:
  130. ## If we're on OSX use brew to install required dependencies (for Linux, see the "apt:" section above)
  131. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade openssl; }; fi
  132. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libevent || brew upgrade libevent; }; fi
  133. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated pkg-config || brew upgrade pkg-config; }; fi
  134. ## If we're on OSX also install the optional dependencies
  135. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated xz || brew upgrade xz; }; fi
  136. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libscrypt || brew upgrade libscrypt; }; fi
  137. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated zstd || brew upgrade zstd; }; fi
  138. ## Install the stable channels of rustc and cargo and setup our toolchain environment
  139. - if [[ "$RUST_OPTIONS" != "" ]]; then sh rustup.sh -y --default-toolchain stable; fi
  140. - if [[ "$RUST_OPTIONS" != "" ]]; then source $HOME/.cargo/env; fi
  141. ## Get some info about rustc and cargo
  142. - if [[ "$RUST_OPTIONS" != "" ]]; then which rustc; fi
  143. - if [[ "$RUST_OPTIONS" != "" ]]; then which cargo; fi
  144. - if [[ "$RUST_OPTIONS" != "" ]]; then rustc --version; fi
  145. - if [[ "$RUST_OPTIONS" != "" ]]; then cargo --version; fi
  146. ## If we're testing rust builds in offline-mode, then set up our vendored dependencies
  147. - if [[ "$TOR_RUST_DEPENDENCIES" == "true" ]]; then export TOR_RUST_DEPENDENCIES=$PWD/src/ext/rust/crates; fi
  148. script:
  149. - ./autogen.sh
  150. - ./configure $RUST_OPTIONS $COVERAGE_OPTIONS $MODULES_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules $HARDENING_OPTIONS
  151. ## We run `make check` because that's what https://jenkins.torproject.org does.
  152. - if [[ "$DISTCHECK" == "" ]]; then make check; fi
  153. - if [[ "$DISTCHECK" != "" ]]; then make distcheck DISTCHECK_CONFIGURE_FLAGS="$RUST_OPTIONS $COVERAGE_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules $HARDENING_OPTIONS"; fi
  154. after_failure:
  155. ## `make check` will leave a log file with more details of test failures.
  156. - if [[ "$DISTCHECK" == "" ]]; then cat test-suite.log; fi
  157. ## `make distcheck` puts it somewhere different.
  158. - if [[ "$DISTCHECK" != "" ]]; then make show-distdir-testlog; fi
  159. after_success:
  160. ## If this build was one that produced coverage, upload it.
  161. - if [[ "$COVERAGE_OPTIONS" != "" ]]; then coveralls -b . --exclude src/test --exclude src/trunnel --gcov-options '\-p'; fi