Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: processing of strategy.matrix.include #1200

Merged
merged 13 commits into from
Jun 20, 2022
Merged

Conversation

ChristopherHX
Copy link
Contributor

@ChristopherHX ChristopherHX commented Jun 5, 2022

Refactored GetMatrices to more closely match my runner.server project and github actions.

  • include properties are now merged with the matrix cross product, if common keys match with an existing entry
  • include properties not matched against any existing entry are added as an additional matrix instance

Partially fixes #769
fixes #1182
resolves #1223

Known Issues, based on recent research in my related project

  • Matrix Keys are case insensitive, but not in act
  • Object Keys are case insensitive in deepequal, but not in act
  • Scalar values are compared with abstract equal, see expression evaluator
    null == '' == 0
  • prevent empty matrices by always return a default matrix entry if everything is empty

@github-actions
Copy link
Contributor

github-actions bot commented Jun 5, 2022

MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ CREDENTIALS secretlint yes no 1.31s
✅ EDITORCONFIG editorconfig-checker 2 0 0.02s
✅ GIT git_diff yes no 0.01s

See errors details in artifact MegaLinter reports on CI Job page
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

@pull-request-size pull-request-size bot added size/M and removed size/S labels Jun 5, 2022
@codecov
Copy link

codecov bot commented Jun 5, 2022

Codecov Report

Merging #1200 (a0f6eeb) into master (4f8da0a) will increase coverage by 4.47%.
The diff coverage is 75.89%.

@@            Coverage Diff             @@
##           master    #1200      +/-   ##
==========================================
+ Coverage   57.50%   61.98%   +4.47%     
==========================================
  Files          32       40       +8     
  Lines        4594     5437     +843     
==========================================
+ Hits         2642     3370     +728     
- Misses       1729     1797      +68     
- Partials      223      270      +47     
Impacted Files Coverage Δ
pkg/model/action.go 0.00% <0.00%> (ø)
pkg/model/step_result.go 0.00% <ø> (ø)
pkg/container/docker_run.go 15.18% <21.73%> (+9.64%) ⬆️
pkg/container/docker_pull.go 33.33% <33.33%> (ø)
pkg/container/file_collector.go 44.85% <44.85%> (ø)
pkg/common/git/git.go 50.00% <47.91%> (ø)
pkg/container/docker_auth.go 47.61% <50.00%> (+2.61%) ⬆️
pkg/model/workflow.go 54.32% <50.00%> (+3.40%) ⬆️
pkg/exprparser/interpreter.go 73.37% <53.48%> (-0.02%) ⬇️
pkg/model/planner.go 50.73% <60.00%> (+0.32%) ⬆️
... and 30 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@pull-request-size pull-request-size bot added size/L and removed size/M labels Jun 17, 2022
Comment on lines 230 to 244
case []interface{}:
for _, i := range t {
i := i.(map[string]interface{})
extraInclude := true
for k := range i {
if _, ok := m[k]; ok {
includes = append(includes, i)
extraInclude = false
break
}
}
if extraInclude {
extraIncludes = append(extraIncludes, i)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have this case? Doesn't this allow invalid syntax.

@@ -247,6 +247,7 @@ func TestReadWorkflow_Strategy(t *testing.T) {
{"datacenter": "site-c", "node-version": "14.x", "site": "staging"},
{"datacenter": "site-c", "node-version": "16.x", "site": "staging"},
{"datacenter": "site-d", "node-version": "16.x", "site": "staging"},
{"php-version": 5.4},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified this Test, correct me if my expectation is wrong.

@ChristopherHX ChristopherHX marked this pull request as ready for review June 17, 2022 20:30
@ChristopherHX ChristopherHX requested a review from a team as a code owner June 17, 2022 20:30
@ChristopherHX ChristopherHX changed the title matrix v2 fix: processing of strategy.matrix.include Jun 20, 2022
@cplee cplee merged commit c30bc82 into master Jun 20, 2022
@cplee cplee deleted the ChristopherHX-matrix-v2 branch June 20, 2022 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants