dist: bionic
notifications:
  email: false
addons:
  apt:
    packages:
    - libpq-dev
    - pkg-config
services:
  - docker
language: rust
before_install:
  - cargo fmt --all -- --check
install:
  - cargo install diesel_cli \
      --no-default-features --features postgres -Z install-upgrade
  - curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
before_script:
  - heroku container:login
  - heroku container:pull --app=rfcbot-rs web
script: |
  # first build the container and upload intermediate stages for later retries
  heroku container:push --app=rfcbot-rs web

  # spin up our integration test environment
  docker-compose up -d
  ./setup-db.sh

  # run our tests, if they fail print the logs from the target container
  docker-compose exec -e RUST_BACKTRACE=1 web \
    cargo test --release --locked
  docker-compose logs web
before_deploy:
  - DATABASE_URL=$(heroku config:get DATABASE_URL --app=rfcbot-rs) \
    diesel migration run
deploy:
  provider: script
  script: heroku container:release --app=rfcbot-rs
before_cache:
  # don't cache the cargo registry
  - rm -rf "$HOME/.cargo/registry"
cache:
  directories:
    - "$HOME/.cargo"

dist: bionic
notifications:
  email: false
addons:
  apt:
    packages:
    - libpq-dev
    - pkg-config
services:
  - docker
language: rust
before_install:
  - cargo fmt --all -- --check
install:
  - cargo install diesel_cli \
      --no-default-features --features postgres -Z install-upgrade
  - curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
before_script:
  - heroku container:login
  - heroku container:pull --app=rfcbot-rs web
script: |
  # first build the container and upload intermediate stages for later retries
  heroku container:push --app=rfcbot-rs web

  # spin up our integration test environment
  docker-compose up -d
  ./setup-db.sh

  # run our tests, if they fail print the logs from the target container
  docker-compose exec -e RUST_BACKTRACE=1 web \
    cargo test --release --locked
after_failure:
  docker-compose logs web
before_deploy:
  - DATABASE_URL=$(heroku config:get DATABASE_URL --app=rfcbot-rs) \
    diesel migration run
deploy:
  provider: script
  script: heroku container:release --app=rfcbot-rs
before_cache:
  # don't cache the cargo registry
  - rm -rf "$HOME/.cargo/registry"
cache:
  directories:
    - "$HOME/.cargo"

Print docker-compose logs only on failure.
Print docker-compose logs only on failure.
