Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
add_golden:
- "n"
- "y"
add_matrix:
- "n"
- "y"
add_go_unit:
- "n"
- "y"
Expand All @@ -41,7 +38,7 @@ jobs:
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- run: poetry install
- name: Run lint
run: make test -e cruft_extra_content='{"slug":"test-component","name":"test-component","add_lib":"${{matrix.add_lib}}","add_pp":"${{matrix.add_pp}}","add_golden":"${{matrix.add_golden}}","add_matrix":"${{matrix.add_matrix}}","add_go_unit":"${{matrix.add_go_unit}}"}'
run: make test -e cruft_extra_content='{"slug":"test-component","name":"test-component","add_lib":"${{matrix.add_lib}}","add_pp":"${{matrix.add_pp}}","add_golden":"${{matrix.add_golden}}","add_go_unit":"${{matrix.add_go_unit}}"}'
- name: Run golden-diff
if: ${{ matrix.add_golden == 'y' }}
run: |
Expand Down
1 change: 0 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"add_lib": "n",
"add_pp": "n",
"add_golden": "y",
"add_matrix": "y",
"add_go_unit": "n",

"automerge_patch": "y",
Expand Down
10 changes: 2 additions & 8 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

create_lib = "{{ cookiecutter.add_lib }}" == "y"
add_golden = "{{ cookiecutter.add_golden }}" == "y"
add_matrix = "{{ cookiecutter.add_matrix }}" == "y"
automerge_patch = "{{ cookiecutter.automerge_patch }}" == "y"
automerge_patch_v0 = "{{ cookiecutter.automerge_patch_v0 }}" == "y"

Expand Down Expand Up @@ -59,14 +58,9 @@
}

if add_golden:
if add_matrix:
cmd = "make gen-golden-all"
else:
cmd = "make gen-golden"

# Add postUpgradeTask to run make gen-golden(-all) if golden tests are enabled.
# Add postUpgradeTask to run make gen-golden-all if golden tests are enabled.
renovatejson["postUpgradeTasks"] = {
"commands": [cmd],
"commands": ["make gen-golden-all"],
"fileFilters": ["tests/golden/**"],
"executionMode": "update",
}
Expand Down
12 changes: 0 additions & 12 deletions {{ cookiecutter.slug }}/.github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ jobs:
args: 'check'
test:
runs-on: ubuntu-latest
{%- if cookiecutter.add_matrix == "y" %}
strategy:
matrix:
instance:
{%- for instance in test_cases %}
- {{ instance }}
{%- endfor %}
{%- endif %}
defaults:
run:
working-directory: {% raw %}${{ env.COMPONENT_NAME }}{% endraw %}
Expand All @@ -59,22 +57,16 @@ jobs:
{% raw %}${{ runner.os }}-go-{% endraw %}
{%- endif %}
- name: Compile component
{%- if cookiecutter.add_matrix == "y" %}
run: make test -e instance={% raw %}${{ matrix.instance }}{% endraw %}
{%- else %}
run: make test
{%- endif %}
{%- if cookiecutter.add_golden == "y" %}
golden:
runs-on: ubuntu-latest
{%- if cookiecutter.add_matrix == "y" %}
strategy:
matrix:
instance:
{%- for instance in test_cases %}
- {{ instance }}
{%- endfor %}
{%- endif %}
defaults:
run:
working-directory: {% raw %}${{ env.COMPONENT_NAME }}{% endraw %}
Expand All @@ -83,9 +75,5 @@ jobs:
with:
path: {% raw %}${{ env.COMPONENT_NAME }}{% endraw %}
- name: Golden diff
{%- if cookiecutter.add_matrix == "y" %}
run: make golden-diff -e instance={% raw %}${{ matrix.instance }}{% endraw %}
{%- else %}
run: make golden-diff
{%- endif %}
{%- endif %}
2 changes: 0 additions & 2 deletions {{ cookiecutter.slug }}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ gen-golden: clean .compile ## Update the reference version for target `golden-di
golden-diff: commodore_args += -f tests/$(instance).yml
golden-diff: clean .compile ## Diff compile output against the reference version. Review output and run `make gen-golden golden-diff` if this target fails.
@git diff --exit-code --minimal --no-index -- tests/golden/$(instance) compiled/
{%- if cookiecutter.add_matrix == "y" %}

.PHONY: golden-diff-all
golden-diff-all: recursive_target=golden-diff
Expand All @@ -89,7 +88,6 @@ lint_kubent_all: $(test_instances) ## Lint deprecated Kubernetes API versions fo
.PHONY: $(test_instances)
$(test_instances):
$(MAKE) $(recursive_target) -e instance=$(basename $(@F))
{%- endif -%}
{%- endif %}

.PHONY: clean
Expand Down
2 changes: 1 addition & 1 deletion {{ cookiecutter.slug }}/Makefile.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app
{%- endif %}

instance ?= {{ test_cases[0] }}
{%- if cookiecutter.add_matrix == "y" and cookiecutter.add_golden == "y" %}
{%- if cookiecutter.add_golden == "y" %}
test_instances ={% for instance in test_cases %} tests/{{instance}}.yml{% endfor %}
{%- endif %}