Install protobuf on CI

This commit is contained in:
Romain Ruetschi
2018-09-10 16:28:08 +02:00
parent 737c4db86f
commit 2544781af1
3 changed files with 30 additions and 1 deletions

View File

@ -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

1
PROTOC_VERSION Normal file
View File

@ -0,0 +1 @@
3.5.1

18
install_protobuf.sh Executable file
View File

@ -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