diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c0dd019..7f9d32e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,9 +23,6 @@ jobs: add_golden: - "n" - "y" - add_matrix: - - "n" - - "y" add_go_unit: - "n" - "y" @@ -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: | diff --git a/cookiecutter.json b/cookiecutter.json index b61aa1c..0f605fb 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -8,7 +8,6 @@ "add_lib": "n", "add_pp": "n", "add_golden": "y", - "add_matrix": "y", "add_go_unit": "n", "automerge_patch": "y", diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 6281529..1299bd7 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -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" @@ -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", } diff --git a/{{ cookiecutter.slug }}/.github/workflows/test.yaml b/{{ cookiecutter.slug }}/.github/workflows/test.yaml index 10704d9..aed8c47 100644 --- a/{{ cookiecutter.slug }}/.github/workflows/test.yaml +++ b/{{ cookiecutter.slug }}/.github/workflows/test.yaml @@ -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 %} @@ -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 %} @@ -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 %} diff --git a/{{ cookiecutter.slug }}/Makefile b/{{ cookiecutter.slug }}/Makefile index 95f84db..f0f83db 100644 --- a/{{ cookiecutter.slug }}/Makefile +++ b/{{ cookiecutter.slug }}/Makefile @@ -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 @@ -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 diff --git a/{{ cookiecutter.slug }}/Makefile.vars.mk b/{{ cookiecutter.slug }}/Makefile.vars.mk index 84aec7e..6be8bd0 100644 --- a/{{ cookiecutter.slug }}/Makefile.vars.mk +++ b/{{ cookiecutter.slug }}/Makefile.vars.mk @@ -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 %}