spock icon indicating copy to clipboard operation
spock copied to clipboard

Write GitHub Actions workflow files in Kotlin instead of YAML

Open Vampire opened this issue 2 years ago • 6 comments

For now a 1:1 translation from previous Yaml.

Vampire avatar Apr 12 '23 02:04 Vampire

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.82%. Comparing base (2c7db77) to head (2ffa401). Report is 107 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1630      +/-   ##
============================================
+ Coverage     80.44%   81.82%   +1.38%     
- Complexity     4337     4574     +237     
============================================
  Files           441      446       +5     
  Lines         13534    14342     +808     
  Branches       1707     1814     +107     
============================================
+ Hits          10888    11736     +848     
+ Misses         2008     1939      -69     
- Partials        638      667      +29     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 12 '23 02:04 codecov[bot]

Well, almost 1:1, I added some names where only IDs were present. Due to that the required checks now do not match anymore as they are considering the name, not the ID.

Vampire avatar Apr 12 '23 07:04 Vampire

Not seeing the advantages yet.

Well, noone really likes reading or writing YAML. :-D And especially with such a complex DSL like GitHub workflow files. You always have to read how you can do what where how and have to trial and error. By using this library, you have a proper type-safe DSL with IntelliSense in the IDE that makes it nice to write and read GHA workflows.

You can also easily reuse common logic as you have a turing-complete language at hand. So for example the logic in the custom local setup-build-env and setup-jdks workflows could just be done in a common Kotlin script, if one would be used (read above for why none is used so far).

You could then for example also centrally define the variants and Java versions, or even the complete test matrix and reuse it.

And where it also comes in handy is, for the changes in #1629 as there I can then easily change the script to calculate the size of the Matrix and set the after_n_builds accordingly without the risk of forgetting to update it.

Vampire avatar Apr 17 '23 09:04 Vampire

I now added another commit, that leverages the fact we have a programming language at hand and uses it for the variants and java versions handling, that also shows that it is really useful. :-)

Vampire avatar Apr 18 '23 22:04 Vampire

And another commit added, so that the build script and the workflow generation script use one common source for the Java versions and variants. :-)

I think I'm out of improvement ideas for now, so review-on. :-)

Vampire avatar Apr 19 '23 13:04 Vampire

Just that we don't forget it, I'd still suggest to change back to the default .yaml naming once you are happy with reviewing the changes, to remove the need for the manual configuration, unless you really favor the .yml in the end result :-)

Vampire avatar Aug 22 '23 12:08 Vampire