.travis.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. - libseccomp2
  40. - zlib1g-dev
  41. ## Optional dependencies
  42. - liblzma-dev
  43. - libscrypt-dev
  44. ## zstd doesn't exist in Ubuntu Trusty
  45. #- libzstd
  46. ## The build matrix in the following two stanzas expands into four builds (per OS):
  47. ##
  48. ## * with GCC, with Rust
  49. ## * with GCC, without Rust
  50. ## * with Clang, with Rust
  51. ## * with Clang, without Rust
  52. env:
  53. global:
  54. ## The Travis CI environment allows us two cores, so let's use both.
  55. - MAKEFLAGS="-j 2"
  56. matrix:
  57. ## Leave at least one entry here or Travis seems to generate a
  58. ## matrix entry with empty matrix environment variables. Leaving
  59. ## more than one entry causes unwanted matrix entries with
  60. ## unspecified compilers.
  61. - RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
  62. # - RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
  63. # - RUST_OPTIONS=""
  64. matrix:
  65. ## If one build in the matrix fails (e.g. if building withour Rust and Clang
  66. ## fails, but building with Rust and GCC is still going), then cancel the
  67. ## entire job early and call the whole thing a failure.
  68. fast_finish: true
  69. ## Create explicit matrix entries to work around a Travis CI
  70. ## environment issue. Missing keys inherit from the first list
  71. ## entry under that key outside the "include" clause.
  72. include:
  73. - compiler: gcc
  74. - compiler: gcc
  75. env: RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
  76. - compiler: gcc
  77. env: RUST_OPTIONS=""
  78. ## The "sudo: required" forces non-containerized builds, working
  79. ## around a Travis CI environment issue: clang LeakAnalyzer fails
  80. ## because it requires ptrace and the containerized environment no
  81. ## longer allows ptrace.
  82. - compiler: clang
  83. sudo: required
  84. - compiler: clang
  85. sudo: required
  86. env: RUST_OPTIONS="--enable-rust" TOR_RUST_DEPENDENCIES=true
  87. - compiler: clang
  88. sudo: required
  89. env: RUST_OPTIONS=""
  90. before_install:
  91. ## If we're on OSX, homebrew usually needs to updated first
  92. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
  93. ## Download rustup
  94. - if [[ "$RUST_OPTIONS" != "" ]]; then curl -Ssf -o rustup.sh https://sh.rustup.rs; fi
  95. install:
  96. ## If we're on OSX use brew to install required dependencies (for Linux, see the "apt:" section above)
  97. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade openssl; }; fi
  98. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libevent || brew upgrade libevent; }; fi
  99. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated pkg-config || brew upgrade pkg-config; }; fi
  100. ## If we're on OSX also install the optional dependencies
  101. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated xz || brew upgrade xz; }; fi
  102. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libscrypt || brew upgrade libscrypt; }; fi
  103. - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated zstd || brew upgrade zstd; }; fi
  104. ## Install the nightly channels of rustc and cargo and setup our toolchain environment
  105. - if [[ "$RUST_OPTIONS" != "" ]]; then sh rustup.sh -y --default-toolchain nightly; fi
  106. - if [[ "$RUST_OPTIONS" != "" ]]; then source $HOME/.cargo/env; fi
  107. ## Get some info about rustc and cargo
  108. - if [[ "$RUST_OPTIONS" != "" ]]; then which rustc; fi
  109. - if [[ "$RUST_OPTIONS" != "" ]]; then which cargo; fi
  110. - if [[ "$RUST_OPTIONS" != "" ]]; then rustc --version; fi
  111. - if [[ "$RUST_OPTIONS" != "" ]]; then cargo --version; fi
  112. ## If we're testing rust builds in offline-mode, then set up our vendored dependencies
  113. - if [[ "$RUST_OPTIONS" == "--enable-rust" ]]; then git submodule init ; fi
  114. - if [[ "$RUST_OPTIONS" == "--enable-rust" ]]; then git submodule update; fi
  115. - if [[ "$TOR_RUST_DEPENDENCIES" == "true" ]]; then export TOR_RUST_DEPENDENCIES=$PWD/src/ext/rust/crates; fi
  116. script:
  117. - ./autogen.sh
  118. - ./configure $RUST_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules --enable-fragile-hardening
  119. ## We run `make check` because that's what https://jenkins.torproject.org does.
  120. - make check
  121. after_failure:
  122. ## `make check` will leave a log file with more details of test failures.
  123. - cat test-suite.log