Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write GitHub Actions workflow files in Kotlin instead of YAML #1630

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

Vampire
Copy link
Member

@Vampire Vampire commented Apr 12, 2023

For now a 1:1 translation from previous Yaml.

@Vampire Vampire force-pushed the kotlin-workflow-files branch 2 times, most recently from 4f2aa09 to c3ed268 Compare April 12, 2023 02:44
@Vampire Vampire requested a review from leonard84 April 12, 2023 02:46
@codecov
Copy link

codecov bot commented Apr 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.79%. Comparing base (2c7db77) to head (5d5dfdd).
Report is 177 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1630      +/-   ##
============================================
+ Coverage     80.44%   81.79%   +1.34%     
- Complexity     4337     4642     +305     
============================================
  Files           441      450       +9     
  Lines         13534    14582    +1048     
  Branches       1707     1839     +132     
============================================
+ Hits          10888    11927    +1039     
+ Misses         2008     1975      -33     
- Partials        638      680      +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Vampire
Copy link
Member Author

Vampire commented Apr 12, 2023

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.

Copy link
Member

@leonard84 leonard84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not seeing the advantages yet.

build.gradle Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep the .yml extension for the generated files, so that we can actually see the diff?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you can manually configure the target file name.
I changed it to ...yml, but maybe we want to return to the default after you verified the changes to not have the unnecessary configuration?

.github/workflows/branches-and-prs.main.kts Outdated Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
@Vampire Vampire force-pushed the kotlin-workflow-files branch 4 times, most recently from b8fd23e to 9267bae Compare April 17, 2023 08:35
@Vampire
Copy link
Member Author

Vampire commented Apr 17, 2023

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 Vampire requested a review from leonard84 April 17, 2023 09:12
@Vampire
Copy link
Member Author

Vampire commented Apr 18, 2023

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
Copy link
Member Author

Vampire commented Apr 19, 2023

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 Vampire force-pushed the kotlin-workflow-files branch 2 times, most recently from e6d19ea to e65cca2 Compare April 19, 2023 13:50
@Vampire Vampire changed the title Write GitHub Actions workflow files in Kotlin instead of Yaml Write GitHub Actions workflow files in Kotlin instead of YAML Apr 19, 2023
@Vampire Vampire force-pushed the kotlin-workflow-files branch from e004e5f to e65cca2 Compare April 19, 2023 17:51
@Vampire Vampire force-pushed the kotlin-workflow-files branch from e65cca2 to 8f5f426 Compare April 28, 2023 01:03
Copy link
Member

@leonard84 leonard84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Unless, it is not supported, then you end up with _customArguments and unsightly mapOf, which read much worse through all the added noise IMHO.

build.gradle Outdated Show resolved Hide resolved
.github/workflows/branches-and-prs.main.kts Outdated Show resolved Hide resolved
.github/workflows/branches-and-prs.main.kts Outdated Show resolved Hide resolved
.github/workflows/branches-and-prs.main.kts Outdated Show resolved Hide resolved
.github/workflows/branches-and-prs.main.kts Outdated Show resolved Hide resolved
.github/workflows/release.main.kts Outdated Show resolved Hide resolved
.github/workflows/branches-and-prs.main.kts Outdated Show resolved Hide resolved
@Vampire Vampire force-pushed the kotlin-workflow-files branch from 2d52d58 to 8dadbc2 Compare June 1, 2023 16:24
@Vampire Vampire requested a review from leonard84 June 1, 2023 17:04
@Vampire Vampire force-pushed the kotlin-workflow-files branch 2 times, most recently from 8f578ed to 69bfb43 Compare June 6, 2023 13:04
.github/workflows/common.main.kts Outdated Show resolved Hide resolved
.github/workflows/common.main.kts Outdated Show resolved Hide resolved
@Vampire Vampire force-pushed the kotlin-workflow-files branch from 69bfb43 to 4ae5422 Compare June 6, 2023 23:00
@Vampire Vampire requested a review from leonard84 June 9, 2023 19:40
@Vampire Vampire force-pushed the kotlin-workflow-files branch from a2e391d to 793dffb Compare June 28, 2023 01:08
@Vampire Vampire force-pushed the kotlin-workflow-files branch from 793dffb to 73058a6 Compare August 15, 2023 19:11
@Vampire Vampire force-pushed the kotlin-workflow-files branch from 4d00c81 to 5d5dfdd Compare December 27, 2024 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants