freebsd_instance:
  image_family: freebsd-13-0
  cpu: 1
  memory: 4G

test_task:
  name: "Tests / FreeBSD / "
  only_if: $CIRRUS_TAG == ''
  skip: "!changesInclude('.cirrus.yml', 'poetry.lock', 'pyproject.toml', '**.json','**.py')"
  env:
    # `SHELL` environment variable is not set by default, so we explicitly set it to
    # avoid failures on tests that depend on it.
    SHELL: sh
    matrix:
      - PYTHON: python3.7
      - PYTHON: python3.8
      - PYTHON: python3.9
      - PYTHON: python3.10
  pkg_script:
    - PYPACKAGE=$(printf '%s' $PYTHON | tr -d '.')
    - SQLPACKAGE=$(printf '%s-sqlite3' $PYPACKAGE | sed 's/thon//')
    - pkg install -y git-lite curl $PYPACKAGE $SQLPACKAGE
  pip_script:
    - $PYTHON -m ensurepip
    - $PYTHON -m pip --disable-pip-version-check install -U pip
  env_script:
    - echo "PATH=/.local/bin:${PATH}" >> $CIRRUS_ENV
  poetry_script:
    - curl -sL https://install.python-poetry.org | $PYTHON - -y
    - poetry config virtualenvs.in-project true
  test_script:
    - poetry install
    - poetry run pytest -n auto -q --junitxml=junit.xml tests
  on_failure:
    annotate_failure_artifacts:
      path: junit.xml
      format: junit
      type: text/xml
