language: rust
rust:
- stable
- beta
- nightly
os:
- linux
- osx
matrix:
  allow_failures:
  - rust: nightly
  include:
  - rust: stable
    env: CHECK_CLIPPY=1
    before_script:
    - rustup component add clippy-preview
    script:
    - cargo clippy --all-features -- -D warnings
  - rust: stable
    script:
    - cargo build --all-features
  - rust: stable
    env: CHECK_RUSTFMT=1
    before_script:
    - rustup component add rustfmt
    script:
    - rustup component list --installed
    - cargo fmt -- --check
  - rust: stable
    os: linux
    env: CHECK_CHANGELOG=1
    script:
    - |
      ROOT_PACKAGE=swagger;
      RUST_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -er "[.packages[] | select(.name == \"$ROOT_PACKAGE\") | .version][0]");
      (grep -q "## \[$RUST_VERSION\] -" CHANGELOG.md || (echo "Missing CHANGELOG entry for version $RUST_VERSION"; /bin/false)) &&
      (grep -q "\[Unreleased\]: .*/$RUST_VERSION\.\.\.HEAD$" CHANGELOG.md || (echo "Unreleased tag in CHANGELOG footer not updated for version $RUST_VERSION"; /bin/false)) &&
      (grep -q "\[$RUST_VERSION\]: .*\.\.\.$RUST_VERSION$" CHANGELOG.md || (echo "Missing tag for version $RUST_VERSION in CHANGELOG footer"; /bin/false)) &&
      echo "CHANGELOG is up-to-date for version $RUST_VERSION."
branches:
  only:
  - staging
  - trying
  - master
  - v5
deploy:
- provider: script
  script: bash deploy.sh
  on:
    tags: true
    repo: Metaswitch/swagger-rs
env:
  global:
    secure: Y1u5sC2BH/Qq4rAVZsF7+H8Q3khMvxfbwpEWIdx422mDYennKOg6SGW59vibEMMRUnZlMEHylevlXVKCI2GrLztLTx/VStKhUQMSr9NB6CIAA557kxgziigiqFH/A61ZHRSvFpI1K/yF6bgsY5HEjdcXyzKe0KcT80ES4y+v3XfYKnfdDuyxE4KAYQMQ3vXJ7PzWzUCR3T280slBOerVML8dqUe8wehW9Cs+2E1SBmfw48pSSkFQM1Jpo6q390nrvqU/KJD79sUI1VyrXfjF8pPm8PXdJlLKuiTOjFbu473eP9idcorP+1YHXS/NB6PXO840IWdyhT+i2k3QXqZj/EwkNlJqHttQcNWcWe1ch8HqHYspMp58rumThNPBhkyKs0RmIWxbq46n6SA9ua0Q+6mfe2gw2SEZXjIDneeOXcEzt5q99i+iN2LFafZH20HqH070q8v7mdjCAy5hTI0DUFdr3ZZ/dXAJ9OhNiFYBrL919M1EgaODAT5rJaxx+Hn4B8t2QfKHwrNYlHULfozfwvkkgdFjDRN49h17UQ3X7FYViaQ9tFYRE7vCyacKx+N/8jVeZ4dQKlYwzuKYTlp/TggFlik3luIcZHbz9CyU/F+e6pGOqxtmorOAo0uPQGmuptmKvNvLwLuZpBNV+de6qwruyxxxFkKAEbK54YqO7Qw=
