dist: xenial
sudo: false
language: rust
cache:
directories:
- $HOME/.cargo
- $HOME/.cache
- $TRAVIS_BUILD_DIR/target
before_cache:
- find $TRAVIS_BUILD_DIR/target/debug -maxdepth 1 -type f -delete
env:
global:
- RUST_BACKTRACE=1
- RUSTFLAGS="--deny=warnings"
rust:
- stable
- nightly
matrix:
include:
- os: windows
rust: stable
install:
- choco install golang yasm activeperl ninja
- export PATH="/c/Go/bin:$PATH"
- go version
before_script: true
script:
- cargo build
- cargo test --all
- os: osx
rust: stable
addons:
apt:
sources:
- llvm-toolchain-xenial-7
packages:
- clang-tidy-7
- llvm-7-dev
- libclang-7-dev
- clang-7
before_script:
- export GRPC_VERSION=1.17.2
- export PATH="$PATH:$HOME/.cache/bin:$HOME/.cargo/bin"
- GRPC_HEADER="$HOME/.cache/include/grpc/grpc.h"
- if [[ $TRAVIS_OS_NAME == "osx" ]] && [[ ! -f $GRPC_HEADER ]]; then
export CC=clang;
brew update && brew install autoconf libtool shtool;
fi
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then
brew update && brew install openssl;
export OPENSSL_ROOT_DIR=$(brew --prefix openssl);
else
sudo apt-get update && sudo apt-get -y install libssl-dev;
fi
- if [[ ! -f "$GRPC_HEADER" ]] ; then
(
git clone -b v$GRPC_VERSION https://github.com/grpc/grpc &&
cd grpc &&
git submodule update --init &&
env prefix=$HOME/.cache make install_c
);
fi
- export CPLUS_INCLUDE_PATH="$HOME/.cache/include"
- export LD_LIBRARY_PATH="$HOME/.cache/lib"
- export DYLD_LIBRARY_PATH="$HOME/.cache/lib"
- export LIBRARY_PATH="$HOME/.cache/lib"
- export PKG_CONFIG_PATH="$HOME/.cache/lib/pkgconfig"
script:
- rustup component add rustfmt && cargo fmt --all -- --check
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then scripts/lint-grpc-sys.sh && git diff-index --quiet HEAD; fi
- if [[ $TRAVIS_RUST_VERSION == "stable" ]]; then rustup component add clippy && cargo clippy --all -- -D clippy::all && cargo clippy --all --no-default-features --features prost-codec -- -D clippy::all; fi
- cargo build --no-default-features
- cargo build --no-default-features --features protobuf-codec
- cargo build --no-default-features --features prost-codec
- cargo build
- cargo test --all
- GRPCIO_SYS_USE_PKG_CONFIG=1 cargo test --all
- cargo test --features "openssl" --all
- cargo test --features "openssl-vendored" --all