-
Notifications
You must be signed in to change notification settings - Fork 72
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
ci: Re-arrange workflows to remove duplication #410
Conversation
It will then be easier to add new profiles as more versions of kotlin are supported. This also creates dependencies between jobs to only execute codecoverage when tests are successful.
@@ -18,4 +18,4 @@ jobs: | |||
runs-on: ubuntu-latest | |||
steps: | |||
- uses: actions/checkout@v4 | |||
- uses: gradle/wrapper-validation-action@v3 | |||
- uses: gradle/actions/wrapper-validation@v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An small bonus to update this workflow to use the new wrapper-validation action.
@@ -94,7 +170,7 @@ jobs: | |||
if: contains(matrix.os, 'win') == false | |||
run: chmod +x ./mvnw | |||
- name: Build with Maven | |||
run: ./mvnw verify --file pom.xml -Pcoverage | |||
run: ./mvnw verify --file pom.xml -Pcoverage,kotlin-1.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kotlin-1.9
needs to be explicitly activated here, as documented here:
This profile will automatically be active for all builds unless another profile in the same POM is activated using one of the previously described methods. All profiles that are active by default are automatically deactivated when a profile in the POM is activated on the command line or through its activation config.
@@ -69,6 +68,22 @@ | |||
</plugins> | |||
</build> | |||
</profile> | |||
<!-- Kotlin versions --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like having this profile in two places, but I thought it was better than moving it to the parent pom.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #410 +/- ##
=========================================
Coverage 91.33% 91.33%
Complexity 1215 1215
=========================================
Files 76 76
Lines 3161 3161
Branches 489 489
=========================================
Hits 2887 2887
Misses 164 164
Partials 110 110 ☔ View full report in Codecov by Sentry. |
This looks great to me! |
Hi @marcospereira, this looks great! I really like, that we now have everything in one build file together. And sorry for the late reply, I just returned from a long vacation. |
Motivation
There are two primary motivations here:
The final workflow looks like this:
Reference: https://github.com/marcospereira/jte/actions/runs/12173115754
Main changes
Merging Graal and Maven workflows
They are mostly copied and pasted from each other, with minor differences, and bringing them together into a single workflow file helps to later maintain consistency in a single place.
Jobs dependencies
Previously, all the jobs were executed simultaneously, meaning that even if the code does not pass unit tests, it still runs coverage, graal tests, etc. Now, there is a dependency between jobs, so we only execute more expensive workflow sections if the tests pass.
This hasn't added much to the workflow total time.
Reusable actions
Two new reusable actions exist to set up Gradle caching and remove locally published artifacts before caching. Although it is possible to add a few other reusable actions for steps that seem repetitive, I've decided to add only these two because they don't add logic to the build. Instead, they are mainly CI infrastructure.
Future work
I will build on top of this to add support for Kotlin 2.1.0. It is currently broken for the Gradle plugin.