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
fix: add missing build workflow strategy matrix controls #3500
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #3500 +/- ##
==========================================
+ Coverage 96.34% 96.36% +0.02%
==========================================
Files 192 192
Lines 37627 37798 +171
Branches 3519 3536 +17
==========================================
+ Hits 36251 36424 +173
+ Misses 1376 1374 -2 ☔ View full report in Codecov by Sentry. |
Appears to have worked |
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'll have a look at the rest later. This feels awfully complicated though. We might need an abstraction here.
src/github/workflows.ts
Outdated
@@ -366,7 +366,7 @@ function setupTools(tools: workflows.Tools) { | |||
|
|||
if (tools.java) { | |||
steps.push({ | |||
uses: "actions/setup-java@v3", | |||
uses: "actions/setup-java@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.
We need separate PRs for each of these please
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.
Adjusted back
I agree completely. It is very hacky at a few points to get this working, partially due to unanticipated needs in the node project object. I rather liked the interface of this (sister?) project: https://github.com/cdklabs/cdk-pipelines-github/blob/main/src/workflows-model.ts I don't like that they've put the implementation of the interface in the core of the project: https://github.com/cdklabs/cdk-pipelines-github/blob/main/src/pipeline.ts#L196 But still. I particularly like the handling of inputs and outputs. Gonna related note, this is another place where Tokens (like in CDK) would come in handy. Was there a historic reason that they weren't put into Projen? |
Ok, so I was able to simplify a bit, and I think it fits the patterns of const project = new cdk.JsiiProject({
//...
buildWorkflowOptions: {
jobStrategy: {
matrix: {
domain: {
runsOn: ["ubuntu-latest", "windows-latest"],
node: [
{ version: "18.14.2" },
{ version: "18.18" },
{ version: "18.20" }, // some tools behave differently in 18.20 than 18.18
{ version: "20" },
],
},
include: [
{
runsOn: "ubuntu-latest",
node: { version: "18.14.2" },
release: true,
},
],
},
},
nodeVersion: "${{ matrix.node.version }}",
uploadArtifactsVariable: "matrix.release",
runsOnVariable: "matrix.runsOn",
},
workflowNodeVersion: "18.14.2", // was existing
// ... Options to simplify from here: Assume if
Assume if
With all that, then this would be the same as above: const project = new cdk.JsiiProject({
//...
buildWorkflowOptions: {
jobStrategy: {
matrix: {
domain: {
runsOn: ["ubuntu-latest", "windows-latest"],
node: [
{ version: "18.14.2" },
{ version: "18.18" },
{ version: "18.20" }, // some tools behave differently in 18.20 than 18.18
{ version: "20" },
],
},
},
},
},
workflowNodeVersion: "18.14.2", // was existing
// ... That's a lot of convention over configuration, but that's kinda The Projen Way™. We could also just say "useBuildStrategyMatrix: true" to default all the above (minus the windows but until we're ready) but I feel that's too presumptive unless we also allow it to be fully overridden. |
Fixes #3499
Feedback extra welcome, as some of this feels extra clumsy
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.