- !Image
  name: py37
  from: &py37 !DockerImage python:3.7.12-slim
  repository: localhost/grpclib/py37
  tasks:
  - run: pip3 install --no-cache-dir -r {{runtime}}
    runtime: !File "requirements/runtime.txt"

- !Image
  name: test37
  from: *py37
  repository: localhost/grpclib/test37
  tasks:
  - run: pip3 install --no-cache-dir -r {{test}}
    test: !File "requirements/test.txt"

- !Image
  name: check37
  from: *py37
  repository: localhost/grpclib/check37
  tasks:
  - run: pip3 install --no-cache-dir -r {{check}}
    check: !File "requirements/check.txt"

- !Image
  name: docs37
  from: *py37
  repository: localhost/grpclib/docs37
  tasks:
  - run: pip3 install --no-cache-dir -r {{docs}}
    docs: !File "requirements/docs.txt"


- !Image
  name: py38
  from: &py38 !DockerImage python:3.8.3-slim
  repository: localhost/grpclib/py38
  tasks:
  - run: pip3 install --no-cache-dir -r {{runtime}}
    runtime: !File "requirements/runtime.txt"

- !Image
  name: test38
  from: *py38
  repository: localhost/grpclib/test38
  tasks:
  - run: pip3 install --no-cache-dir -r {{test}}
    test: !File "requirements/test.txt"


- !Command
  name: server
  image: py38
  run: python3 -m helloworld.server
  network-name: server
  environ:
    PYTHONPATH: examples
  ports:
  - !Expose { port: 50051, as: 50051 }

- !Command
  name: client
  image: py38
  run: python3 -m helloworld.client
  environ:
    PYTHONPATH: examples

- !Command
  name: docs
  image: docs37
  run: sphinx-build -b html docs build
  environ:
    PYTHONPATH: .

- !Command
  name: test37
  image: test37
  run: [py.test]
  environ:
    PYTHONPATH: .

- !Command
  name: test38
  image: test38
  run: [py.test]
  environ:
    PYTHONPATH: .

- !Command
  name: flake8
  image: check37
  run: [flake8]

- !Command
  name: mypy
  image: check37
  run: [mypy]


- !Image
  name: py310
  from: &py310 !DockerImage python:3.10.0-slim
  repository: localhost/grpclib/py310
  tasks:
  - run: pip3 install --no-cache-dir -r {{runtime}}
    runtime: !File "requirements/runtime.txt"

- !Image
  name: test310
  from: *py310
  repository: localhost/grpclib/test310
  tasks:
  - run: pip3 install --no-cache-dir -r {{test}}
    test: !File "requirements/test.txt"

- !Command
  name: test310
  image: test310
  run: [py.test]
  environ:
    PYTHONPATH: .


- !Image
  name: pip-compile
  from: !DockerImage python:3.7.12-slim
  repository: localhost/grpclib/pip-compile
  tasks:
  - run: pip3 install --no-cache-dir pip-tools

- !Command
  name: upgrade
  image: pip-compile
  run: |
    pip-compile -U --annotation-style=line setup.py -o setup.txt
    pip-compile -U --annotation-style=line requirements/runtime.in
    pip-compile -U --annotation-style=line requirements/docs.in
    pip-compile -U --annotation-style=line requirements/test.in
    pip-compile -U --annotation-style=line requirements/check.in
    pip-compile -U --annotation-style=line requirements/release.in
