language: rust
cache:
directories:
- /home/travis/.cargo
before_cache:
- rm -rf /home/travis/.cargo/registry
dist: trusty
sudo: required
rust:
- 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:
- cargo fetch
- |
if [ -n "$BUILD_FMT" ]; then
rustup component add rustfmt-preview
elif [ -n "$BUILD_DOC" ]; then
echo "Building doc, nothing to install..."
fi
os:
- linux
script:
- |
if [ -n "$BUILD_FMT" ]; then
cargo fmt -- --check
elif [ -n "$BUILD_DOC" ]; then
cargo doc --no-deps --all-features
else
cargo check
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