Skip to content

Commit

Permalink
Update from template
Browse files Browse the repository at this point in the history
Template version: main (8a2e780)
  • Loading branch information
bastjan committed Nov 14, 2023
1 parent 927c84a commit 5e0c421
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test_cases": "defaults",
"add_lib": "n",
"add_pp": "n",
"add_golden": "n",
"add_golden": "y",
"add_matrix": "n",
"add_go_unit": "n",
"copyright_holder": "VSHN AG <[email protected]>",
Expand Down
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ insert_final_newline = false

[Makefile]
indent_style = tab

; Ignore golden test outputs
[tests/golden/**]
indent_size = unset
indent_style = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
11 changes: 11 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,14 @@ jobs:
path: ${{ env.COMPONENT_NAME }}
- name: Compile component
run: make test
golden:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
steps:
- uses: actions/checkout@v4
with:
path: ${{ env.COMPONENT_NAME }}
- name: Golden diff
run: make golden-diff
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ help: ## Show this help
all: lint

.PHONY: lint
lint: lint_jsonnet lint_yaml lint_adoc ## All-in-one linting
lint: lint_jsonnet lint_yaml lint_adoc lint_kubent ## All-in-one linting

.PHONY: lint_jsonnet
lint_jsonnet: $(JSONNET_FILES) ## Lint jsonnet files
Expand All @@ -34,6 +34,9 @@ lint_yaml: ## Lint yaml files
.PHONY: lint_adoc
lint_adoc: ## Lint documentation
$(VALE_CMD) $(VALE_ARGS)
.PHONY: lint_kubent
lint_kubent: ## Check for deprecated Kubernetes API versions
$(KUBENT_DOCKER) $(KUBENT_ARGS) -f $(KUBENT_FILES)

.PHONY: format
format: format_jsonnet ## All-in-one formatting
Expand All @@ -54,6 +57,17 @@ docs-serve: ## Preview the documentation
.PHONY: test
test: commodore_args += -f tests/$(instance).yml
test: .compile ## Compile the component
.PHONY: gen-golden
gen-golden: commodore_args += -f tests/$(instance).yml
gen-golden: clean .compile ## Update the reference version for target `golden-diff`.
@rm -rf tests/golden/$(instance)
@mkdir -p tests/golden/$(instance)
@cp -R compiled/. tests/golden/$(instance)/.

.PHONY: golden-diff
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/

.PHONY: clean
clean: ## Clean the project
Expand Down
6 changes: 6 additions & 0 deletions Makefile.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,11 @@ ANTORA_PREVIEW_CMD ?= $(DOCKER_CMD) run --rm --publish 35729:35729 --publish 202
COMMODORE_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(git_volume) $(root_volume) docker.io/projectsyn/commodore:latest
COMPILE_CMD ?= $(COMMODORE_CMD) component compile . $(commodore_args)
JB_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) --entrypoint /usr/local/bin/jb docker.io/projectsyn/commodore:latest install
GOLDEN_FILES ?= $(shell find tests/golden/$(instance) -type f)

KUBENT_FILES ?= $(shell echo "$(GOLDEN_FILES)" | sed 's/ /,/g')
KUBENT_ARGS ?= -c=false --helm3=false -e
KUBENT_IMAGE ?= ghcr.io/doitintl/kube-no-trouble:latest
KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app/kubent $(KUBENT_IMAGE)

instance ?= defaults
8 changes: 8 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
"ignorePaths": [
".github/**"
],
"postUpgradeTasks": {
"commands": [
"make gen-golden"
],
"fileFilters": [ "tests/golden/**" ],
"executionMode": "update"
},
"suppressNotifications": [ "artifactErrors" ],
"labels": [
"dependency"
],
Expand Down
Empty file.

0 comments on commit 5e0c421

Please sign in to comment.