From 071e9b56b1c573a77f8852f98f7a44cf9214e9bb Mon Sep 17 00:00:00 2001 From: Patrick O'Doherty Date: Sun, 2 Jul 2017 14:28:52 -0700 Subject: [PATCH 1/7] .travis.yml to run test suite Installs dependencies (including rust) and runs the existing test suite. TODO: Introduce build matrix utilizing the rust toolchain to run test suites both with and without the rust components. --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..cd520748e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: c +sudo: enabled +dist: trusty + +before_install: + - sudo apt-get -qq update + - sudo apt-get -y install libevent-dev libseccomp2 zlib1g-dev + - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable + +script: ./autogen.sh && ./configure --disable-asciidoc && make test From 68722a1ddfdc07f84582d40ea484905050259987 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 11 Jul 2017 20:12:15 +0000 Subject: [PATCH 2/7] Fix and expand upon our Travis CI configuration. * CHANGE .travis.yml so that commands for different purposes (e.g. getting dependencies, building, testing) are in separate config lines and sections. * CHANGE .travis.yml to use their mechanism for installing dependencies via apt. [0] This also allows us to not need sudo (the "sudo: false" line). * CHANGE Travis CI tests (the "script:" section) to build and run tests in the same manner as Jenkins (i.e. with --enable-fatal-warnings and --disable-silent-rules and run `make check`). * ADD Travis configuration to do all the target builds with both GCC and clang. * ADD make flags to build with both of the cores available. * ADD notifications for IRC, and configure email notifications (to the author of the commit) only if the branch was previously building successfully and the latest commit broke it. * ADD the ability to run the Travis build matrix for OSX as well, but leave it commented out by default (because it takes roughly ten times longer, due to a shortage of OSX build machines). * ADD Travis config option to cancel/fail the build early if one target has already failed ("fast_finish: true"). * ADD comments to describe what our Travis config is doing and why it is configured that way. [0]: https://docs.travis-ci.com/user/installing-dependencies/#Installing-Packages-on-Container-Based-Infrastructure) --- .travis.yml | 80 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index cd520748e..0b3217268 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,78 @@ language: c -sudo: enabled + +compiler: + - gcc + - clang + +notifications: + irc: + channels: + - "irc.oftc.net#tor-bots" + template: + - "%{repository} %{branch} %{commit} - %{author}: %{commit_subject}" + - "Build #%{build_number} %{result}. Details: %{build_url}" + on_success: change + on_failure: change + email: + on_success: never + on_failure: change + +os: + - linux + ## Uncomment the following line to also run the entire build matrix on OSX. + ## This will make your CI builds take roughly ten times longer to finish. + # - osx + +## Use the Ubuntu Trusty images. dist: trusty -before_install: - - sudo apt-get -qq update - - sudo apt-get -y install libevent-dev libseccomp2 zlib1g-dev - - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable +## We don't need sudo. (The "apt:" stanza after this allows us to not need sudo; +## otherwise, we would need it for getting dependencies.) +sudo: false -script: ./autogen.sh && ./configure --disable-asciidoc && make test +## (Linux only) Download our dependencies +addons: + apt: + packages: + - libevent-dev + - libseccomp2 + - zlib1g-dev + +## The build matrix in the following two stanzas expands into four builds (per OS): +## +## * with GCC, with Rust +## * with GCC, without Rust +## * with Clang, with Rust +## * with Clang, without Rust +env: + global: + ## The Travis CI environment allows us two cores, so let's use both. + - MAKEFLAGS="-j 2" + +matrix: + ## If one build in the matrix fails (e.g. if building withour Rust and Clang + ## fails, but building with Rust and GCC is still going), then cancel the + ## entire job early and call the whole thing a failure. + fast_finish: true + +before_install: + ## If we're on OSX, homebrew usually needs to updated first + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi + ## Download rustup + - curl -Ssf -o rustup.sh https://sh.rustup.rs + +install: + ## If we're on OSX use brew to install dependencies (for Linux, see the "apt:" section above) + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade openssl; }; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade libevent; }; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade pkg-config; }; fi + +script: + - ./autogen.sh + - ./configure $RUST_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules + ## We run `make check` because that's what https://jenkins.torproject.org does. + - make check + +after_failure: + ## `make check` will leave a log file with more details of test failures. + - cat test-suite.log From 7b4585e2a369cd807880b25b766ac0b48d77aefa Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Wed, 12 Jul 2017 00:32:38 +0000 Subject: [PATCH 3/7] Add a changes file for bug22636. --- changes/bug22636 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 changes/bug22636 diff --git a/changes/bug22636 b/changes/bug22636 new file mode 100644 index 000000000..770cac72e --- /dev/null +++ b/changes/bug22636 @@ -0,0 +1,8 @@ + o Build features: + - Tor's repository now includes a Travis Continuous Integration (CI) + configuration file (.travis.yml). This is meant to help new developers and + contributors who fork Tor to a Github repository be better able to test + their changes, and understand what we expect to pass. To use this new build + feature, you must fork Tor to your Github account, then go into the + "Integrations" menu in the repository settings for your fork and enable + Travis, then push your changes. From d0cabbf2c5b940bedda588ec4f52c710359ec75a Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Mon, 24 Jul 2017 18:26:36 +0000 Subject: [PATCH 4/7] Fix CI homebrew checks for outdated packages. (cherry picked from commit 8f8689f70235dc19cbc5092ea148af5772a9cdc3) --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0b3217268..0c6bc8211 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,9 +63,9 @@ before_install: install: ## If we're on OSX use brew to install dependencies (for Linux, see the "apt:" section above) - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade openssl; }; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade libevent; }; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade pkg-config; }; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade openssl; }; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libevent || brew upgrade libevent; }; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated pkg-config || brew upgrade pkg-config; }; fi script: - ./autogen.sh From f2e3d13930c88eb010b96b13570b273eda0b1ea5 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Mon, 24 Jul 2017 18:53:18 +0000 Subject: [PATCH 5/7] Install optional dependencies during Travis CI builds. (cherry picked from commit 1bb00fb812c0df7a574ed62e9f53b0e8192c7d04) --- .travis.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0c6bc8211..6fe7a9b66 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,9 +34,15 @@ sudo: false addons: apt: packages: + ## Required dependencies - libevent-dev - libseccomp2 - zlib1g-dev + ## Optional dependencies + - liblzma-dev + - libscrypt-dev + ## zstd doesn't exist in Ubuntu Trusty + #- libzstd ## The build matrix in the following two stanzas expands into four builds (per OS): ## @@ -62,10 +68,14 @@ before_install: - curl -Ssf -o rustup.sh https://sh.rustup.rs install: - ## If we're on OSX use brew to install dependencies (for Linux, see the "apt:" section above) + ## If we're on OSX use brew to install required dependencies (for Linux, see the "apt:" section above) - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl || brew upgrade openssl; }; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libevent || brew upgrade libevent; }; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated pkg-config || brew upgrade pkg-config; }; fi + ## If we're on OSX also install the optional dependencies + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated xz || brew upgrade xz; }; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libscrypt || brew upgrade libscrypt; }; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated zstd || brew upgrade zstd; }; fi script: - ./autogen.sh From c71864425158a3d480cc143581d5fb40111fa428 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Mon, 24 Jul 2017 23:07:09 +0000 Subject: [PATCH 6/7] Builds on CI should use --enable-fragile-hardening. (cherry picked from commit c91a57ccf90308c6728184b43519f96b61acb95d) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6fe7a9b66..ab8052bde 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,7 +79,7 @@ install: script: - ./autogen.sh - - ./configure $RUST_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules + - ./configure $RUST_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules --enable-fragile-hardening ## We run `make check` because that's what https://jenkins.torproject.org does. - make check From 6d0af8daccd5ed0540f959065c0a794b982432aa Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 25 Jul 2017 01:03:15 +0000 Subject: [PATCH 7/7] In < 0.2.9.x, --enable-fatal-warnings was --enable-gcc-warnings. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ab8052bde..fa0337b49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,7 +79,7 @@ install: script: - ./autogen.sh - - ./configure $RUST_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules --enable-fragile-hardening + - ./configure $RUST_OPTIONS --disable-asciidoc --enable-gcc-warnings --disable-silent-rules --enable-fragile-hardening ## We run `make check` because that's what https://jenkins.torproject.org does. - make check