github-workflows-kt icon indicating copy to clipboard operation
github-workflows-kt copied to clipboard

[Core feature request] Model `matrix` context

Open Vampire opened this issue 1 year ago • 9 comments

What feature do you need? https://docs.github.com/en/actions/learn-github-actions/contexts#matrix-context

Also look at related feature requests: #287 and #297.

Do you have an example usage?

name: Test "${{ matrix.distribution.label }}" distribution on ${{ matrix.environment }}
runs-on: ${{ matrix.environment }}
with:
    distribution: ${{ matrix.distribution.user-id }}

Is there a workaround for not having this feature? If yes, please describe it.

name = """Test "${expr("matrix.distribution.label")}" distribution on ${expr("matrix.environment")}"""
runsOn = Custom(expr("matrix.environment"))
distribution = Distribution.Custom(expr("matrix.distribution.user-id"))

Vampire avatar Jul 28 '22 19:07 Vampire

I've started designing this but I have an outage that prevents me to go further for now

https://github.com/krzema12/github-workflows-kt/commit/35677144bf2d89f904a458b89864da465e374263

jmfayard avatar Oct 31 '22 05:10 jmfayard

Drafting something on my own: https://github.com/krzema12/github-workflows-kt/tree/368-add-matrix-support

krzema12 avatar Jan 17 '23 18:01 krzema12

@jmfayard do you plan to work on this? I'm asking because you're still assigned here.

krzema12 avatar Mar 23 '23 18:03 krzema12

You closed his PR and deleted his branch in January, saying you are drafting it yourself, so, ... :-D

Vampire avatar Mar 23 '23 18:03 Vampire

Ok, so I'm deprioritizing it for v1, to be able to release a "good enough" stable version faster.

krzema12 avatar Mar 23 '23 18:03 krzema12

When adressing this, please also consider being able to configure non-string matrix values. A 2.5 float matrix value is different from a '2.5' string matrix value. And more importantly, a 3.0 float matrix value is different from a '3.0' string matrix value. If you give the latter to somewhere else using ${{ matrix.variant }}, you get 3.0 given, if you give the former, you get 3 given as it is parsed and used as number.

Vampire avatar Apr 19 '23 13:04 Vampire

just curious if there have been any updates regarding the priority of this?

tangdev-w3 avatar Nov 07 '23 04:11 tangdev-w3

@tangdev-w3 it's on hold until client-side binding generation (reducing operational effort of maintaining this library) is done.

It's also pretty tricky to implement elegantly and type-safely, which is another reason I just haven't done it yet. Open for suggestions, PoCs and any other contributions.

krzema12 avatar Nov 07 '23 05:11 krzema12

@tangdev-w3 could you share your exact use case? It will be helpful when deciding on the scope of support to be added.

krzema12 avatar Nov 07 '23 05:11 krzema12