Skip to content

Conversation

@silky1313
Copy link

#2648
This Pull requests is mainly to solve this issue

@silky1313 silky1313 requested a review from a team as a code owner February 7, 2025 09:36
@ChristopherHX
Copy link
Contributor

Thank you for this change, your changed test cache matches my external matrix expansion implementation and my expectations.

I approve (not merge) this from my side if / once CI passes

@mergify
Copy link
Contributor

mergify bot commented Feb 7, 2025

@silky1313 this pull request has failed checks 🛠

@mergify mergify bot added the needs-work Extra attention is needed label Feb 7, 2025
@ChristopherHX
Copy link
Contributor

TestRunEvent/evalmatrix

seems to fail

@ChristopherHX
Copy link
Contributor

ChristopherHX commented Feb 7, 2025

Something is not correct here to my understanding:

You seem to break somehow this special case

  _additionalInclude_0:
    strategy:
      matrix:
        include:
        - def: val
    runs-on: ubuntu-latest
    steps:
    - name: Check if the matrix key A exists
      run: |
        echo $MATRIX
        exit ${{matrix.def == 'val' && '0' || '1'}}
      env:
        MATRIX: ${{toJSON(matrix)}}
    - run: |
        echo "::set-output name=result::success"
      id: result
    outputs:
      result: ${{ steps.result.outputs.result }}

see this yaml file https://github.com/nektos/act/blob/master/pkg/runner/testdata/evalmatrix/push.yml
I have an implementation, which both passes your changed unit test and this file.
I will run that one now in a private github.com repo again just in cases something is wrong with the test.

The other infrastructure failure e.g.. exit code 137 can be resolved by me just rerunning the job.

confirmed this test has to pass in my point of view
image

running the snapshot shows this bug as well for reference
act -W test3.yml -P ubuntu-latest=-self-hosted

[test3.yml/_additionalProperties_0] 🧪  Matrix: map[def:val x:0 y:0 z:0]
[test3.yml/evalm-1                ] 🧪  Matrix: map[A:A]
[test3.yml/evalm-2                ] 🧪  Matrix: map[A:B]
[test3.yml/_additionalInclude_0   ] ⭐ Run Main Check if the matrix key A exists
[test3.yml/_additionalProperties_0] ⭐ Run Main Check if the matrix key A exists
[test3.yml/evalm-1                ] ⭐ Run Main Check if the matrix key A exists
[test3.yml/evalm-2                ] ⭐ Run Main Check if the matrix key A exists
[test3.yml/_additionalInclude_0   ]   | {}
[test3.yml/evalm-1                ]   | { "A": "A" }
[test3.yml/_additionalInclude_0   ]   ❌  Failure - Main Check if the matrix key A exists
[test3.yml/evalm-1                ]   ✅  Success - Main Check if the matrix key A exists
[test3.yml/_additionalProperties_0]   | { "def": "val", "x": 0, "y": 0, "z": 0 }
[test3.yml/_additionalProperties_0]   ✅  Success - Main Check if the matrix key A exists
[test3.yml/evalm-2                ]   | { "A": "B" }
[test3.yml/evalm-2                ]   ✅  Success - Main Check if the matrix key A exists
[test3.yml/_additionalInclude_0   ] exit status 1
[test3.yml/evalm-1                ] Cleaning up container for job evalm
[test3.yml/evalm-2                ] Cleaning up container for job evalm
[test3.yml/evalm-1                ] 🏁  Job succeeded
[test3.yml/evalm-2                ] 🏁  Job succeeded
[test3.yml/_additionalInclude_0   ] 🏁  Job failed
[test3.yml/_additionalProperties_0] ⭐ Run Main echo "::set-output name=result::success"
[test3.yml/_additionalProperties_0]   ⚙  ::set-output:: result=success
[test3.yml/_additionalProperties_0]   ✅  Success - Main echo "::set-output name=result::success"
[test3.yml/_additionalProperties_0] Cleaning up container for job _additionalProperties_0
[test3.yml/_additionalProperties_0] 🏁  Job succeeded
[test3.yml/_additionalInclude_1   ] ⭐ Run Main Check if the matrix key A exists
[test3.yml/_additionalProperties_1] ⭐ Run Main Check if the matrix key A exists
[test3.yml/_additionalInclude_1   ]   | 
[test3.yml/_additionalInclude_1   ]   ❌  Failure - Main Check if the matrix key A exists
[test3.yml/_additionalInclude_1   ] exit status 1
[test3.yml/_additionalInclude_1   ] 🏁  Job failed
[test3.yml/_additionalProperties_1]   | 
[test3.yml/_additionalProperties_1]   ✅  Success - Main Check if the matrix key A exists
[test3.yml/_additionalProperties_1] Cleaning up container for job _additionalProperties_1
[test3.yml/_additionalProperties_1] 🏁  Job succeeded

@silky1313
Copy link
Author

@ChristopherHX , Thank you for reviewing the PR I submitted. I think the problem is that the matrix is ​​empty when merging the include.

@silky1313
Copy link
Author

silky1313 commented Feb 10, 2025

workflow_test.go:344: 
          	Error Trace:	/home/runner/work/act/act/pkg/model/workflow_test.go:344
          	Error:      	Not equal: 
          	            	expected: []map[string]interface {}{map[string]interface {}{"animal":"cat", "color":"green", "fruit":"apple", "shape":"circle"}, map[string]interface {}{"animal":"cat", "color":"green", "fruit":"pear"}, map[string]interface {}{"animal":"dog", "color":"green", "fruit":"apple", "shape":"circle"}, map[string]interface {}{"animal":"dog", "color":"green", "fruit":"pear"}, map[string]interface {}{"fruit":"banana"}, map[string]interface {}{"animal":"cat", "fruit":"banana"}}
          	            	actual  : []map[string]interface {}{map[string]interface {}{"animal":"cat", "color":"green", "fruit":"apple", "shape":"circle"}, map[string]interface {}{"animal":"dog", "color":"green", "fruit":"apple", "shape":"circle"}, map[string]interface {}{"animal":"cat", "color":"green", "fruit":"pear"}, map[string]interface {}{"animal":"dog", "color":"green", "fruit":"pear"}, map[string]interface {}{"fruit":"banana"}, map[string]interface {}{"animal":"cat", "fruit":"banana"}}

@ChristopherHX The pipeline failed to run, which seems to be affected by the order. Do we need to consider the impact of the order? If not, can we just add a sort before the final return?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-work Extra attention is needed size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants