forked from python-poetry/poetry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In particular, run mypy on FreeBSD in a parallel workflow to pytest. Also modernize how we install/set up Poetry, and improve job names.
- Loading branch information
1 parent
eb78cdd
commit 1c2b505
Showing
1 changed file
with
70 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,78 @@ | ||
freebsd_instance: | ||
image_family: freebsd-14-0 | ||
cpu: 2 | ||
memory: 4G | ||
|
||
test_task: | ||
name: "Tests / FreeBSD / " | ||
only_if: $CIRRUS_TAG == '' | ||
skip: "!changesInclude('.cirrus.yml', 'poetry.lock', 'pyproject.toml', 'src/**.py', 'tests/**')" | ||
tests_task: | ||
# We skip running Cirrus on tags to match GHA. | ||
only_if: ¬_tag $CIRRUS_TAG == '' | ||
|
||
# We only use Cirrus CI for FreeBSD at present; the rest of this workflow assumes this. | ||
freebsd_instance: | ||
image_family: freebsd-14-0 | ||
# Cirrus has a concurrency limit of 8 vCPUs for FreeBSD. Allow executing 4 tasks in parallel. | ||
cpu: 2 | ||
memory: 2G | ||
|
||
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.8 | ||
PYTHON_VERSION: 3.8 | ||
PYTHON_PACKAGE: python38 | ||
SQLITE_PACKAGE: py38-sqlite3 | ||
- PYTHON: python3.9 | ||
PYTHON_VERSION: 3.9 | ||
PYTHON_PACKAGE: python39 | ||
SQLITE_PACKAGE: py39-sqlite3 | ||
- PYTHON: python3.10 | ||
PYTHON_VERSION: 3.10 | ||
PYTHON_PACKAGE: python310 | ||
SQLITE_PACKAGE: py310-sqlite3 | ||
- PYTHON: python3.11 | ||
install_prereqs_script: | ||
- V=$(printf '%s' $PYTHON | tr -d '.[:alpha:]') | ||
- pkg install -y python${V} py${V}-sqlite3 | ||
install_poetry_script: | ||
- POETRY_HOME=/opt/poetry | ||
PYTHON_VERSION: 3.11 | ||
PYTHON_PACKAGE: python311 | ||
SQLITE_PACKAGE: py311-sqlite3 | ||
# FIXME: Python 3.12 is not available in Ports. | ||
# - PYTHON: python3.12 | ||
# PYTHON_VERSION: 3.12 | ||
# PYTHON_PACKAGE: python312 | ||
# SQLITE_PACKAGE: py312-sqlite3 | ||
# FIXME: use pipx for install. pipx is currently broken in Ports. | ||
POETRY_HOME: /opt/poetry | ||
# SHELL is not set by default, and we have tests that depend on it. | ||
SHELL: sh | ||
|
||
bootstrap_poetry_script: | ||
- pkg install -y $PYTHON_PACKAGE $SQLITE_PACKAGE | ||
- $PYTHON -m venv $POETRY_HOME | ||
- $POETRY_HOME/bin/pip install --upgrade pip setuptools wheel | ||
- $POETRY_HOME/bin/pip install poetry | ||
- echo "PATH=$POETRY_HOME/bin:$PATH" >> $CIRRUS_ENV | ||
install_and_test_script: | ||
- poetry install | ||
- poetry run pytest --junitxml=junit.xml -v | ||
on_failure: | ||
annotate_failure_artifacts: | ||
path: junit.xml | ||
format: junit | ||
type: text/xml | ||
- echo "PATH=${POETRY_HOME}/bin:${PATH}" >> $CIRRUS_ENV | ||
|
||
setup_environment_script: | ||
- poetry install --sync | ||
- poetry env info | ||
- poetry show | ||
|
||
matrix: | ||
- alias: pytest | ||
name: "Tests / FreeBSD (Python ${PYTHON_VERSION}) / pytest" | ||
skip: "!changesInclude('.cirrus.yml', 'poetry.lock', 'pyproject.toml', 'src/**.py', 'tests/**')" | ||
pytest_script: poetry run pytest --integration -v --junitxml=junit.xml | ||
on_failure: | ||
annotate_failure_artifacts: | ||
path: junit.xml | ||
format: junit | ||
type: text/xml | ||
|
||
- alias: mypy | ||
name: "Tests / FreeBSD (Python ${PYTHON_VERSION}) / mypy" | ||
skip: "!changesInclude('.cirrus.yml', 'poetry.lock', 'pyproject.toml', 'src/**.py')" | ||
mypy_script: poetry run mypy | ||
|
||
status_task: | ||
name: "Tests / FreeBSD Status" | ||
|
||
only_if: *not_tag | ||
depends_on: | ||
- pytest | ||
- mypy | ||
|
||
container: | ||
image: alpine:latest | ||
cpu: 0.5 | ||
memory: 512M |