Merge remote-tracking branch 'hiro/gitlab-ci'
[tor.git] / .travis.yml
blob8cc210827ad373663e5920ab5e9c10dcb2917299
1 language: c
3 compiler:
4   - gcc
5   - 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
20 os:
21   - linux
22   ## Uncomment the following line to also run the entire build matrix on OSX.
23   ## This will make your CI builds take roughly ten times longer to finish.
24   # - osx
26 ## Use the Ubuntu Trusty images.
27 dist: trusty
29 ## We don't need sudo. (The "apt:" stanza after this allows us to not need sudo;
30 ## otherwise, we would need it for getting dependencies.)
31 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
47 ## The build matrix in the following two stanzas expands into four builds (per OS):
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   matrix:
58     - RUST_OPTIONS="--enable-rust --enable-cargo-online-mode"
59     - RUST_OPTIONS=""
61 matrix:
62   ## If one build in the matrix fails (e.g. if building withour Rust and Clang
63   ## fails, but building with Rust and GCC is still going), then cancel the
64   ## entire job early and call the whole thing a failure.
65   fast_finish: true
67 before_install:
68   ## If we're on OSX, homebrew usually needs to updated first
69   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
70   ## Download rustup
71   - if [[ "$RUST_OPTIONS" != "" ]]; then curl -Ssf -o rustup.sh https://sh.rustup.rs; fi
73 install:
74   ## If we're on OSX use brew to install required dependencies (for Linux, see the "apt:" section above)
75   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated openssl    || brew upgrade openssl;    }; fi
76   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libevent   || brew upgrade libevent;   }; fi
77   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated pkg-config || brew upgrade pkg-config; }; fi
78   ## If we're on OSX also install the optional dependencies
79   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated xz         || brew upgrade xz;         }; fi
80   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated libscrypt  || brew upgrade libscrypt;  }; fi
81   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then { brew outdated zstd       || brew upgrade zstd;       }; fi
82   ## Install the nightly channels of rustc and cargo and setup our toolchain environment
83   - if [[ "$RUST_OPTIONS" != "" ]]; then sh rustup.sh -y --default-toolchain nightly; fi
84   - if [[ "$RUST_OPTIONS" != "" ]]; then source $HOME/.cargo/env; fi
85   ## Get some info about rustc and cargo
86   - if [[ "$RUST_OPTIONS" != "" ]]; then which rustc; fi
87   - if [[ "$RUST_OPTIONS" != "" ]]; then which cargo; fi
88   - if [[ "$RUST_OPTIONS" != "" ]]; then rustc --version; fi
89   - if [[ "$RUST_OPTIONS" != "" ]]; then cargo --version; fi
91 script:
92   - ./autogen.sh
93   - ./configure $RUST_OPTIONS --disable-asciidoc --enable-fatal-warnings --disable-silent-rules --enable-fragile-hardening
94   ## We run `make check` because that's what https://jenkins.torproject.org does.
95   - make check
97 after_failure:
98   ## `make check` will leave a log file with more details of test failures.
99   - cat test-suite.log