Piotr KrzemiĆski
06/17/2022, 5:46 PMVampire
06/17/2022, 10:21 PMVampire
06/17/2022, 10:21 PMVampire
06/17/2022, 10:22 PMVampire
06/17/2022, 10:42 PMPiotr KrzemiĆski
06/18/2022, 6:25 AMPiotr KrzemiĆski
06/18/2022, 6:28 AMVampire
06/18/2022, 9:47 AMWow, that's a pretty complicated workflow! :)
Indeed, that's why I hoped I could replace it by code. :-) It is the systemtests for my action, running daily. And they are necessary, GitHub already broke it a few times suddenly.
Since you're an action owner, let's add a wrapper for your action
As I said, I have the code for a PR for that ready already. I just wanted to test it first. :-) I tried to test it with my test workflow, but it seems correct limitations are probably too limiting for now, unless I go different ways, like multiplying-out the matrices in Kotlin code instead of using matrices.
Vampire
06/18/2022, 10:08 AMkotlinx-serialization
or similar?
If you want to change that, 1.5 years ago I wrote DAOs for kotlinx-serialization
with KAML for GitHub Action files and GitHub Workflow files. They support the whole syntax, including things like on:
that can be a scalar if only one simple value is contained, a list if only simple values are contained, or a full map, both for serializing and deserializing.
I didn't touch them since then, but I guess GitHub did not change much, if at all.
You could copy those, or I could drag them out into a library and publish them if you prefer.Piotr KrzemiĆski
06/18/2022, 2:47 PMis there a reason you are using plain String building for building the YAML, instead of building it for example usingGood question! At the very beginning I was using kotlinx.serialization and kaml, but decided to move away from it (see this commit) because of kaml's quirks which needed some weird workarounds and YAML post-processing. Back then in the specific circumstances I felt it was a good decision, but now whenever I touch this piece of code that creates YAML, I keep thinking of bringing back the previous approach (see this issue). Especially that a similar library and your solution do use kaml. For now it's not the most painful issue in the project, but I'd be happy if we do some refactoring around this topic one day. Thanks for the DAOs, I wouldn't like to blindly copy them because they look fairly complicated - I'd like to understand them first and understand why such custom code is needed.or similar?kotlinx-serialization
Vampire
06/18/2022, 7:05 PMI wouldn't like to blindly copy them because they look fairly complicated - I'd like to understand them first and understand why such custom code is needed.I actually invented them to parse my action file for having a
run
task that can run my action locally with automatically setting the default values defined in the action file,
and for the workflow file to be able to parse my template with YAML anchors and then write it out flattened-out like GitHub needs it.
But I also used it to get a bit more familiar with kotlinx-serialization
so I wrote them fully-equipped so that they can parse any valid syntax.
As the full valid syntax is polymorphic, it needed a bit of custom serializers.
For example runs
in the action file looks differently between JavaScript, Docker, and Composite actions.
Or output
looks differently if it is a composite action than if it is a normal action.
And for the workflow file it is things like on
being able to have a simple string as value, a string list, or a full map and similar things.
Feel free to ask me anything you want to know about it or if you prefer a lib from it.Piotr KrzemiĆski
06/18/2022, 7:12 PMVampire
06/18/2022, 9:38 PM