diff --git a/README.md b/README.md index e53a639aad9ff89efd5fcc7ce1970b470eb78823..7c2b877419627dad217ac35bb64d6a6f5de2c39c 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,37 @@ dependencies = [ "pytest>=8.0.0,<9", ... ] -```` +``` + +## Use Multiple Python Versions + +For some jobs, it can be relevant to use multiple Python versions, such as: + +- Test jobs: `py-unittest`, `py-pytest`, `py-nosetest` +- `py-publish` jobs (especially if you're not generating a pure Python package) + +This setup is done by defining the PYTHON_IMAGE variable with a parallel/matrix strategy in your .gitlab-ci.yml. + +For example, to run py-test jobs using both python:3.13-slim and python:3.12-alpine: + +```yaml +py-pytest: + parallel: + matrix: + - PYTHON_IMAGE: python:3.13-slim + - PYTHON_IMAGE: python:3.12-alpine +``` + +If your tests cannot be executed concurrently due to shared resources (e.g. database access), you can use the `resource_group` feature to limit parallel execution: + +```yaml +py-pytest: + parallel: + matrix: + - PYTHON_IMAGE: python:3.13-slim + - PYTHON_IMAGE: python:3.12-alpine + resource_group: db_access_tests +``` ## Jobs