@@ -234,6 +234,50 @@ func TestGithubActionsWorkflowJobs(t *testing.T) {
234234 },
235235 },
236236 },
237+ {
238+ Name : "matrix with expression value" ,
239+ Input : `example_matrix: { strategy: { matrix: "${{ fromJSON(needs.config.outputs.matrix) }}" } }` ,
240+ Expected : GithubActionsJob {
241+ ID : "example_matrix" ,
242+ },
243+ },
244+ {
245+ Name : "matrix with scalar dimension skipped" ,
246+ Input : `example_matrix: { strategy: { matrix: { rust: stable, os: [ubuntu-latest, macos-latest] } } }` ,
247+ Expected : GithubActionsJob {
248+ ID : "example_matrix" ,
249+ Strategy : GithubActionsStrategy {
250+ Matrix : map [string ]StringList {
251+ "os" : {"ubuntu-latest" , "macos-latest" },
252+ },
253+ },
254+ },
255+ },
256+ {
257+ Name : "matrix with include and exclude skipped" ,
258+ Input : `example_matrix: { strategy: { matrix: { os: [ubuntu-latest], include: [{ os: windows-latest, experimental: true }], exclude: [{ os: macos-latest }] } } }` ,
259+ Expected : GithubActionsJob {
260+ ID : "example_matrix" ,
261+ Strategy : GithubActionsStrategy {
262+ Matrix : map [string ]StringList {
263+ "os" : {"ubuntu-latest" },
264+ },
265+ },
266+ },
267+ },
268+ {
269+ Name : "matrix with nested sequences skipped" ,
270+ Input : "example_matrix:\n strategy:\n matrix:\n target:\n - [a, b]\n - [c, d]\n os: [ubuntu-latest]" ,
271+ Expected : GithubActionsJob {
272+ ID : "example_matrix" ,
273+ Strategy : GithubActionsStrategy {
274+ Matrix : map [string ]StringList {
275+ "target" : nil ,
276+ "os" : {"ubuntu-latest" },
277+ },
278+ },
279+ },
280+ },
237281 }
238282
239283 for _ , tt := range tests {
@@ -489,12 +533,12 @@ jobs:
489533
490534 assert .Equal (t , "workflow_call" , workflow .Events [1 ].Name )
491535 assert .Equal (t , "string" , workflow .Events [1 ].Inputs [0 ].Type )
492- assert .Equal (t , true , workflow .Events [1 ].Inputs [0 ].Required )
536+ assert .Equal (t , StringBool ( true ) , workflow .Events [1 ].Inputs [0 ].Required )
493537 assert .Equal (t , "build" , workflow .Events [1 ].Outputs [0 ].Name )
494538 assert .Equal (t , "build_id" , workflow .Events [1 ].Outputs [0 ].Description )
495539 assert .Equal (t , "${{ jobs.build.outputs.build }}" , workflow .Events [1 ].Outputs [0 ].Value )
496540 assert .Equal (t , "BOARD_TOKEN" , workflow .Events [1 ].Secrets [0 ].Name )
497- assert .Equal (t , true , workflow .Events [1 ].Secrets [0 ].Required )
541+ assert .Equal (t , StringBool ( true ) , workflow .Events [1 ].Secrets [0 ].Required )
498542
499543 assert .Equal (t , "schedule" , workflow .Events [2 ].Name )
500544 assert .Equal (t , "0 0 * * 0" , workflow .Events [2 ].Cron [0 ])
@@ -583,7 +627,7 @@ runs:
583627 assert .Equal (t , "John Doe" , actionMetadata .Author )
584628 assert .Equal (t , "Analyze git sha" , actionMetadata .Description )
585629 assert .Equal (t , "git_sha" , actionMetadata .Inputs [0 ].Name )
586- assert .Equal (t , true , actionMetadata .Inputs [0 ].Required )
630+ assert .Equal (t , StringBool ( true ) , actionMetadata .Inputs [0 ].Required )
587631 assert .Equal (t , "string" , actionMetadata .Inputs [0 ].Type )
588632 assert .Equal (t , "response" , actionMetadata .Outputs [0 ].Name )
589633 assert .Equal (t , "Response from the command executed" , actionMetadata .Outputs [0 ].Description )
0 commit comments