diff --git a/.travis.yml b/.travis.yml index 538c09b..14883ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,10 @@ language: rust -cache: cargo # https://docs.travis-ci.com/user/caching/#Rust-Cargo-cache + +cache: + directories: + - $HOME/.cargo + - $HOME/protobuf + - $TRAVIS_BUILD_DIR/target rust: - stable @@ -54,3 +59,8 @@ script: - cargo build --verbose --all-features - cargo test --verbose --all-features - cargo doc --verbose --all-features --no-deps + +before_install: + - export PATH=$PATH:$HOME/protobuf/bin + - export PROTOC_VERSION=$(cat PROTOC_VERSION) + - bash install_protobuf.sh diff --git a/PROTOC_VERSION b/PROTOC_VERSION new file mode 100644 index 0000000..d5c0c99 --- /dev/null +++ b/PROTOC_VERSION @@ -0,0 +1 @@ +3.5.1 diff --git a/install_deps.sh b/install_deps.sh new file mode 100755 index 0000000..e9c6a23 --- /dev/null +++ b/install_deps.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -e + +PROTOC_VERSION=$(cat PROTOC_VERSION) + +check_protoc_version () { + this_version=`protoc --version` + return `[ "libprotoc $PROTOC_VERSION" = "$this_version" ]` +} + +if check_protoc_version; then + echo $PROTOC_VERSION detected. + exit +fi + +wget https://github.com/google/protobuf/archive/v$PROTOC_VERSION.tar.gz +tar -xzvf v$PROTOC_VERSION.tar.gz +cd protobuf-$PROTOC_VERSION && ./autogen.sh && ./configure --prefix=$HOME/protobuf && make && make install