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

Commit

Permalink
Move test matrix configuration to global variable
Browse files Browse the repository at this point in the history
Until now, the test matrix has been defined in a local variable for the
`.github/workflows/test.yaml` template. In preparation for generating
Renovate `postUpgradeTasks` and a list of test instances in a make
variable, we need to be able to access the matrix test configuration in
other templates.

This commit moves the test matrix configuration to global variable
`testMatrix`. For now, the GitHub actions template will continue to read
the test matrix from the file-level variable `matrix`, but will fall
back to the global variable `testMatrix` if the file-level variable is
missing.

All already onboarded components should migrate their test matrix (if
any) to global parameter `testMatrix`.
  • Loading branch information
simu committed Mar 18, 2022
1 parent 62158bc commit 8083edf
Show file tree
Hide file tree
Showing 2 changed files with 15 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

0 comments on commit 8083edf

Please sign in to comment.