machine:
  services:
    - docker

# Borrowed from: https://github.com/mozilla/embedly-proxy
dependencies:
  # Keep the docker cache dir.
  cache_directories:
    - "~/docker"

  override:
    - docker info

    # Build Docker images while managing the caching properly.
    - scripts/docker_images_manager.sh load
    - make build
    - scripts/docker_images_manager.sh save

    # Prepare the SauceLabs connect tunnel.
    - scripts/launch_sc.sh:
        background: true
    - scripts/wait_until_sc_ready.sh

test:
  override:
    - make test-api
    - make test-webapp
    - make test-functional-api
    - make test-functional-webapp

  post:
      - killall --wait sc  # wait for Sauce Connect to close the tunnel
