.travis.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. language: c
  2. compiler:
  3. - gcc
  4. - clang
  5. os:
  6. - linux
  7. - osx
  8. ## The build matrix in the following stanza expands into builds for each
  9. ## OS and compiler.
  10. env:
  11. global:
  12. ## The Travis CI environment allows us two cores, so let's use both.
  13. - MAKEFLAGS="-j 2"
  14. ## We turn on hardening by default
  15. ## Also known as --enable-fragile-hardening in 0.3.0.3-alpha and later
  16. - HARDENING_OPTIONS="--enable-expensive-hardening"
  17. matrix:
  18. ## We want to use each build option at least once
  19. ##
  20. ## We don't list default variable values, because we set the defaults
  21. ## in global (or the default is unset)
  22. -
  23. matrix:
  24. ## include creates builds with gcc, linux, sudo: false
  25. include:
  26. ## We include a single coverage build with the best options for coverage
  27. - env: COVERAGE_OPTIONS="--enable-coverage" HARDENING_OPTIONS=""
  28. ## We only want to check these build option combinations once
  29. ## (they shouldn't vary by compiler or OS)
  30. - env: DISTCHECK="yes"
  31. - env: HARDENING_OPTIONS=""
  32. ## Uncomment to allow the build to report success (with non-required
  33. ## sub-builds continuing to run) if all required sub-builds have
  34. ## succeeded. This is somewhat buggy currently: it can cause
  35. ## duplicate notifications and prematurely report success if a
  36. ## single sub-build has succeeded. See
  37. ## https://github.com/travis-ci/travis-ci/issues/1696
  38. # fast_finish: true
  39. ## Careful! We use global envs, which makes it hard to exclude or
  40. ## allow failures by env:
  41. ## https://docs.travis-ci.com/user/customizing-the-build#matching-jobs-with-allow_failures
  42. exclude:
  43. ## Clang doesn't work in containerized builds, see below.
  44. - compiler: clang
  45. sudo: false
  46. ## We also exclude non-containerized gcc, because they're slow and redundant.
  47. - compiler: gcc
  48. sudo: required
  49. ## We don't need sudo. (The "apt:" stanza after this allows us to not need
  50. ## sudo; otherwise, we would need it for getting dependencies.)
  51. ##
  52. ## But we use "sudo: required" to force non-containerized builds, working
  53. ## around a Travis CI environment issue: clang LeakAnalyzer fails
  54. ## because it requires ptrace and the containerized environment no
  55. ## longer allows ptrace.
  56. ## https://github.com/travis-ci/travis-ci/issues/9033
  57. ##
  58. ## In the matrix above, we exclude redundant combinations.
  59. sudo:
  60. - false
  61. - required
  62. ## (Linux only) Use the latest Linux image (Ubuntu Trusty)
  63. dist: trusty
  64. ## (Linux only) Download our dependencies
  65. addons:
  66. apt:
  67. packages:
  68. ## Required dependencies
  69. - libevent-dev
  70. - zlib1g-dev
  71. ## Optional dependencies
  72. - libcap-dev
  73. - libscrypt-dev
  74. - libseccomp-dev
  75. ## (OSX only) Use the default OSX image
  76. ## See https://docs.travis-ci.com/user/reference/osx#os-x-version
  77. ## Default is Xcode 9.4 on macOS 10.13 as of August 2018
  78. #osx_image: xcode9.4
  79. before_install:
  80. ## If we're on OSX, homebrew usually needs to updated first
  81. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
  82. ## We might be upgrading some useless packages, but that's better than missing an upgrade
  83. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade; fi
  84. install:
  85. ## If we're on OSX use brew to install required dependencies (for Linux, see the "apt:" section above)
  86. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install libevent; fi
  87. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install openssl; fi
  88. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install pkg-config; fi
  89. ## macOS comes with zlib by default, so the homebrew install is keg-only
  90. # - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install zlib; fi
  91. ## If we're on OSX also install the optional dependencies
  92. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install libscrypt; fi
  93. ## Install conditional features
  94. ## Install coveralls
  95. - if [[ "$COVERAGE_OPTIONS" != "" ]]; then pip install --user cpp-coveralls; fi
  96. script:
  97. - ./autogen.sh
  98. - CONFIGURE_FLAGS="$COVERAGE_OPTIONS $HARDENING_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules"
  99. - echo $CONFIGURE_FLAGS
  100. - ./configure $CONFIGURE_FLAGS
  101. ## We run `make check` because that's what https://jenkins.torproject.org does.
  102. - if [[ "$DISTCHECK" == "" ]]; then make check; fi
  103. - if [[ "$DISTCHECK" != "" ]]; then make distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS"; fi
  104. after_failure:
  105. ## configure will leave a log file with more details of config failures.
  106. ## But the log is too long for travis' rendered view, so tail it.
  107. - tail -1000 config.log
  108. ## `make check` will leave a log file with more details of test failures.
  109. - if [[ "$DISTCHECK" == "" ]]; then cat test-suite.log; fi
  110. ## `make distcheck` puts it somewhere different.
  111. - if [[ "$DISTCHECK" != "" ]]; then make show-distdir-testlog; fi
  112. after_success:
  113. ## If this build was one that produced coverage, upload it.
  114. - if [[ "$COVERAGE_OPTIONS" != "" ]]; then coveralls -b . --exclude src/test --exclude src/trunnel --gcov-options '\-p'; fi
  115. notifications:
  116. irc:
  117. channels:
  118. - "irc.oftc.net#tor-ci"
  119. template:
  120. - "%{repository} %{branch} %{commit} - %{author}: %{commit_subject}"
  121. - "Build #%{build_number} %{result}. Details: %{build_url}"
  122. on_success: change
  123. on_failure: change
  124. email:
  125. on_success: never
  126. on_failure: change