From 3874fca5ab0723ce4962d4114a14e471415ec74f Mon Sep 17 00:00:00 2001 From: Nicola Coretti Date: Wed, 11 Dec 2024 11:18:01 +0100 Subject: [PATCH] Add nox tasks to output python and exasol versions for builds --- exasol/toolbox/nox/_ci.py | 32 ++++++++++++++++++++++++++++++++ exasol/toolbox/nox/tasks.py | 8 +++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 exasol/toolbox/nox/_ci.py diff --git a/exasol/toolbox/nox/_ci.py b/exasol/toolbox/nox/_ci.py new file mode 100644 index 000000000..4dd9214ef --- /dev/null +++ b/exasol/toolbox/nox/_ci.py @@ -0,0 +1,32 @@ +import json + +import nox +from nox import Session + + +def _python_matrix(): + return {"python-version": ["3.9", "3.10", "3.11", "3.12"]} + + +def _exasol_matrix(): + return {"exasol-version": ["7.1.9"]} + + +@nox.session(name="matrix:python", python=False) +def python_matrix(session: Session) -> None: + """Output the build matrix for Python versions as JSON.""" + print(json.dumps(_python_matrix())) + + +@nox.session(name="matrix:exasol", python=False) +def exasol_matrix(session: Session) -> None: + """Output the build matrix for Exasol versions as JSON.""" + print(json.dumps(_exasol_matrix())) + + +@nox.session(name="matrix:all", python=False) +def full_matrix(session: Session) -> None: + """Output the full build matrix for Python & Exasol versions as JSON.""" + matrix = _python_matrix() + matrix.update(_exasol_matrix()) + print(json.dumps(matrix)) diff --git a/exasol/toolbox/nox/tasks.py b/exasol/toolbox/nox/tasks.py index 3592abbd7..99fe598df 100644 --- a/exasol/toolbox/nox/tasks.py +++ b/exasol/toolbox/nox/tasks.py @@ -59,7 +59,6 @@ def check(session: Session) -> None: clean_docs, open_docs, ) -from exasol.toolbox.nox._release import prepare_release from exasol.toolbox.nox._shared import ( Mode, _context, @@ -67,6 +66,13 @@ def check(session: Session) -> None: python_files, ) +from exasol.toolbox.nox._ci import ( + python_matrix, + exasol_matrix, + full_matrix, +) + +from exasol.toolbox.nox._release import prepare_release # isort: on # fmt: on