calloop 0.5.1

A callback-based event loop
Documentation
language: rust

# only cache cargo subcommand binaries and wayland libs .so
# the build artifacts take a lot of space and are slower to
# cache than to actually rebuild anyway...
# We need to cache the whole .cargo directory to keep the
# .crates.toml file.
cache:
  directories:
    - /home/travis/.cargo

# But don't cache the cargo registry
before_cache:
    - rm -rf /home/travis/.cargo/registry

dist: trusty

sudo: false

os: linux

branches:
  only:
    - master

rust:
  - 1.39.0
  - stable
  - beta
  - nightly

matrix:
  allow_failures:
    - rust: nightly
  include:
    - rust: stable
      env: BUILD_FMT=1
    - rust: nightly
      env: TARPAULIN=1
      sudo: true
    - rust: stable
      env: BUILD_DOC=1
    - rust: stable
      env: TARGET=x86_64-unknown-freebsd
      sudo: true
      services: docker

before_script:
  - |
      # required to init the registry
      cargo search calloop
      # now the script itself
      if [ -n "$BUILD_FMT" ]; then
        rustup component add rustfmt-preview
      elif [ -n "$TARPAULIN" ]; then
        which cargo-install-update || cargo install cargo-update
        cargo install-update cargo-update
        env RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install-update -i cargo-tarpaulin
        # sanity check, tarpaulin may fail to run after a rust upgrade and then needs recompilation
        cargo tarpaulin --version || env RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin --force
      elif [ -n "$BUILD_DOC" ]; then
        which cargo-install-update || cargo install cargo-update
        cargo install-update cargo-update
        cargo install-update -i cargo-readme
      elif [ -n "$TARGET" ]; then
        which cargo-install-update || cargo install cargo-update
        cargo install-update cargo update
        cargo install-update -i cross
      fi

script:
  - |
      if [ -n "$BUILD_FMT" ]; then
        cargo fmt -- --check
      elif [ -n "$TARPAULIN" ]; then
        cargo tarpaulin --ignore-tests --out Xml
        bash <(curl -s https://codecov.io/bash)
      elif [ -n "$BUILD_DOC" ]; then
        cargo doc --no-deps --all-features &&
        cargo readme --output README.md &&
        git diff --exit-code -- README.md
      elif [ -n "$TARGET" ]; then
        cross build --target "$TARGET"
      else
        cargo test
      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