Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
Merge pull request #62 from projectsyn/feat/renovate-postupgrade-tasks
Browse files Browse the repository at this point in the history
Add logic to generate Renovate `postUpgradeTasks`
  • Loading branch information
simu authored Mar 21, 2022
2 parents eb840ac + 40f563c commit 495fd4d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 11 deletions.
11 changes: 6 additions & 5 deletions config_defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
feature_goUnitTests: false
feature_goldenTests: false
componentName: ""
testMatrix: {}
# key: provider
# entries:
# - variant1
# - variant2

.github/ISSUE_TEMPLATE/config.yml:
contact_links:
Expand All @@ -13,11 +18,7 @@
.github/workflows/test.yaml:
makeTarget: test
goldenTest_makeTarget: golden-diff # Requires `feature_goldenTests`
matrix: {}
# key: provider
# entries:
# - variant1
# - variant2
#matrix: {} # deprecated, use global param `testMatrix`

docs/antora.yml:
version: master
Expand Down
15 changes: 9 additions & 6 deletions moduleroot/.github/workflows/test.yaml.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<%-
@matrix = @configs.key?('matrix') ? @configs['matrix'] : @configs['testMatrix']
-%>
name: Pull Request
on:
pull_request:
Expand Down Expand Up @@ -30,11 +33,11 @@ jobs:
<%- if @configs['feature_componentCompile'] -%>
test:
runs-on: ubuntu-latest
<%- if !@configs['matrix'].empty? -%>
<%- if [email protected]? -%>
strategy:
matrix:
<%= @configs['matrix']['key'] -%>:
<% @configs['matrix']['entries'].each do |entry| -%>
<%= @matrix['key'] -%>:
<% @matrix['entries'].each do |entry| -%>
- <%= entry %>
<% end -%>
<%- end -%>
Expand Down Expand Up @@ -64,11 +67,11 @@ jobs:
<%- if @configs['feature_goldenTests'] -%>
golden:
runs-on: ubuntu-latest
<%- if !@configs['matrix'].empty? -%>
<%- if !@matrix.empty? -%>
strategy:
matrix:
<%= @configs['matrix']['key'] -%>:
<% @configs['matrix']['entries'].each do |entry| -%>
<%= @matrix['key'] -%>:
<% @matrix['entries'].each do |entry| -%>
- <%= entry %>
<% end -%>
<%- end -%>
Expand Down
14 changes: 14 additions & 0 deletions moduleroot/Makefile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ 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 !@configs['testMatrix'].empty? && !@configs['testMatrix']['entries'].empty? -%>

.PHONY: golden-diff-all
golden-diff-all: recursive_target=golden-diff
golden-diff-all: $(test_instances) ## Run golden-diff for all instances. Note: this doesn't work when running make with multiple parallel jobs (-j != 1).

.PHONY: gen-golden-all
gen-golden-all: recursive_target=gen-golden
gen-golden-all: $(test_instances) ## Run gen-golden for all instances. Note: this doesn't work when running make with multiple parallel jobs (-j != 1).

.PHONY: $(test_instances)
$(test_instances):
$(MAKE) $(recursive_target) -e instance=$(basename $(@F))
<%- end -%>
<%- end -%>

.PHONY: clean
Expand Down
3 changes: 3 additions & 0 deletions moduleroot/Makefile.vars.mk.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ COMMODORE_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) docker.io/projects
JB_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) --entrypoint /usr/local/bin/jb docker.io/projectsyn/commodore:latest install

instance ?= defaults
<%- if @configs['feature_goldenTests'] && !@configs['testMatrix'].empty? && !@configs['testMatrix']['entries'].empty? -%>
test_instances =<%- @configs['testMatrix']['entries'].each do |entry| %> tests/<%= entry %>.yml<% end %>
<%- end -%>
14 changes: 14 additions & 0 deletions moduleroot/renovate.json.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
":gitSignOff",
":disableDependencyDashboard"
],
<%- if @configs['feature_goldenTests'] -%>
"postUpgradeTasks": {
"commands": [
<%- if !@configs['testMatrix'].empty? && !@configs['testMatrix']['entries'].empty? -%>
"make gen-golden-all"
<%- else -%>
"make gen-golden"
<%- end -%>
],
"fileFilters": [ "tests/golden/**" ],
"executionMode": "update"
},
"suppressNotifications": [ "artifactErrors" ],
<%- end -%>
"labels": [
"dependency"
]
Expand Down

0 comments on commit 495fd4d

Please sign in to comment.