# this file is not designed to be run directly
# instead, use the docker-compose.<os>.<swift> files
# eg docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.2004.56.yaml run test
version: "3"

services:
  runtime-setup:
    image: swift-async-algorithms:default
    build:
      context: .
      dockerfile: Dockerfile

  common: &common
    image: swift-async-algorithms:default
    depends_on: [runtime-setup]
    volumes:
      - ~/.ssh:/root/.ssh
      - ..:/code:z
    working_dir: /code

  soundness:
    <<: *common
    command: /bin/bash -xcl "swift -version && uname -a && ./scripts/soundness.sh"

  build:
    <<: *common
    environment: []
    command: /bin/bash -cl "swift build"

  test:
    <<: *common
    depends_on: [runtime-setup]
    command: /bin/bash -xcl "swift $${SWIFT_TEST_VERB-test} $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-}"

  # util

  shell:
    <<: *common
    entrypoint: /bin/bash
