-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnoxconfig.py
More file actions
89 lines (71 loc) · 2.74 KB
/
noxconfig.py
File metadata and controls
89 lines (71 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
"""Configuration for nox based task runner"""
from __future__ import annotations
from pathlib import Path
from pydantic import computed_field
from exasol.toolbox.config import BaseConfig
from exasol.toolbox.nox.plugin import hookimpl
from exasol.toolbox.tools.replace_version import update_github_yml
from exasol.toolbox.util.release.cookiecutter import (
COOKIECUTTER_JSON,
update_cookiecutter_default,
)
from exasol.toolbox.util.version import Version
class UpdateTemplates:
PARENT_PATH: Path = Path(__file__).parent
@property
def github_template_workflows(self) -> list[Path]:
gh_workflows = (
self.PARENT_PATH
/ "exasol"
/ "toolbox"
/ "templates"
/ "github"
/ "workflows"
)
return [f for f in gh_workflows.iterdir() if f.is_file()]
@property
def github_actions(self) -> list[Path]:
gh_actions = self.PARENT_PATH / ".github" / "actions"
return [f for f in gh_actions.rglob("*") if f.is_file()]
@hookimpl
def prepare_release_update_version(self, session, config, version: Version) -> None:
for workflow in self.github_template_workflows:
update_github_yml(workflow, version)
for action in self.github_actions:
update_github_yml(action, version)
update_cookiecutter_default(version)
@hookimpl
def prepare_release_add_files(self, session, config) -> list[Path]:
return (
self.github_template_workflows + self.github_actions + [COOKIECUTTER_JSON]
)
ROOT_PATH = Path(__file__).parent
class Config(BaseConfig):
@computed_field # type: ignore[misc]
@property
def importlinter(self) -> Path:
"""
Path for the import lint configuration file.
This is an experimental feature that requires further scrutiny. This will
be done in:
https://github.com/exasol/python-toolbox/issues/628
"""
return self.root_path / ".import_linter_config"
PROJECT_CONFIG = Config(
root_path=ROOT_PATH,
project_name="toolbox",
add_to_excluded_python_paths=(
# The cookiecutter placeholders do not work well with checks.
# Instead, the format & linting are checked in the
# ``test.integration.project-template``.
"project-template",
# This file comes from poetry (https://install.python-poetry.org/),
# so we should not modify it.
".github/actions/python-environment/ext/get_poetry.py",
),
create_major_version_tags=True,
# The PTB does not have integration tests run with an Exasol DB,
# so for running in the CI, we take the first element.
exasol_versions=("7.1.30",),
plugins_for_nox_sessions=(UpdateTemplates,),
)