gha-utils 4.14.2__py3-none-any.whl → 4.15.0__py3-none-any.whl
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/__init__.py +1 -1
- gha_utils/changelog.py +1 -5
- gha_utils/cli.py +76 -17
- gha_utils/metadata.py +17 -27
- gha_utils/test_plan.py +52 -29
- {gha_utils-4.14.2.dist-info → gha_utils-4.15.0.dist-info}/METADATA +6 -8
- gha_utils-4.15.0.dist-info/RECORD +14 -0
- {gha_utils-4.14.2.dist-info → gha_utils-4.15.0.dist-info}/WHEEL +1 -1
- gha_utils-4.14.2.dist-info/RECORD +0 -14
- {gha_utils-4.14.2.dist-info → gha_utils-4.15.0.dist-info}/entry_points.txt +0 -0
- {gha_utils-4.14.2.dist-info → gha_utils-4.15.0.dist-info}/top_level.txt +0 -0
gha_utils/__init__.py
CHANGED
gha_utils/changelog.py
CHANGED
|
@@ -18,15 +18,11 @@ from __future__ import annotations
|
|
|
18
18
|
|
|
19
19
|
import logging
|
|
20
20
|
import re
|
|
21
|
-
import sys
|
|
22
21
|
from functools import cached_property
|
|
23
22
|
from pathlib import Path
|
|
24
23
|
from textwrap import indent
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
import tomllib
|
|
28
|
-
else:
|
|
29
|
-
import tomli as tomllib # type: ignore[import-not-found]
|
|
25
|
+
import tomllib
|
|
30
26
|
|
|
31
27
|
|
|
32
28
|
class Changelog:
|
gha_utils/cli.py
CHANGED
|
@@ -19,11 +19,12 @@ from __future__ import annotations
|
|
|
19
19
|
import logging
|
|
20
20
|
import os
|
|
21
21
|
import sys
|
|
22
|
+
from collections import Counter
|
|
22
23
|
from datetime import datetime
|
|
23
24
|
from pathlib import Path
|
|
24
25
|
from typing import IO
|
|
25
26
|
|
|
26
|
-
import
|
|
27
|
+
from boltons.iterutils import unique
|
|
27
28
|
from click_extra import (
|
|
28
29
|
Choice,
|
|
29
30
|
Context,
|
|
@@ -35,12 +36,14 @@ from click_extra import (
|
|
|
35
36
|
option,
|
|
36
37
|
pass_context,
|
|
37
38
|
)
|
|
39
|
+
from click_extra.envvar import merge_envvar_ids
|
|
40
|
+
from extra_platforms import ALL_IDS
|
|
38
41
|
|
|
39
42
|
from . import __version__
|
|
40
43
|
from .changelog import Changelog
|
|
41
44
|
from .mailmap import Mailmap
|
|
42
45
|
from .metadata import Dialects, Metadata
|
|
43
|
-
from .test_plan import DEFAULT_TEST_PLAN, parse_test_plan
|
|
46
|
+
from .test_plan import DEFAULT_TEST_PLAN, SkippedTest, parse_test_plan
|
|
44
47
|
|
|
45
48
|
|
|
46
49
|
def is_stdout(filepath: Path) -> bool:
|
|
@@ -275,19 +278,38 @@ def mailmap_sync(ctx, source, create_if_missing, destination_mailmap):
|
|
|
275
278
|
@gha_utils.command(short_help="Run a test plan from a file against a binary")
|
|
276
279
|
@option(
|
|
277
280
|
"--binary",
|
|
278
|
-
|
|
279
|
-
# `file_path` type.
|
|
280
|
-
type=click.Path(exists=True, executable=True, resolve_path=True),
|
|
281
|
+
type=file_path(exists=True, executable=True, resolve_path=True),
|
|
281
282
|
required=True,
|
|
282
283
|
metavar="FILE_PATH",
|
|
283
284
|
help="Path to the binary file to test.",
|
|
284
285
|
)
|
|
285
286
|
@option(
|
|
287
|
+
"-F",
|
|
288
|
+
"--plan-file",
|
|
289
|
+
# TODO: remove deprecated --plan option to avoid confusion.
|
|
286
290
|
"--plan",
|
|
287
291
|
type=file_path(exists=True, readable=True, resolve_path=True),
|
|
292
|
+
multiple=True,
|
|
288
293
|
metavar="FILE_PATH",
|
|
289
|
-
help="Path to
|
|
290
|
-
"plan will be
|
|
294
|
+
help="Path to a test plan file in YAML. This option can be repeated to run "
|
|
295
|
+
"multiple test plans in sequence. If not provided, a default test plan will be "
|
|
296
|
+
"executed.",
|
|
297
|
+
)
|
|
298
|
+
@option(
|
|
299
|
+
"-E",
|
|
300
|
+
"--plan-envvar",
|
|
301
|
+
multiple=True,
|
|
302
|
+
metavar="ENVVAR_NAME",
|
|
303
|
+
help="Name of an environment variable containing a test plan in YAML. This "
|
|
304
|
+
"option can be repeated to collect multiple test plans.",
|
|
305
|
+
)
|
|
306
|
+
@option(
|
|
307
|
+
"-s",
|
|
308
|
+
"--skip-platform",
|
|
309
|
+
type=Choice(sorted(ALL_IDS), case_sensitive=False),
|
|
310
|
+
multiple=True,
|
|
311
|
+
help="Skip tests for the specified platforms. This option can be repeated to "
|
|
312
|
+
"skip multiple platforms.",
|
|
291
313
|
)
|
|
292
314
|
@option(
|
|
293
315
|
"-t",
|
|
@@ -300,17 +322,54 @@ def mailmap_sync(ctx, source, create_if_missing, destination_mailmap):
|
|
|
300
322
|
help="Set the default timeout for each CLI call, if not specified in the "
|
|
301
323
|
"test plan.",
|
|
302
324
|
)
|
|
303
|
-
def test_plan(
|
|
325
|
+
def test_plan(
|
|
326
|
+
binary: Path,
|
|
327
|
+
plan_file: tuple[Path, ...] | None,
|
|
328
|
+
plan_envvar: tuple[str, ...] | None,
|
|
329
|
+
skip_platform: tuple[str, ...] | None,
|
|
330
|
+
timeout: float | None,
|
|
331
|
+
) -> None:
|
|
304
332
|
# Load test plan from workflow input, or use a default one.
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
333
|
+
test_list = []
|
|
334
|
+
if plan_file or plan_envvar:
|
|
335
|
+
for file in unique(plan_file):
|
|
336
|
+
logging.info(f"Get test plan from {file} file")
|
|
337
|
+
tests = list(parse_test_plan(file.read_text(encoding="UTF-8")))
|
|
338
|
+
logging.info(f"{len(tests)} test cases found.")
|
|
339
|
+
test_list.extend(tests)
|
|
340
|
+
for envvar_id in merge_envvar_ids(plan_envvar):
|
|
341
|
+
logging.info(f"Get test plan from {envvar_id!r} environment variable")
|
|
342
|
+
tests = list(parse_test_plan(os.getenv(envvar_id)))
|
|
343
|
+
logging.info(f"{len(tests)} test cases found.")
|
|
344
|
+
test_list.extend(tests)
|
|
345
|
+
|
|
308
346
|
else:
|
|
309
|
-
logging.warning(
|
|
310
|
-
|
|
311
|
-
|
|
347
|
+
logging.warning(
|
|
348
|
+
"No test plan provided through --plan-file/-F or --plan-envvar/-E options:"
|
|
349
|
+
" use default test plan."
|
|
350
|
+
)
|
|
351
|
+
test_list = DEFAULT_TEST_PLAN
|
|
352
|
+
logging.debug(f"Test plan: {test_list}")
|
|
353
|
+
|
|
354
|
+
stats = Counter(total=len(test_list), skipped=0, failed=0)
|
|
312
355
|
|
|
313
|
-
for index, test_case in enumerate(
|
|
356
|
+
for index, test_case in enumerate(test_list):
|
|
314
357
|
logging.info(f"Run test #{index + 1}")
|
|
315
|
-
|
|
316
|
-
|
|
358
|
+
try:
|
|
359
|
+
logging.debug(f"Test case parameters: {test_case}")
|
|
360
|
+
test_case.run_cli_test(
|
|
361
|
+
binary, additional_skip_platforms=skip_platform, default_timeout=timeout
|
|
362
|
+
)
|
|
363
|
+
except SkippedTest as ex:
|
|
364
|
+
stats["skipped"] += 1
|
|
365
|
+
logging.warning(f"Test skipped: {ex}")
|
|
366
|
+
except Exception as ex:
|
|
367
|
+
stats["failed"] += 1
|
|
368
|
+
logging.error(f"Test failed: {ex}")
|
|
369
|
+
|
|
370
|
+
logging.info(
|
|
371
|
+
"Test plan results - "
|
|
372
|
+
+ ", ".join((f"{k.title()}: {v}" for k, v in stats.items()))
|
|
373
|
+
)
|
|
374
|
+
if stats["failed"]:
|
|
375
|
+
sys.exit(1)
|
gha_utils/metadata.py
CHANGED
|
@@ -49,7 +49,7 @@ release_commits_matrix={'commit': ['6f27db47612aaee06fdf08744b09a9f5f6c2'],
|
|
|
49
49
|
nuitka_matrix={'entry_point': ['mpm'],
|
|
50
50
|
'commit': ['346ce664f055fbd042a25ee0b7e96702e95',
|
|
51
51
|
'6f27db47612aaee06fdf08744b09a9f5f6c2'],
|
|
52
|
-
'os': ['ubuntu-24.04', 'ubuntu-24.04-arm', 'macos-15', 'macos-13', 'windows-
|
|
52
|
+
'os': ['ubuntu-24.04', 'ubuntu-24.04-arm', 'macos-15', 'macos-13', 'windows-2025'],
|
|
53
53
|
'include': [{'entry_point': 'mpm',
|
|
54
54
|
'cli_id': 'mpm',
|
|
55
55
|
'module_id': 'meta_package_manager.__main__',
|
|
@@ -77,7 +77,7 @@ nuitka_matrix={'entry_point': ['mpm'],
|
|
|
77
77
|
'platform_id': 'macos',
|
|
78
78
|
'arch': 'x64',
|
|
79
79
|
'extension': 'bin'},
|
|
80
|
-
{'os': 'windows-
|
|
80
|
+
{'os': 'windows-2025',
|
|
81
81
|
'platform_id': 'windows',
|
|
82
82
|
'arch': 'x64',
|
|
83
83
|
'extension': 'exe'},
|
|
@@ -123,12 +123,12 @@ nuitka_matrix={'entry_point': ['mpm'],
|
|
|
123
123
|
'bin_name': 'mpm-macos-x64-build-6f27db4.bin'},
|
|
124
124
|
{'entry_point': 'mpm',
|
|
125
125
|
'commit': '346ce664f055fbd042a25ee0b7e96702e95',
|
|
126
|
-
'os': 'windows-
|
|
126
|
+
'os': 'windows-2025',
|
|
127
127
|
'arch': 'x64',
|
|
128
128
|
'bin_name': 'mpm-windows-x64-build-346ce66.exe'},
|
|
129
129
|
{'entry_point': 'mpm',
|
|
130
130
|
'commit': '6f27db47612aaee06fdf08744b09a9f5f6c2',
|
|
131
|
-
'os': 'windows-
|
|
131
|
+
'os': 'windows-2025',
|
|
132
132
|
'arch': 'x64',
|
|
133
133
|
'bin_name': 'mpm-windows-x64-build-6f27db4.exe'}]}
|
|
134
134
|
```
|
|
@@ -147,22 +147,15 @@ import json
|
|
|
147
147
|
import logging
|
|
148
148
|
import os
|
|
149
149
|
import re
|
|
150
|
-
import sys
|
|
151
150
|
from collections.abc import Iterable
|
|
151
|
+
from enum import StrEnum
|
|
152
152
|
from functools import cached_property
|
|
153
153
|
from pathlib import Path
|
|
154
154
|
from random import randint
|
|
155
155
|
from re import escape
|
|
156
156
|
from typing import Any, Final, Iterator, cast
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
from enum import StrEnum
|
|
160
|
-
|
|
161
|
-
import tomllib
|
|
162
|
-
else:
|
|
163
|
-
import tomli as tomllib # type: ignore[import-not-found]
|
|
164
|
-
from backports.strenum import StrEnum # type: ignore[import-not-found]
|
|
165
|
-
|
|
158
|
+
import tomllib
|
|
166
159
|
from bumpversion.config import get_configuration # type: ignore[import-untyped]
|
|
167
160
|
from bumpversion.config.files import find_config_file # type: ignore[import-untyped]
|
|
168
161
|
from bumpversion.show import resolve_name # type: ignore[import-untyped]
|
|
@@ -457,7 +450,7 @@ class Metadata:
|
|
|
457
450
|
return matrix
|
|
458
451
|
|
|
459
452
|
@cached_property
|
|
460
|
-
def event_type(self) -> WorkflowEvent | None:
|
|
453
|
+
def event_type(self) -> WorkflowEvent | None:
|
|
461
454
|
"""Returns the type of event that triggered the workflow run.
|
|
462
455
|
|
|
463
456
|
.. caution::
|
|
@@ -481,8 +474,8 @@ class Metadata:
|
|
|
481
474
|
return None
|
|
482
475
|
|
|
483
476
|
if bool(os.environ.get("GITHUB_BASE_REF")):
|
|
484
|
-
return WorkflowEvent.pull_request
|
|
485
|
-
return WorkflowEvent.push
|
|
477
|
+
return WorkflowEvent.pull_request
|
|
478
|
+
return WorkflowEvent.push
|
|
486
479
|
|
|
487
480
|
@cached_property
|
|
488
481
|
def commit_range(self) -> tuple[str, str] | None:
|
|
@@ -515,7 +508,7 @@ class Metadata:
|
|
|
515
508
|
if not self.github_context or not self.event_type:
|
|
516
509
|
return None
|
|
517
510
|
# Pull request event.
|
|
518
|
-
if self.event_type in (
|
|
511
|
+
if self.event_type in (
|
|
519
512
|
WorkflowEvent.pull_request,
|
|
520
513
|
WorkflowEvent.pull_request_target,
|
|
521
514
|
):
|
|
@@ -880,7 +873,7 @@ class Metadata:
|
|
|
880
873
|
"ubuntu-24.04-arm",
|
|
881
874
|
"macos-15",
|
|
882
875
|
"macos-13",
|
|
883
|
-
"windows-
|
|
876
|
+
"windows-2025",
|
|
884
877
|
],
|
|
885
878
|
"include": [
|
|
886
879
|
{
|
|
@@ -925,7 +918,7 @@ class Metadata:
|
|
|
925
918
|
"extension": "bin",
|
|
926
919
|
},
|
|
927
920
|
{
|
|
928
|
-
"os": "windows-
|
|
921
|
+
"os": "windows-2025",
|
|
929
922
|
"platform_id": "windows",
|
|
930
923
|
"arch": "x64",
|
|
931
924
|
"extension": "exe",
|
|
@@ -989,14 +982,14 @@ class Metadata:
|
|
|
989
982
|
{
|
|
990
983
|
"entry_point": "mpm",
|
|
991
984
|
"commit": "346ce664f055fbd042a25ee0b7e96702e95",
|
|
992
|
-
"os": "windows-
|
|
985
|
+
"os": "windows-2025",
|
|
993
986
|
"arch": "x64",
|
|
994
987
|
"bin_name": "mpm-windows-x64-build-346ce66.exe",
|
|
995
988
|
},
|
|
996
989
|
{
|
|
997
990
|
"entry_point": "mpm",
|
|
998
991
|
"commit": "6f27db47612aaee06fdf08744b09a9f5f6c2",
|
|
999
|
-
"os": "windows-
|
|
992
|
+
"os": "windows-2025",
|
|
1000
993
|
"arch": "x64",
|
|
1001
994
|
"bin_name": "mpm-windows-x64-build-6f27db4.exe",
|
|
1002
995
|
},
|
|
@@ -1021,7 +1014,7 @@ class Metadata:
|
|
|
1021
1014
|
"ubuntu-24.04-arm", # arm64
|
|
1022
1015
|
"macos-15", # arm64
|
|
1023
1016
|
"macos-13", # x64
|
|
1024
|
-
"windows-
|
|
1017
|
+
"windows-2025", # x64
|
|
1025
1018
|
),
|
|
1026
1019
|
)
|
|
1027
1020
|
|
|
@@ -1086,7 +1079,7 @@ class Metadata:
|
|
|
1086
1079
|
"extension": "bin",
|
|
1087
1080
|
},
|
|
1088
1081
|
{
|
|
1089
|
-
"os": "windows-
|
|
1082
|
+
"os": "windows-2025",
|
|
1090
1083
|
"platform_id": "windows",
|
|
1091
1084
|
"arch": "x64",
|
|
1092
1085
|
"extension": "exe",
|
|
@@ -1180,10 +1173,7 @@ class Metadata:
|
|
|
1180
1173
|
|
|
1181
1174
|
return cast(str, value)
|
|
1182
1175
|
|
|
1183
|
-
def dump(
|
|
1184
|
-
self,
|
|
1185
|
-
dialect: Dialects = Dialects.github, # type: ignore[valid-type]
|
|
1186
|
-
) -> str:
|
|
1176
|
+
def dump(self, dialect: Dialects = Dialects.github) -> str:
|
|
1187
1177
|
"""Returns all metadata in the specified format.
|
|
1188
1178
|
|
|
1189
1179
|
Defaults to GitHub dialect.
|
gha_utils/test_plan.py
CHANGED
|
@@ -28,14 +28,23 @@ from typing import Generator, Sequence
|
|
|
28
28
|
import yaml
|
|
29
29
|
from boltons.iterutils import flatten
|
|
30
30
|
from boltons.strutils import strip_ansi
|
|
31
|
-
from click_extra.testing import args_cleanup,
|
|
31
|
+
from click_extra.testing import args_cleanup, render_cli_run
|
|
32
|
+
from extra_platforms import Group, _TNestedReferences, current_os
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class SkippedTest(Exception):
|
|
36
|
+
"""Raised when a test case should be skipped."""
|
|
37
|
+
|
|
38
|
+
pass
|
|
32
39
|
|
|
33
40
|
|
|
34
41
|
@dataclass(order=True)
|
|
35
|
-
class
|
|
42
|
+
class CLITestCase:
|
|
36
43
|
cli_parameters: tuple[str, ...] | str = field(default_factory=tuple)
|
|
37
44
|
"""Parameters, arguments and options to pass to the CLI."""
|
|
38
45
|
|
|
46
|
+
skip_platforms: _TNestedReferences = field(default_factory=tuple)
|
|
47
|
+
only_platforms: _TNestedReferences = field(default_factory=tuple)
|
|
39
48
|
timeout: float | str | None = None
|
|
40
49
|
exit_code: int | str | None = None
|
|
41
50
|
strip_ansi: bool = False
|
|
@@ -101,6 +110,10 @@ class TestCase:
|
|
|
101
110
|
# Ignore blank value.
|
|
102
111
|
field_data = tuple(i for i in field_data if i.strip())
|
|
103
112
|
|
|
113
|
+
# Normalize any mishmash of platform and group IDs into a set of platforms.
|
|
114
|
+
if field_id.endswith("_platforms") and field_data:
|
|
115
|
+
field_data = frozenset(Group._extract_platforms(field_data))
|
|
116
|
+
|
|
104
117
|
# Validates fields containing one or more regexes.
|
|
105
118
|
if "_regex_" in field_id and field_data:
|
|
106
119
|
# Compile all regexes.
|
|
@@ -124,16 +137,30 @@ class TestCase:
|
|
|
124
137
|
|
|
125
138
|
setattr(self, field_id, field_data)
|
|
126
139
|
|
|
127
|
-
def
|
|
140
|
+
def run_cli_test(
|
|
141
|
+
self,
|
|
142
|
+
binary: str | Path,
|
|
143
|
+
additional_skip_platforms: _TNestedReferences | None,
|
|
144
|
+
default_timeout: float | None,
|
|
145
|
+
):
|
|
128
146
|
"""Run a CLI command and check its output against the test case.
|
|
129
147
|
|
|
130
148
|
..todo::
|
|
131
149
|
Add support for environment variables.
|
|
132
150
|
|
|
133
151
|
..todo::
|
|
134
|
-
Add support for proper mixed stdout
|
|
152
|
+
Add support for proper mixed <stdout>/<stderr> stream as a single,
|
|
135
153
|
intertwined output.
|
|
136
154
|
"""
|
|
155
|
+
if self.only_platforms:
|
|
156
|
+
if current_os() not in self.only_platforms: # type: ignore[operator]
|
|
157
|
+
raise SkippedTest(f"Test case only runs on platform: {current_os()}")
|
|
158
|
+
|
|
159
|
+
if current_os() in Group._extract_platforms(
|
|
160
|
+
self.skip_platforms, additional_skip_platforms
|
|
161
|
+
):
|
|
162
|
+
raise SkippedTest(f"Skipping test case on platform: {current_os()}")
|
|
163
|
+
|
|
137
164
|
if self.timeout is None and default_timeout is not None:
|
|
138
165
|
logging.info(f"Set default test case timeout to {default_timeout} seconds")
|
|
139
166
|
self.timeout = default_timeout
|
|
@@ -176,7 +203,8 @@ class TestCase:
|
|
|
176
203
|
f"CLI timed out after {self.timeout} seconds: {' '.join(clean_args)}"
|
|
177
204
|
)
|
|
178
205
|
|
|
179
|
-
|
|
206
|
+
for line in render_cli_run(clean_args, result).splitlines():
|
|
207
|
+
logging.info(line)
|
|
180
208
|
|
|
181
209
|
for field_id, field_data in asdict(self).items():
|
|
182
210
|
if field_id == "exit_code":
|
|
@@ -211,55 +239,50 @@ class TestCase:
|
|
|
211
239
|
name = "<stderr>"
|
|
212
240
|
|
|
213
241
|
if self.strip_ansi:
|
|
214
|
-
logging.info(f"Strip ANSI
|
|
242
|
+
logging.info(f"Strip ANSI sequences from {name}")
|
|
215
243
|
output = strip_ansi(output)
|
|
216
244
|
|
|
217
245
|
if field_id.endswith("_contains"):
|
|
218
246
|
for sub_string in field_data:
|
|
219
|
-
logging.info(f"Check if
|
|
247
|
+
logging.info(f"Check if {name} contains {sub_string!r}")
|
|
220
248
|
if sub_string not in output:
|
|
221
|
-
raise AssertionError(
|
|
222
|
-
f"CLI's {name} does not contain {sub_string!r}"
|
|
223
|
-
)
|
|
249
|
+
raise AssertionError(f"{name} does not contain {sub_string!r}")
|
|
224
250
|
|
|
225
251
|
elif field_id.endswith("_regex_matches"):
|
|
226
252
|
for regex in field_data:
|
|
227
|
-
logging.info(f"Check if
|
|
253
|
+
logging.info(f"Check if {name} matches {sub_string!r}")
|
|
228
254
|
if not regex.search(output):
|
|
229
|
-
raise AssertionError(
|
|
230
|
-
f"CLI's {name} does not match regex {regex}"
|
|
231
|
-
)
|
|
255
|
+
raise AssertionError(f"{name} does not match regex {regex}")
|
|
232
256
|
|
|
233
257
|
elif field_id.endswith("_regex_fullmatch"):
|
|
234
258
|
regex = field_data
|
|
235
259
|
if not regex.fullmatch(output):
|
|
236
|
-
raise AssertionError(
|
|
237
|
-
f"CLI's {name} does not fully match regex {regex}"
|
|
238
|
-
)
|
|
239
|
-
|
|
240
|
-
logging.info("All tests passed for CLI.")
|
|
260
|
+
raise AssertionError(f"{name} does not fully match regex {regex}")
|
|
241
261
|
|
|
242
262
|
|
|
243
|
-
DEFAULT_TEST_PLAN =
|
|
263
|
+
DEFAULT_TEST_PLAN: list[CLITestCase] = [
|
|
244
264
|
# Output the version of the CLI.
|
|
245
|
-
|
|
265
|
+
CLITestCase(cli_parameters="--version"),
|
|
246
266
|
# Test combination of version and verbosity.
|
|
247
|
-
|
|
267
|
+
CLITestCase(cli_parameters=("--verbosity", "DEBUG", "--version")),
|
|
248
268
|
# Test help output.
|
|
249
|
-
|
|
250
|
-
|
|
269
|
+
CLITestCase(cli_parameters="--help"),
|
|
270
|
+
]
|
|
271
|
+
|
|
251
272
|
|
|
273
|
+
def parse_test_plan(plan_string: str | None) -> Generator[CLITestCase, None, None]:
|
|
274
|
+
if not plan_string:
|
|
275
|
+
raise ValueError("Empty test plan")
|
|
252
276
|
|
|
253
|
-
|
|
254
|
-
plan = yaml.full_load(plan_path.read_text(encoding="UTF-8"))
|
|
277
|
+
plan = yaml.full_load(plan_string)
|
|
255
278
|
|
|
256
279
|
# Validates test plan structure.
|
|
257
280
|
if not plan:
|
|
258
|
-
raise ValueError(
|
|
281
|
+
raise ValueError("Empty test plan")
|
|
259
282
|
if not isinstance(plan, list):
|
|
260
283
|
raise ValueError(f"Test plan is not a list: {plan}")
|
|
261
284
|
|
|
262
|
-
directives = frozenset(
|
|
285
|
+
directives = frozenset(CLITestCase.__dataclass_fields__.keys())
|
|
263
286
|
|
|
264
287
|
for index, test_case in enumerate(plan):
|
|
265
288
|
# Validates test case structure.
|
|
@@ -271,4 +294,4 @@ def parse_test_plan(plan_path: Path) -> Generator[TestCase, None, None]:
|
|
|
271
294
|
f"{set(test_case) - directives}"
|
|
272
295
|
)
|
|
273
296
|
|
|
274
|
-
yield
|
|
297
|
+
yield CLITestCase(**test_case)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: gha-utils
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.15.0
|
|
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
|
|
@@ -19,7 +19,6 @@ Classifier: Operating System :: MacOS :: MacOS X
|
|
|
19
19
|
Classifier: Operating System :: Microsoft :: Windows
|
|
20
20
|
Classifier: Operating System :: POSIX :: Linux
|
|
21
21
|
Classifier: Programming Language :: Python :: 3
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.11
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.12
|
|
25
24
|
Classifier: Programming Language :: Python :: 3.13
|
|
@@ -43,17 +42,16 @@ Classifier: Topic :: Text Processing :: Markup :: HTML
|
|
|
43
42
|
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
44
43
|
Classifier: Topic :: Utilities
|
|
45
44
|
Classifier: Typing :: Typed
|
|
46
|
-
Requires-Python: >=3.
|
|
45
|
+
Requires-Python: >=3.11
|
|
47
46
|
Description-Content-Type: text/markdown
|
|
48
|
-
Requires-Dist: backports.strenum~=1.3.1; python_version < "3.11"
|
|
49
47
|
Requires-Dist: boltons>=24.0.0
|
|
50
|
-
Requires-Dist: bump-my-version>=0.
|
|
51
|
-
Requires-Dist: click-extra~=4.
|
|
48
|
+
Requires-Dist: bump-my-version>=0.32.2
|
|
49
|
+
Requires-Dist: click-extra~=4.15.0
|
|
50
|
+
Requires-Dist: extra-platforms~=3.1.0
|
|
52
51
|
Requires-Dist: packaging~=24.1
|
|
53
52
|
Requires-Dist: PyDriller~=2.6
|
|
54
53
|
Requires-Dist: pyproject-metadata~=0.9.0
|
|
55
54
|
Requires-Dist: pyyaml~=6.0.0
|
|
56
|
-
Requires-Dist: tomli~=2.0.1; python_version < "3.11"
|
|
57
55
|
Requires-Dist: wcmatch>=8.5
|
|
58
56
|
Provides-Extra: test
|
|
59
57
|
Requires-Dist: coverage[toml]~=7.6.0; extra == "test"
|
|
@@ -137,7 +135,7 @@ $ uvx gha-utils --version
|
|
|
137
135
|
gha-utils, version 4.9.0
|
|
138
136
|
```
|
|
139
137
|
|
|
140
|
-
That's the best way to get started with `gha-utils
|
|
138
|
+
That's the best way to get started with `gha-utils` and experiment with it.
|
|
141
139
|
|
|
142
140
|
### Executables
|
|
143
141
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
gha_utils/__init__.py,sha256=H4VVQ1RRW-KQELnav8RAL_mjRUNRgbZq3kGBdL-8-b8,866
|
|
2
|
+
gha_utils/__main__.py,sha256=Dck9BjpLXmIRS83k0mghAMcYVYiMiFLltQdfRuMSP_Q,1703
|
|
3
|
+
gha_utils/changelog.py,sha256=JR7iQrWjLoIOpVNe6iXQSyEii82_hM_zrYpR7QO_Uxo,5777
|
|
4
|
+
gha_utils/cli.py,sha256=58uww5uCnKN6JGDZJ0Gm_ZG-VCuzHopKTXIxAcp7w9M,12936
|
|
5
|
+
gha_utils/mailmap.py,sha256=naUqJYJnE3fLTjju1nd6WMm7ODiSaI2SHuJxRtmaFWs,6269
|
|
6
|
+
gha_utils/matrix.py,sha256=_afJD0K-xZLNxwykVnUhD0Gj9cdO0Z43g3VHa-q_tkI,11941
|
|
7
|
+
gha_utils/metadata.py,sha256=AbiEdWjcJfUaVwlhV31J-HXJldZgFB0OKS2fHJ60FXU,48282
|
|
8
|
+
gha_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
gha_utils/test_plan.py,sha256=iuSfsJ9XoqsIUbqR0HrkooUvK17TFBtlx8HyCAtMVWM,12841
|
|
10
|
+
gha_utils-4.15.0.dist-info/METADATA,sha256=K8Fjiy-evM6R223OvGk5E9jh9X8rBdarb_g-WJadJXo,20372
|
|
11
|
+
gha_utils-4.15.0.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
12
|
+
gha_utils-4.15.0.dist-info/entry_points.txt,sha256=8bJOwQYf9ZqsLhBR6gUCzvwLNI9f8tiiBrJ3AR0EK4o,54
|
|
13
|
+
gha_utils-4.15.0.dist-info/top_level.txt,sha256=C94Blb61YkkyPBwCdM3J_JPDjWH0lnKa5nGZeZ5M6yE,10
|
|
14
|
+
gha_utils-4.15.0.dist-info/RECORD,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
gha_utils/__init__.py,sha256=dR8lNlVY_u847eZ0CTxmll40WHAkfXzWXN26hheu824,866
|
|
2
|
-
gha_utils/__main__.py,sha256=Dck9BjpLXmIRS83k0mghAMcYVYiMiFLltQdfRuMSP_Q,1703
|
|
3
|
-
gha_utils/changelog.py,sha256=oahY88A9FRV14f1JSFKIiYrN_TS7Jo3QlljXqJbeuaE,5892
|
|
4
|
-
gha_utils/cli.py,sha256=Gq2pGpIOmvXtsexmg6nwN2ZuZ1lpHrJ5A43CeuDjK68,10985
|
|
5
|
-
gha_utils/mailmap.py,sha256=naUqJYJnE3fLTjju1nd6WMm7ODiSaI2SHuJxRtmaFWs,6269
|
|
6
|
-
gha_utils/matrix.py,sha256=_afJD0K-xZLNxwykVnUhD0Gj9cdO0Z43g3VHa-q_tkI,11941
|
|
7
|
-
gha_utils/metadata.py,sha256=Oumkmo4-O549hxlw8zaTWIPkITpUxUjpulj_MXn6fjA,48649
|
|
8
|
-
gha_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
gha_utils/test_plan.py,sha256=B6EiiGWVTrNS7jSIO9EE0kebccx10Fn0ZPapJTOOyGA,11928
|
|
10
|
-
gha_utils-4.14.2.dist-info/METADATA,sha256=uPoJ9lj1TvWEt1Izsipp-4R6bsQ-gwHjnqwILdpL0fQ,20514
|
|
11
|
-
gha_utils-4.14.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
12
|
-
gha_utils-4.14.2.dist-info/entry_points.txt,sha256=8bJOwQYf9ZqsLhBR6gUCzvwLNI9f8tiiBrJ3AR0EK4o,54
|
|
13
|
-
gha_utils-4.14.2.dist-info/top_level.txt,sha256=C94Blb61YkkyPBwCdM3J_JPDjWH0lnKa5nGZeZ5M6yE,10
|
|
14
|
-
gha_utils-4.14.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|