Skip to content

Commit fa1ade5

Browse files
committed
Update component template modulesync config structure
This commit adjusts the initial modulesync config generated by the component template to match the changes introduced by projectsyn/modulesync-control#62 which facilitate keeping the Renovate `postUpgradeTasks` updated when new matrix tests are added.
1 parent 5df533e commit fa1ade5

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
:global:
22
componentName: {{ cookiecutter.name }}
3-
feature_goldenTests: true
3+
feature_goldenTests: {% if cookiecutter.add_golden == "y" %}true{% else %}false{% endif %}
4+
{%- if cookiecutter.add_matrix == "y" %}
5+
testMatrix:
6+
key: instance
7+
entries:
8+
- defaults
9+
10+
{%- endif %}
411

512
docs/antora.yml:
613
name: {{ cookiecutter.slug }}
714
title: {{ cookiecutter.name }}
8-
{% if cookiecutter.add_matrix == "y" -%}
15+
{%- if cookiecutter.add_matrix == "y" %}
916

1017
.github/workflows/test.yaml:
1118
test_makeTarget: test -e instance={% raw %}${{ matrix.instance }}{% endraw %}
1219
{%- if cookiecutter.add_golden == "y" %}
1320
goldenTest_makeTarget: golden-diff -e instance={% raw %}${{ matrix.instance }}{% endraw %}
14-
{%- endif %}
15-
matrix:
16-
key: instance
17-
entries:
18-
- defaults
19-
{% endif -%}
21+
{%- endif -%}
22+
{% endif %}

tests/test_component_template.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,23 @@ def test_run_component_new_command(
141141
else:
142142
assert run_step["run"] == "make golden-diff"
143143

144+
with open(tmp_path / "dependencies" / component_name / ".sync.yml") as syncyml:
145+
syncconfig = yaml.safe_load(syncyml)
146+
assert ":global" in syncconfig
147+
148+
globalconfig = syncconfig[":global"]
149+
assert "componentName" in globalconfig
150+
assert "feature_goldenTests" in globalconfig
151+
assert ("testMatrix" in globalconfig) == has_matrix
152+
153+
assert globalconfig["componentName"] == component_name
154+
assert globalconfig["feature_goldenTests"] == has_golden
155+
156+
assert (".github/workflows/test.yaml" in syncconfig) == has_matrix
157+
if has_matrix:
158+
ghconfig = syncconfig[".github/workflows/test.yaml"]
159+
assert ("goldenTest_makeTarget" in ghconfig) == has_golden
160+
144161
with open(
145162
tmp_path / "dependencies" / component_name / "renovate.json"
146163
) as renovatejson:

0 commit comments

Comments
 (0)