Skip to content

Commit

Permalink
Update component template modulesync config structure
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
simu committed Mar 18, 2022
1 parent 5df533e commit fa1ade5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
19 changes: 11 additions & 8 deletions commodore/component-template/{{ cookiecutter.slug }}/.sync.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
:global:
componentName: {{ cookiecutter.name }}
feature_goldenTests: true
feature_goldenTests: {% if cookiecutter.add_golden == "y" %}true{% else %}false{% endif %}
{%- if cookiecutter.add_matrix == "y" %}
testMatrix:
key: instance
entries:
- defaults

{%- endif %}

docs/antora.yml:
name: {{ cookiecutter.slug }}
title: {{ cookiecutter.name }}
{% if cookiecutter.add_matrix == "y" -%}
{%- if cookiecutter.add_matrix == "y" %}

.github/workflows/test.yaml:
test_makeTarget: test -e instance={% raw %}${{ matrix.instance }}{% endraw %}
{%- if cookiecutter.add_golden == "y" %}
goldenTest_makeTarget: golden-diff -e instance={% raw %}${{ matrix.instance }}{% endraw %}
{%- endif %}
matrix:
key: instance
entries:
- defaults
{% endif -%}
{%- endif -%}
{% endif %}
17 changes: 17 additions & 0 deletions tests/test_component_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,23 @@ def test_run_component_new_command(
else:
assert run_step["run"] == "make golden-diff"

with open(tmp_path / "dependencies" / component_name / ".sync.yml") as syncyml:
syncconfig = yaml.safe_load(syncyml)
assert ":global" in syncconfig

globalconfig = syncconfig[":global"]
assert "componentName" in globalconfig
assert "feature_goldenTests" in globalconfig
assert ("testMatrix" in globalconfig) == has_matrix

assert globalconfig["componentName"] == component_name
assert globalconfig["feature_goldenTests"] == has_golden

assert (".github/workflows/test.yaml" in syncconfig) == has_matrix
if has_matrix:
ghconfig = syncconfig[".github/workflows/test.yaml"]
assert ("goldenTest_makeTarget" in ghconfig) == has_golden

with open(
tmp_path / "dependencies" / component_name / "renovate.json"
) as renovatejson:
Expand Down

0 comments on commit fa1ade5

Please sign in to comment.