gha-utils 4.14.0__tar.gz → 4.14.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gha-utils might be problematic. Click here for more details.
- {gha_utils-4.14.0 → gha_utils-4.14.1}/PKG-INFO +6 -3
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils/__init__.py +1 -1
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils/cli.py +10 -7
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils/metadata.py +1 -1
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils/test_plan.py +58 -38
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils.egg-info/PKG-INFO +6 -3
- {gha_utils-4.14.0 → gha_utils-4.14.1}/pyproject.toml +2 -2
- {gha_utils-4.14.0 → gha_utils-4.14.1}/readme.md +5 -2
- gha_utils-4.14.1/tests/test_metadata.py +143 -0
- gha_utils-4.14.0/tests/test_metadata.py +0 -89
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils/__main__.py +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils/changelog.py +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils/mailmap.py +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils/matrix.py +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils/py.typed +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils.egg-info/SOURCES.txt +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils.egg-info/dependency_links.txt +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils.egg-info/entry_points.txt +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils.egg-info/requires.txt +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/gha_utils.egg-info/top_level.txt +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/setup.cfg +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/tests/test_changelog.py +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/tests/test_mailmap.py +0 -0
- {gha_utils-4.14.0 → gha_utils-4.14.1}/tests/test_matrix.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: gha-utils
|
|
3
|
-
Version: 4.14.
|
|
3
|
+
Version: 4.14.1
|
|
4
4
|
Summary: ⚙️ CLI helpers for GitHub Actions + reuseable workflows
|
|
5
5
|
Author-email: Kevin Deldycke <kevin@deldycke.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/kdeldycke/workflows
|
|
@@ -103,7 +103,6 @@ Thanks to `uv`, you can install and run `gha-utils` in one command, without poll
|
|
|
103
103
|
|
|
104
104
|
```shell-session
|
|
105
105
|
$ uvx gha-utils
|
|
106
|
-
Installed 45 packages in 45ms
|
|
107
106
|
Usage: gha-utils [OPTIONS] COMMAND [ARGS]...
|
|
108
107
|
|
|
109
108
|
Options:
|
|
@@ -118,8 +117,11 @@ Options:
|
|
|
118
117
|
utils/*.{toml,yaml,yml,json,ini,xml}]
|
|
119
118
|
--show-params Show all CLI parameters, their provenance, defaults
|
|
120
119
|
and value, then exit.
|
|
121
|
-
|
|
120
|
+
--verbosity LEVEL Either CRITICAL, ERROR, WARNING, INFO, DEBUG.
|
|
122
121
|
[default: WARNING]
|
|
122
|
+
-v, --verbose Increase the default WARNING verbosity by one level
|
|
123
|
+
for each additional repetition of the option.
|
|
124
|
+
[default: 0]
|
|
123
125
|
--version Show the version and exit.
|
|
124
126
|
-h, --help Show this message and exit.
|
|
125
127
|
|
|
@@ -127,6 +129,7 @@ Commands:
|
|
|
127
129
|
changelog Maintain a Markdown-formatted changelog
|
|
128
130
|
mailmap-sync Update Git's .mailmap file with missing contributors
|
|
129
131
|
metadata Output project metadata
|
|
132
|
+
test-plan Run a test plan from a file against a binary
|
|
130
133
|
```
|
|
131
134
|
|
|
132
135
|
```shell-session
|
|
@@ -27,7 +27,7 @@ import click
|
|
|
27
27
|
from click_extra import (
|
|
28
28
|
Choice,
|
|
29
29
|
Context,
|
|
30
|
-
|
|
30
|
+
FloatRange,
|
|
31
31
|
argument,
|
|
32
32
|
echo,
|
|
33
33
|
extra_group,
|
|
@@ -289,19 +289,22 @@ def mailmap_sync(ctx, source, create_if_missing, destination_mailmap):
|
|
|
289
289
|
@option(
|
|
290
290
|
"-t",
|
|
291
291
|
"--timeout",
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
# Timeout passed to subprocess.run() is a float that is silently clamped to
|
|
293
|
+
# 0.0 is negative values are provided, so we mimic this behavior here:
|
|
294
|
+
# https://github.com/python/cpython/blob/5740b95076b57feb6293cda4f5504f706a7d622d/Lib/subprocess.py#L1596-L1597
|
|
295
|
+
type=FloatRange(min=0, clamp=True),
|
|
296
|
+
help="Set the default timeout for each CLI call, if not specified in the "
|
|
297
|
+
"test plan.",
|
|
295
298
|
)
|
|
296
|
-
def test_plan(binary, plan, timeout):
|
|
299
|
+
def test_plan(binary: Path, plan: Path | None, timeout: float | None) -> None:
|
|
297
300
|
# Load test plan from workflow input, or use a default one.
|
|
298
301
|
if plan:
|
|
299
302
|
logging.debug(f"Read test plan from {plan}")
|
|
300
303
|
test_plan = parse_test_plan(plan)
|
|
301
304
|
else:
|
|
302
305
|
logging.warning(f"No test plan provided. Default to: {DEFAULT_TEST_PLAN}")
|
|
303
|
-
test_plan = DEFAULT_TEST_PLAN
|
|
306
|
+
test_plan = DEFAULT_TEST_PLAN # type: ignore[assignment]
|
|
304
307
|
|
|
305
308
|
for index, test_case in enumerate(test_plan):
|
|
306
309
|
logging.info(f"Run test #{index}")
|
|
307
|
-
test_case.check_cli_test(binary,
|
|
310
|
+
test_case.check_cli_test(binary, default_timeout=timeout)
|
|
@@ -16,10 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
from __future__ import annotations
|
|
18
18
|
|
|
19
|
+
import logging
|
|
19
20
|
import re
|
|
20
21
|
from dataclasses import asdict, dataclass, field
|
|
21
22
|
from pathlib import Path
|
|
22
|
-
from subprocess import run
|
|
23
|
+
from subprocess import TimeoutExpired, run
|
|
23
24
|
from typing import Generator, Sequence
|
|
24
25
|
|
|
25
26
|
import yaml
|
|
@@ -33,6 +34,7 @@ class TestCase:
|
|
|
33
34
|
cli_parameters: tuple[str, ...] | str = field(default_factory=tuple)
|
|
34
35
|
"""Parameters, arguments and options to pass to the CLI."""
|
|
35
36
|
|
|
37
|
+
timeout: float | str | None = None
|
|
36
38
|
exit_code: int | str | None = None
|
|
37
39
|
strip_ansi: bool = False
|
|
38
40
|
output_contains: tuple[str, ...] | str = field(default_factory=tuple)
|
|
@@ -48,13 +50,24 @@ class TestCase:
|
|
|
48
50
|
def __post_init__(self) -> None:
|
|
49
51
|
"""Normalize all fields."""
|
|
50
52
|
for field_id, field_data in asdict(self).items():
|
|
51
|
-
# Validates and normalize
|
|
53
|
+
# Validates and normalize integer properties.
|
|
52
54
|
if field_id == "exit_code":
|
|
53
55
|
if isinstance(field_data, str):
|
|
54
56
|
field_data = int(field_data)
|
|
55
57
|
elif field_data is not None and not isinstance(field_data, int):
|
|
56
58
|
raise ValueError(f"exit_code is not an integer: {field_data}")
|
|
57
59
|
|
|
60
|
+
# Validates and normalize float properties.
|
|
61
|
+
elif field_id == "timeout":
|
|
62
|
+
if isinstance(field_data, str):
|
|
63
|
+
field_data = float(field_data)
|
|
64
|
+
elif field_data is not None and not isinstance(field_data, float):
|
|
65
|
+
raise ValueError(f"timeout is not a float: {field_data}")
|
|
66
|
+
# Timeout can only be unset or positive.
|
|
67
|
+
if field_data and field_data < 0:
|
|
68
|
+
raise ValueError(f"timeout is negative: {field_data}")
|
|
69
|
+
|
|
70
|
+
# Validates and normalize boolean properties.
|
|
58
71
|
elif field_id == "strip_ansi":
|
|
59
72
|
if not isinstance(field_data, bool):
|
|
60
73
|
raise ValueError(f"strip_ansi is not a boolean: {field_data}")
|
|
@@ -96,51 +109,58 @@ class TestCase:
|
|
|
96
109
|
|
|
97
110
|
setattr(self, field_id, field_data)
|
|
98
111
|
|
|
99
|
-
def check_cli_test(self, binary: str | Path,
|
|
112
|
+
def check_cli_test(self, binary: str | Path, default_timeout: float | None):
|
|
100
113
|
"""Run a CLI command and check its output against the test case.
|
|
101
114
|
|
|
102
115
|
..todo::
|
|
103
116
|
Add support for environment variables.
|
|
104
117
|
|
|
105
|
-
..todo::
|
|
106
|
-
Add support for ANSI code stripping.
|
|
107
|
-
|
|
108
118
|
..todo::
|
|
109
119
|
Add support for proper mixed stdout/stderr stream as a single,
|
|
110
120
|
intertwined output.
|
|
111
121
|
"""
|
|
122
|
+
if self.timeout is None and default_timeout is not None:
|
|
123
|
+
logging.info(f"Set default test case timeout to {default_timeout} seconds")
|
|
124
|
+
self.timeout = default_timeout
|
|
125
|
+
|
|
112
126
|
clean_args = args_cleanup(binary, self.cli_parameters)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
127
|
+
try:
|
|
128
|
+
result = run(
|
|
129
|
+
clean_args,
|
|
130
|
+
capture_output=True,
|
|
131
|
+
timeout=self.timeout, # type: ignore[arg-type]
|
|
132
|
+
# XXX Do not force encoding to let CLIs figure out by
|
|
133
|
+
# themselves the contextual encoding to use. This avoid
|
|
134
|
+
# UnicodeDecodeError on output in Window's console which still
|
|
135
|
+
# defaults to legacy encoding (e.g. cp1252, cp932, etc...):
|
|
136
|
+
#
|
|
137
|
+
# Traceback (most recent call last):
|
|
138
|
+
# File "…\__main__.py", line 49, in <module>
|
|
139
|
+
# File "…\__main__.py", line 45, in main
|
|
140
|
+
# File "…\click\core.py", line 1157, in __call__
|
|
141
|
+
# File "…\click_extra\commands.py", line 347, in main
|
|
142
|
+
# File "…\click\core.py", line 1078, in main
|
|
143
|
+
# File "…\click_extra\commands.py", line 377, in invoke
|
|
144
|
+
# File "…\click\core.py", line 1688, in invoke
|
|
145
|
+
# File "…\click_extra\commands.py", line 377, in invoke
|
|
146
|
+
# File "…\click\core.py", line 1434, in invoke
|
|
147
|
+
# File "…\click\core.py", line 783, in invoke
|
|
148
|
+
# File "…\cloup\_context.py", line 47, in new_func
|
|
149
|
+
# File "…\mpm\cli.py", line 570, in managers
|
|
150
|
+
# File "…\mpm\output.py", line 187, in print_table
|
|
151
|
+
# File "…\click_extra\tabulate.py", line 97, in render_csv
|
|
152
|
+
# File "encodings\cp1252.py", line 19, in encode
|
|
153
|
+
# UnicodeEncodeError: 'charmap' codec can't encode character
|
|
154
|
+
# '\u2713' in position 128: character maps to <undefined>
|
|
155
|
+
#
|
|
156
|
+
# encoding="utf-8",
|
|
157
|
+
text=True,
|
|
158
|
+
)
|
|
159
|
+
except TimeoutExpired as ex:
|
|
160
|
+
raise TimeoutError(
|
|
161
|
+
f"CLI timed out after {self.timeout} seconds: {clean_args}"
|
|
162
|
+
) from ex
|
|
163
|
+
|
|
144
164
|
print_cli_run(clean_args, result)
|
|
145
165
|
|
|
146
166
|
for field_id, field_data in asdict(self).items():
|
|
@@ -157,7 +177,7 @@ class TestCase:
|
|
|
157
177
|
output = ""
|
|
158
178
|
name = ""
|
|
159
179
|
if field_id.startswith("output_"):
|
|
160
|
-
raise NotImplementedError("
|
|
180
|
+
raise NotImplementedError("<stdout>/<stderr> output mix")
|
|
161
181
|
# output = result.output
|
|
162
182
|
# name = "output"
|
|
163
183
|
elif field_id.startswith("stdout_"):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: gha-utils
|
|
3
|
-
Version: 4.14.
|
|
3
|
+
Version: 4.14.1
|
|
4
4
|
Summary: ⚙️ CLI helpers for GitHub Actions + reuseable workflows
|
|
5
5
|
Author-email: Kevin Deldycke <kevin@deldycke.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/kdeldycke/workflows
|
|
@@ -103,7 +103,6 @@ Thanks to `uv`, you can install and run `gha-utils` in one command, without poll
|
|
|
103
103
|
|
|
104
104
|
```shell-session
|
|
105
105
|
$ uvx gha-utils
|
|
106
|
-
Installed 45 packages in 45ms
|
|
107
106
|
Usage: gha-utils [OPTIONS] COMMAND [ARGS]...
|
|
108
107
|
|
|
109
108
|
Options:
|
|
@@ -118,8 +117,11 @@ Options:
|
|
|
118
117
|
utils/*.{toml,yaml,yml,json,ini,xml}]
|
|
119
118
|
--show-params Show all CLI parameters, their provenance, defaults
|
|
120
119
|
and value, then exit.
|
|
121
|
-
|
|
120
|
+
--verbosity LEVEL Either CRITICAL, ERROR, WARNING, INFO, DEBUG.
|
|
122
121
|
[default: WARNING]
|
|
122
|
+
-v, --verbose Increase the default WARNING verbosity by one level
|
|
123
|
+
for each additional repetition of the option.
|
|
124
|
+
[default: 0]
|
|
123
125
|
--version Show the version and exit.
|
|
124
126
|
-h, --help Show this message and exit.
|
|
125
127
|
|
|
@@ -127,6 +129,7 @@ Commands:
|
|
|
127
129
|
changelog Maintain a Markdown-formatted changelog
|
|
128
130
|
mailmap-sync Update Git's .mailmap file with missing contributors
|
|
129
131
|
metadata Output project metadata
|
|
132
|
+
test-plan Run a test plan from a file against a binary
|
|
130
133
|
```
|
|
131
134
|
|
|
132
135
|
```shell-session
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
# Docs: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
|
|
3
3
|
name = "gha-utils"
|
|
4
|
-
version = "4.14.
|
|
4
|
+
version = "4.14.1"
|
|
5
5
|
# Python versions and their status: https://devguide.python.org/versions/
|
|
6
6
|
requires-python = ">= 3.10"
|
|
7
7
|
description = "⚙️ CLI helpers for GitHub Actions + reuseable workflows"
|
|
@@ -138,7 +138,7 @@ addopts = [
|
|
|
138
138
|
xfail_strict = true
|
|
139
139
|
|
|
140
140
|
[tool.bumpversion]
|
|
141
|
-
current_version = "4.14.
|
|
141
|
+
current_version = "4.14.1"
|
|
142
142
|
allow_dirty = true
|
|
143
143
|
ignore_missing_files = true
|
|
144
144
|
|
|
@@ -36,7 +36,6 @@ Thanks to `uv`, you can install and run `gha-utils` in one command, without poll
|
|
|
36
36
|
|
|
37
37
|
```shell-session
|
|
38
38
|
$ uvx gha-utils
|
|
39
|
-
Installed 45 packages in 45ms
|
|
40
39
|
Usage: gha-utils [OPTIONS] COMMAND [ARGS]...
|
|
41
40
|
|
|
42
41
|
Options:
|
|
@@ -51,8 +50,11 @@ Options:
|
|
|
51
50
|
utils/*.{toml,yaml,yml,json,ini,xml}]
|
|
52
51
|
--show-params Show all CLI parameters, their provenance, defaults
|
|
53
52
|
and value, then exit.
|
|
54
|
-
|
|
53
|
+
--verbosity LEVEL Either CRITICAL, ERROR, WARNING, INFO, DEBUG.
|
|
55
54
|
[default: WARNING]
|
|
55
|
+
-v, --verbose Increase the default WARNING verbosity by one level
|
|
56
|
+
for each additional repetition of the option.
|
|
57
|
+
[default: 0]
|
|
56
58
|
--version Show the version and exit.
|
|
57
59
|
-h, --help Show this message and exit.
|
|
58
60
|
|
|
@@ -60,6 +62,7 @@ Commands:
|
|
|
60
62
|
changelog Maintain a Markdown-formatted changelog
|
|
61
63
|
mailmap-sync Update Git's .mailmap file with missing contributors
|
|
62
64
|
metadata Output project metadata
|
|
65
|
+
test-plan Run a test plan from a file against a binary
|
|
63
66
|
```
|
|
64
67
|
|
|
65
68
|
```shell-session
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Copyright Kevin Deldycke <kevin@deldycke.com> and contributors.
|
|
2
|
+
#
|
|
3
|
+
# This program is Free Software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU General Public License
|
|
5
|
+
# as published by the Free Software Foundation; either version 2
|
|
6
|
+
# of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU General Public License
|
|
14
|
+
# along with this program; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import re
|
|
20
|
+
|
|
21
|
+
from gha_utils.metadata import Dialects, Metadata
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_metadata_github_format():
|
|
25
|
+
metadata = Metadata()
|
|
26
|
+
|
|
27
|
+
assert re.fullmatch(
|
|
28
|
+
(
|
|
29
|
+
r"new_commits=\n"
|
|
30
|
+
r"release_commits=\n"
|
|
31
|
+
r"gitignore_exists=true\n"
|
|
32
|
+
r"python_files=[\S ]*\n"
|
|
33
|
+
r"doc_files=[\S ]*\n"
|
|
34
|
+
r"is_python_project=true\n"
|
|
35
|
+
r"package_name=gha-utils\n"
|
|
36
|
+
r"blacken_docs_params=--target-version py310 --target-version py311 "
|
|
37
|
+
r"--target-version py312 --target-version py313\n"
|
|
38
|
+
r"mypy_params=--python-version 3\.10\n"
|
|
39
|
+
r"current_version=\n"
|
|
40
|
+
r"released_version=\n"
|
|
41
|
+
r"is_sphinx=false\n"
|
|
42
|
+
r"active_autodoc=false\n"
|
|
43
|
+
r"release_notes=\n"
|
|
44
|
+
r"new_commits_matrix=\n"
|
|
45
|
+
r"release_commits_matrix=\n"
|
|
46
|
+
r'nuitka_matrix=\{"os": \["ubuntu-24\.04", "ubuntu-24\.04-arm", '
|
|
47
|
+
r'"macos-15", "macos-13", "windows-2022"\], '
|
|
48
|
+
r'"entry_point": \["gha-utils"\], "commit": \["[a-z0-9]+"\], '
|
|
49
|
+
r'"include": \[\{"entry_point": "gha-utils", '
|
|
50
|
+
r'"cli_id": "gha-utils", "module_id": "gha_utils\.__main__", '
|
|
51
|
+
r'"callable_id": "main", '
|
|
52
|
+
r'"module_path": "gha_utils(/|\\\\)__main__\.py"\}, '
|
|
53
|
+
r'\{"commit": "[a-z0-9]+", "short_sha": "[a-z0-9]+", '
|
|
54
|
+
r'"current_version": "4\.14\.1"\}, \{"os": "ubuntu-24\.04", '
|
|
55
|
+
r'"platform_id": "linux", "arch": "x64", "extension": "bin"\}, '
|
|
56
|
+
r'\{"os": "ubuntu-24\.04-arm", "platform_id": "linux", '
|
|
57
|
+
r'"arch": "arm64", "extension": "bin"\}, \{"os": "macos-15", '
|
|
58
|
+
r'"platform_id": "macos", "arch": "arm64", "extension": "bin"\}, '
|
|
59
|
+
r'\{"os": "macos-13", "platform_id": "macos", "arch": "x64", '
|
|
60
|
+
r'"extension": "bin"\}, \{"os": "windows-2022", '
|
|
61
|
+
r'"platform_id": "windows", "arch": "x64", "extension": "exe"\}, '
|
|
62
|
+
r'\{"os": "ubuntu-24\.04", "entry_point": "gha-utils", '
|
|
63
|
+
r'"commit": "[a-z0-9]+", '
|
|
64
|
+
r'"bin_name": "gha-utils-linux-x64-build-[a-z0-9]+\.bin"\}, '
|
|
65
|
+
r'\{"os": "ubuntu-24\.04-arm", "entry_point": "gha-utils", '
|
|
66
|
+
r'"commit": "[a-z0-9]+", '
|
|
67
|
+
r'"bin_name": "gha-utils-linux-arm64-build-[a-z0-9]+\.bin"\}, '
|
|
68
|
+
r'\{"os": "macos-15", "entry_point": "gha-utils", '
|
|
69
|
+
r'"commit": "[a-z0-9]+", '
|
|
70
|
+
r'"bin_name": "gha-utils-macos-arm64-build-[a-z0-9]+\.bin"\}, '
|
|
71
|
+
r'\{"os": "macos-13", "entry_point": "gha-utils", '
|
|
72
|
+
r'"commit": "[a-z0-9]+", '
|
|
73
|
+
r'"bin_name": "gha-utils-macos-x64-build-[a-z0-9]+\.bin"\}, '
|
|
74
|
+
r'\{"os": "windows-2022", "entry_point": "gha-utils", '
|
|
75
|
+
r'"commit": "[a-z0-9]+", '
|
|
76
|
+
r'"bin_name": "gha-utils-windows-x64-build-[a-z0-9]+\.exe"\}\]\}\n'
|
|
77
|
+
),
|
|
78
|
+
metadata.dump(Dialects.github),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_metadata_plain_format():
|
|
83
|
+
metadata = Metadata()
|
|
84
|
+
|
|
85
|
+
assert re.fullmatch(
|
|
86
|
+
(
|
|
87
|
+
r"\{"
|
|
88
|
+
r"'new_commits': None, "
|
|
89
|
+
r"'release_commits': None, "
|
|
90
|
+
r"'gitignore_exists': True, "
|
|
91
|
+
r"'python_files': <generator object Metadata\.python_files at \S+>, "
|
|
92
|
+
r"'doc_files': <generator object Metadata\.doc_files at \S+>, "
|
|
93
|
+
r"'is_python_project': True, "
|
|
94
|
+
r"'package_name': 'gha-utils', "
|
|
95
|
+
r"'blacken_docs_params': \("
|
|
96
|
+
r"'--target-version py310', "
|
|
97
|
+
r"'--target-version py311', "
|
|
98
|
+
r"'--target-version py312', "
|
|
99
|
+
r"'--target-version py313'\), "
|
|
100
|
+
r"'mypy_params': '--python-version 3\.10', "
|
|
101
|
+
r"'current_version': None, "
|
|
102
|
+
r"'released_version': None, "
|
|
103
|
+
r"'is_sphinx': False, "
|
|
104
|
+
r"'active_autodoc': False, "
|
|
105
|
+
r"'release_notes': None, "
|
|
106
|
+
r"'new_commits_matrix': None, "
|
|
107
|
+
r"'release_commits_matrix': None, "
|
|
108
|
+
r"'nuitka_matrix': <Matrix: \{"
|
|
109
|
+
r"'os': \('ubuntu-24\.04', 'ubuntu-24\.04-arm', "
|
|
110
|
+
r"'macos-15', 'macos-13', 'windows-2022'\), "
|
|
111
|
+
r"'entry_point': \('gha-utils',\), "
|
|
112
|
+
r"'commit': \('[a-z0-9]+',\)\}; "
|
|
113
|
+
r"include=\(\{'entry_point': 'gha-utils', 'cli_id': 'gha-utils', "
|
|
114
|
+
r"'module_id': 'gha_utils\.__main__', 'callable_id': 'main', "
|
|
115
|
+
r"'module_path': 'gha_utils(/|\\\\)__main__\.py'\}, "
|
|
116
|
+
r"\{'commit': '[a-z0-9]+', 'short_sha': '[a-z0-9]+', "
|
|
117
|
+
r"'current_version': '4\.14\.1'\}, \{'os': 'ubuntu-24\.04', "
|
|
118
|
+
r"'platform_id': 'linux', 'arch': 'x64', 'extension': 'bin'}, "
|
|
119
|
+
r"{'os': 'ubuntu-24\.04-arm', 'platform_id': 'linux', "
|
|
120
|
+
r"'arch': 'arm64', 'extension': 'bin'\}, \{'os': 'macos-15', "
|
|
121
|
+
r"'platform_id': 'macos', 'arch': 'arm64', 'extension': 'bin'\}, "
|
|
122
|
+
r"\{'os': 'macos-13', 'platform_id': 'macos', 'arch': 'x64', "
|
|
123
|
+
r"'extension': 'bin'\}, \{'os': 'windows-2022', 'platform_id': "
|
|
124
|
+
r"'windows', 'arch': 'x64', 'extension': 'exe'\}, "
|
|
125
|
+
r"\{'os': 'ubuntu-24\.04', 'entry_point': 'gha-utils', "
|
|
126
|
+
r"'commit': '[a-z0-9]+', "
|
|
127
|
+
r"'bin_name': 'gha-utils-linux-x64-build-[a-z0-9]+\.bin'\}, "
|
|
128
|
+
r"\{'os': 'ubuntu-24\.04-arm', 'entry_point': 'gha-utils', "
|
|
129
|
+
r"'commit': '[a-z0-9]+', "
|
|
130
|
+
r"'bin_name': 'gha-utils-linux-arm64-build-[a-z0-9]+\.bin'\}, "
|
|
131
|
+
r"\{'os': 'macos-15', 'entry_point': 'gha-utils', "
|
|
132
|
+
r"'commit': '[a-z0-9]+', "
|
|
133
|
+
r"'bin_name': 'gha-utils-macos-arm64-build-[a-z0-9]+\.bin'\}, "
|
|
134
|
+
r"\{'os': 'macos-13', 'entry_point': 'gha-utils', "
|
|
135
|
+
r"'commit': '[a-z0-9]+', 'bin_name': "
|
|
136
|
+
r"'gha-utils-macos-x64-build-[a-z0-9]+\.bin'\}, "
|
|
137
|
+
r"\{'os': 'windows-2022', 'entry_point': 'gha-utils', "
|
|
138
|
+
r"'commit': '[a-z0-9]+', "
|
|
139
|
+
r"'bin_name': 'gha-utils-windows-x64-build-[a-z0-9]+\.exe'\}\); "
|
|
140
|
+
r"exclude=\(\)>\}"
|
|
141
|
+
),
|
|
142
|
+
metadata.dump(Dialects.plain),
|
|
143
|
+
)
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# Copyright Kevin Deldycke <kevin@deldycke.com> and contributors.
|
|
2
|
-
#
|
|
3
|
-
# This program is Free Software; you can redistribute it and/or
|
|
4
|
-
# modify it under the terms of the GNU General Public License
|
|
5
|
-
# as published by the Free Software Foundation; either version 2
|
|
6
|
-
# of the License, or (at your option) any later version.
|
|
7
|
-
#
|
|
8
|
-
# This program is distributed in the hope that it will be useful,
|
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
-
# GNU General Public License for more details.
|
|
12
|
-
#
|
|
13
|
-
# You should have received a copy of the GNU General Public License
|
|
14
|
-
# along with this program; if not, write to the Free Software
|
|
15
|
-
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
16
|
-
|
|
17
|
-
from __future__ import annotations
|
|
18
|
-
|
|
19
|
-
import re
|
|
20
|
-
|
|
21
|
-
from gha_utils.metadata import Dialects, Metadata
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def test_metadata_github_format():
|
|
25
|
-
metadata = Metadata()
|
|
26
|
-
|
|
27
|
-
assert re.fullmatch(
|
|
28
|
-
(
|
|
29
|
-
r"new_commits=\n"
|
|
30
|
-
r"release_commits=\n"
|
|
31
|
-
r"gitignore_exists=true\n"
|
|
32
|
-
r"python_files=[\S ]*\n"
|
|
33
|
-
r"doc_files=[\S ]*\n"
|
|
34
|
-
r"is_python_project=true\n"
|
|
35
|
-
r"package_name=gha-utils\n"
|
|
36
|
-
r"blacken_docs_params=--target-version py310 --target-version py311 "
|
|
37
|
-
r"--target-version py312 --target-version py313\n"
|
|
38
|
-
r"mypy_params=--python-version 3\.10\n"
|
|
39
|
-
r"current_version=\n"
|
|
40
|
-
r"released_version=\n"
|
|
41
|
-
r"is_sphinx=false\n"
|
|
42
|
-
r"active_autodoc=false\n"
|
|
43
|
-
r"release_notes=\n"
|
|
44
|
-
r"new_commits_matrix=\n"
|
|
45
|
-
r"release_commits_matrix=\n"
|
|
46
|
-
r'nuitka_matrix=\{"os": \["ubuntu-24\.04", "ubuntu-24\.04-arm", '
|
|
47
|
-
r'"macos-15", "macos-13", "windows-2022"\], '
|
|
48
|
-
r'"entry_point": \["gha-utils"\], '
|
|
49
|
-
r'"commit": \["[a-z0-9]+"\]\}\n'
|
|
50
|
-
),
|
|
51
|
-
metadata.dump(Dialects.github),
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def test_metadata_plain_format():
|
|
56
|
-
metadata = Metadata()
|
|
57
|
-
|
|
58
|
-
assert re.fullmatch(
|
|
59
|
-
(
|
|
60
|
-
r"\{"
|
|
61
|
-
r"'new_commits': None, "
|
|
62
|
-
r"'release_commits': None, "
|
|
63
|
-
r"'gitignore_exists': True, "
|
|
64
|
-
r"'python_files': <generator object Metadata\.python_files at \S+>, "
|
|
65
|
-
r"'doc_files': <generator object Metadata\.doc_files at \S+>, "
|
|
66
|
-
r"'is_python_project': True, "
|
|
67
|
-
r"'package_name': 'gha-utils', "
|
|
68
|
-
r"'blacken_docs_params': \("
|
|
69
|
-
r"'--target-version py310', "
|
|
70
|
-
r"'--target-version py311', "
|
|
71
|
-
r"'--target-version py312', "
|
|
72
|
-
r"'--target-version py313'\), "
|
|
73
|
-
r"'mypy_params': '--python-version 3\.10', "
|
|
74
|
-
r"'current_version': None, "
|
|
75
|
-
r"'released_version': None, "
|
|
76
|
-
r"'is_sphinx': False, "
|
|
77
|
-
r"'active_autodoc': False, "
|
|
78
|
-
r"'release_notes': None, "
|
|
79
|
-
r"'new_commits_matrix': None, "
|
|
80
|
-
r"'release_commits_matrix': None, "
|
|
81
|
-
r"'nuitka_matrix': <Matrix: \{"
|
|
82
|
-
r"'os': \('ubuntu-24\.04', 'ubuntu-24\.04-arm', "
|
|
83
|
-
r"'macos-15', 'macos-13', 'windows-2022'\), "
|
|
84
|
-
r"'entry_point': \('gha-utils',\), "
|
|
85
|
-
r"'commit': \('[a-z0-9]+',\)\}; "
|
|
86
|
-
r"include=\(\); exclude=\(\)>\}"
|
|
87
|
-
),
|
|
88
|
-
metadata.dump(Dialects.plain),
|
|
89
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|