language: rust
cache:
directories:
- /home/travis/.cargo
before_cache:
- rm -rf /home/travis/.cargo/registry
dist: trusty
sudo: required
rust:
- 1.22.0
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
include:
- rust: stable
env: BUILD_FMT=1
- rust: stable
env: BUILD_DOC=1
- rust: stable
env: TARGET=x86_64-unknown-freebsd
sudo: true
services: docker
branches:
only:
- master
before_script:
- export PATH=$HOME/.cargo/bin:$PATH
- mkdir $(pwd)/socket
- export XDG_RUNTIME_DIR="$(pwd)/socket"
- cargo fetch
- |
if [ -n "$BUILD_FMT" ]; then
rustup component add rustfmt-preview
elif [ -n "$BUILD_DOC" ]; then
echo "Building doc, nothing to install..."
elif [ -n "$TARGET" ]; then
which cargo-install-update || cargo install cargo-update
cargo install-update cargo-update
cargo install-update -i cross
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 -- --check
elif [ -n "$BUILD_DOC" ]; then
cargo doc --no-deps --all-features
elif [[ "$TRAVIS_RUST_VERSION" = "1.22.0" ]]; then
# create a Cargo.lock, and restrict dependencies that do not work on rust 1.22
cargo update
cargo update -p stb_truetype --precise 0.2.2
cargo update -p rusttype --precise 0.7.1
cargo update -p lazy_static --precise 1.1.0
# Only build, no tests on 1.22.0, as our dev-deps 'image' does not build on 1.22.0
env LD_LIBRARY_PATH=~/install/lib:$LD_LIBRARY_PATH cargo build --all-features
elif [[ -n "$TARGET" ]]; then
cross build --target "$TARGET"
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