language: rust
cache: cargo
dist: trusty
sudo: required
rust:
- 1.20.0
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
include:
- rust: stable
env: BUILD_FMT=1
- rust: stable
env: BUILD_DOC=1
branches:
only:
- master
before_script:
- export PATH=$HOME/.cargo/bin:$PATH
- mkdir $(pwd)/socket
- export XDG_RUNTIME_DIR="$(pwd)/socket"
- |
if [ -n "$BUILD_FMT" ]; then
rustup component add rustfmt-preview
elif [ -n "$BUILD_DOC" ]; then
echo "Building doc, nothing to install..."
else
# Building & running tests, we need to install the wayland lib
./travis_install_wayland.sh "1.12.0"
fi
os:
- linux
script:
- |
if [ -n "$BUILD_FMT" ]; then
cargo fmt -- --write-mode=diff
elif [ -n "$BUILD_DOC" ]; then
cargo doc --no-deps --all-features
elif [[ "$TRAVIS_RUST_VERSION" = "1.20.0" ]]; then
# Only build, no tests on 1.20.0, as our dev-deps 'image' does not build on 1.20.0
env LD_LIBRARY_PATH=~/install/lib:$LD_LIBRARY_PATH cargo build --all-features
else
env LD_LIBRARY_PATH=~/install/lib:$LD_LIBRARY_PATH cargo test --all-features
fi
after_success:
- |
if [ -n "$BUILD_DOC" ]; then
cp ./doc_index.html ./target/doc/index.html
fi
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: "target/doc"
on:
branch: master
rust: stable
condition: $BUILD_DOC = 1
notifications:
webhooks:
urls:
- "https://scalar.vector.im/api/neb/services/hooks/dHJhdmlzLWNpLyU0MGxldmFucyUzQXNhZmFyYWRlZy5uZXQvJTIxRkt4aGprSUNwakJWelZlQ2RGJTNBc2FmYXJhZGVnLm5ldA"
on_success: change
on_failure: always
on_start: never