-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #364 from projectsyn/bastjan-patch-1
Add golden and matrix tests to component template
- Loading branch information
Showing
12 changed files
with
236 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
|
||
"add_lib": "n", | ||
"add_pp": "n", | ||
"add_golden": "y", | ||
"add_matrix": "y", | ||
|
||
"copyright_holder": "VSHN AG <[email protected]>", | ||
"copyright_year": "1950", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
import shutil | ||
|
||
create_lib = "{{ cookiecutter.add_lib }}" == "y" | ||
add_golden = "{{ cookiecutter.add_golden }}" == "y" | ||
|
||
if not create_lib: | ||
shutil.rmtree("lib") | ||
|
||
if not add_golden: | ||
shutil.rmtree("tests/golden") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ on: | |
branches: | ||
- master | ||
|
||
env: | ||
COMPONENT_NAME: {{ cookiecutter.slug }} | ||
|
||
jobs: | ||
linting: | ||
runs-on: ubuntu-latest | ||
|
@@ -24,3 +27,47 @@ jobs: | |
- uses: snow-actions/[email protected] | ||
with: | ||
args: 'check' | ||
test: | ||
runs-on: ubuntu-latest | ||
{%- if cookiecutter.add_matrix == "y" %} | ||
strategy: | ||
matrix: | ||
instance: | ||
- defaults | ||
{%- endif %} | ||
defaults: | ||
run: | ||
working-directory: {% raw %}${{ env.COMPONENT_NAME }}{% endraw %} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
path: {% raw %}${{ env.COMPONENT_NAME }}{% endraw %} | ||
- 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: | ||
- defaults | ||
{%- endif %} | ||
defaults: | ||
run: | ||
working-directory: {% raw %}${{ env.COMPONENT_NAME }}{% endraw %} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
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 %} |
11 changes: 9 additions & 2 deletions
11
commodore/component-template/{{ cookiecutter.slug }}/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
_archive/ | ||
_public/ | ||
# Commodore | ||
.cache/ | ||
helmcharts/ | ||
manifests/ | ||
vendor/ | ||
jsonnetfile.lock.json | ||
crds/ | ||
compiled/ | ||
|
||
# Antora | ||
_archive/ | ||
_public/ | ||
|
||
# Additional entries |
13 changes: 13 additions & 0 deletions
13
commodore/component-template/{{ cookiecutter.slug }}/.sync.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
:global: | ||
componentName: {{ cookiecutter.name }} | ||
githubUrl: {{ cookiecutter.github_url }} | ||
feature_goldenTests: true | ||
|
||
docs/antora.yml: | ||
name: {{ cookiecutter.slug }} | ||
title: {{ cookiecutter.name }} | ||
{% 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 -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,5 +144,11 @@ This command doesn't have any command line options. | |
*--copyright* TEXT:: | ||
The copyright holder added to the license file. Defaults to "VSHN AG <[email protected]>." | ||
|
||
*--golden-tests / --no-golden-tests*:: | ||
Enable golden tests for the component. Defaults to _yes_. | ||
|
||
*--matrix-tests / --no-matrix-tests*:: | ||
Enable test matrix for the component compile and golden tests. Defaults to _yes_. | ||
|
||
*--help*:: | ||
Show component new usage and options then exit. |
Oops, something went wrong.