Skip to content

Commit 0fe8757

Browse files
committed
test: test all reusable workflows
1 parent d1cdffd commit 0fe8757

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/ci_starter/cli/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,18 @@ def workflows(
8484
logger.debug("test_group = %s", test_group)
8585
logger.debug("test_command = %s", test_command)
8686

87-
workdir.helper_script.parent.mkdir(parents=True, exist_ok=True)
87+
workdir.workflows.mkdir(parents=True, exist_ok=True)
88+
8889
with workdir.helper_script.open("w", encoding="utf-8") as script_file:
8990
script: str = generate_helper_script()
9091
script_file.write(script)
9192

92-
workdir.base_workflow.parent.mkdir(parents=True, exist_ok=True)
9393
with workdir.base_workflow.open("w", encoding="utf-8") as base_workflow:
9494
data = generate_base_workflow()
9595
dump(data, base_workflow)
96+
97+
for reusable_workflow_file_path in (workdir.build, workdir.release, workdir.test_e2e):
98+
with reusable_workflow_file_path.open("w", encoding="utf-8") as file:
99+
asset_path = Path(*reusable_workflow_file_path.parts[-2:])
100+
data = generate_reusable_workflow(asset_path)
101+
dump(data, file)

src/ci_starter/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
def step_yaml() -> Yaml:
1010
yaml = Yaml()
11-
yaml.width = 108
11+
yaml.width = 150
1212
yaml.preserve_quotes = True
1313
yaml.sequence_indent = 4
1414
yaml.sequence_dash_offset = 2

tests/e2e/test_workflow_files.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@
88
from ci_starter.constants import (
99
BASE_WORKFLOW_ASSET_PATH,
1010
BASE_WORKFLOW_FILE_PATH,
11+
BUILD_WORKFLOW_ASSET_PATH,
12+
BUILD_WORKFLOW_FILE_PATH,
1113
HELPER_SCRIPT_ASSET_PATH,
1214
HELPER_SCRIPT_FILE_PATH,
15+
RELEASE_WORKFLOW_ASSET_PATH,
16+
RELEASE_WORKFLOW_FILE_PATH,
17+
TEST_E2E_WORKFLOW_ASSET_PATH,
18+
TEST_E2E_WORKFLOW_FILE_PATH,
1319
)
1420
from tests.e2e.comparator import Comparator
1521
from tests.e2e.constants import SUCCESSFUL_RETURN_CODE
@@ -35,6 +41,11 @@ def get_comparator(
3541
(
3642
param(HELPER_SCRIPT_ASSET_PATH, HELPER_SCRIPT_FILE_PATH, id=HELPER_SCRIPT_FILE_PATH.stem),
3743
param(BASE_WORKFLOW_ASSET_PATH, BASE_WORKFLOW_FILE_PATH, id=BASE_WORKFLOW_FILE_PATH.stem),
44+
param(BUILD_WORKFLOW_ASSET_PATH, BUILD_WORKFLOW_FILE_PATH, id=BUILD_WORKFLOW_FILE_PATH.stem),
45+
param(RELEASE_WORKFLOW_ASSET_PATH, RELEASE_WORKFLOW_FILE_PATH, id=RELEASE_WORKFLOW_FILE_PATH.stem),
46+
param(
47+
TEST_E2E_WORKFLOW_ASSET_PATH, TEST_E2E_WORKFLOW_FILE_PATH, id=TEST_E2E_WORKFLOW_FILE_PATH.stem
48+
),
3849
),
3950
)
4051
def test_asset_vs_rendered_file(

0 commit comments

Comments
 (0)