language: python
dist: xenial
sudo: required

matrix:
    include:
        - name: "Windows, Python Latest: multiprocessing"
          os: windows
          language: sh
          python: 3.x  # only works on linux
          before_install:
              - choco install python3 --params "/InstallDir:C:\\Python"
              - export PATH="/c/Python:/c/Python/Scripts:$PATH"
              - python -m pip install --upgrade pip wheel

        - name: "Windows, Python 3.7: multiprocessing"
          os: windows
          python: 3.7  # only works on linux
          language: sh
          before_install:
              - choco install python3 --version 3.7.4 --params "/InstallDir:C:\\Python"
              - export PATH="/c/Python:/c/Python/Scripts:$PATH"
              - python -m pip install --upgrade pip wheel

        - name: "Python 3.7: multiprocessing"
          python: 3.7  # this works for Linux but is ignored on macOS or Windows
          env: SPAWN_BACKEND="mp"
        - name: "Python 3.7: trio-run-in-process"
          python: 3.7  # this works for Linux but is ignored on macOS or Windows
          env: SPAWN_BACKEND="trio_run_in_process"

        - name: "Python 3.8: multiprocessing"
          python: 3.8  # this works for Linux but is ignored on macOS or Windows
          env: SPAWN_BACKEND="mp"
        - name: "Python 3.8: trio-run-in-process"
          python: 3.8  # this works for Linux but is ignored on macOS or Windows
          env: SPAWN_BACKEND="trio_run_in_process"

install:
    - cd $TRAVIS_BUILD_DIR
    - pip install -U pip
    - pip install -U . -r requirements-test.txt --upgrade-strategy eager

script:
    - mypy tractor/ --ignore-missing-imports
    - pytest tests/ --no-print-logs --spawn-backend=${SPAWN_BACKEND}