Skip to content

Commit a5f618d

Browse files
committed
Update matrix generation tasks
1 parent f86e4e4 commit a5f618d

File tree

1 file changed

+35
-8
lines changed

1 file changed

+35
-8
lines changed

exasol/toolbox/nox/_ci.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,59 @@
11
import json
2+
import logging
23

34
import nox
45
from nox import Session
56

7+
from noxconfig import (
8+
PROJECT_CONFIG,
9+
Config,
10+
)
611

7-
def _python_matrix():
8-
return {"python-version": ["3.9", "3.10", "3.11", "3.12"]}
12+
_log = logging.getLogger(__name__)
913

14+
_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"]
15+
_EXASOL_VERSIONS = ["7.1.9"]
1016

11-
def _exasol_matrix():
12-
return {"exasol-version": ["7.1.9"]}
17+
18+
def _python_matrix(config: Config):
19+
attr = "python_versions"
20+
python_versions = getattr(config, attr, _PYTHON_VERSIONS)
21+
if not hasattr(config, attr):
22+
_log.warning(
23+
"Config does not contain '%s' setting. Using default: %s",
24+
attr,
25+
_PYTHON_VERSIONS,
26+
)
27+
return {"python-version": python_versions}
28+
29+
30+
def _exasol_matrix(config: Config):
31+
attr = "exasol_versions"
32+
exasol_versions = getattr(config, attr, _EXASOL_VERSIONS)
33+
if not hasattr(config, attr):
34+
_log.warning(
35+
"Config does not contain '%s' setting. Using default: %s",
36+
attr,
37+
_EXASOL_VERSIONS,
38+
)
39+
return {"exasol-version": exasol_versions}
1340

1441

1542
@nox.session(name="matrix:python", python=False)
1643
def python_matrix(session: Session) -> None:
1744
"""Output the build matrix for Python versions as JSON."""
18-
print(json.dumps(_python_matrix()))
45+
print(json.dumps(_python_matrix(PROJECT_CONFIG)))
1946

2047

2148
@nox.session(name="matrix:exasol", python=False)
2249
def exasol_matrix(session: Session) -> None:
2350
"""Output the build matrix for Exasol versions as JSON."""
24-
print(json.dumps(_exasol_matrix()))
51+
print(json.dumps(_exasol_matrix(PROJECT_CONFIG)))
2552

2653

2754
@nox.session(name="matrix:all", python=False)
2855
def full_matrix(session: Session) -> None:
2956
"""Output the full build matrix for Python & Exasol versions as JSON."""
30-
matrix = _python_matrix()
31-
matrix.update(_exasol_matrix())
57+
matrix = _python_matrix(PROJECT_CONFIG)
58+
matrix.update(_exasol_matrix(PROJECT_CONFIG))
3259
print(json.dumps(matrix))

0 commit comments

Comments
 (0)