Skip to content

Move tsc to validate changes. Run validations in parallel #12998

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

Merged
merged 1 commit into from
Sep 15, 2022

Conversation

mads-hartmann
Copy link
Contributor

Description

To declutter the Werft phases for the build job I've moved the tsc check to the "Validating changes" phase. I also changed the implementation of typecheckWerftJobs and preCommitCheck so they are properly async, which makes it possible to run them in parallel (achieved through Promise.all)

I also had to make the actual build execution use await and add exec(.., { async: true }) as traces otherwise broke. I'm not a 100% certain why this is needed - my hunch is that by running the build in a promise we're allowing other code to temporarily execute on the event loop which takes care of some trace management - as the change is harmless I'm okay keeping it in this PR and then we can investigate why the traces breaks without it some other time.

Related Issue(s)

No issue, just noticed this when working on other things

How to test

Here's a screenshot before/after that shows the slice has been moved to the validating phase (resulting in less clutter IMO)

Screenshot 2022-09-15 at 14 29 11

Screenshot 2022-09-15 at 14 29 26

And here's a screenshot of the trace before/after that shows that the slices are now running in parallel (not that there is a huge speed increase as the precommit hook takes much longer than tsc --noEmit, but nonetheless)

Screenshot 2022-09-15 at 14 29 52

Screenshot 2022-09-15 at 14 29 35

werft job run github

Release Notes

NONE

Documentation

N/A

Werft options:

  • /werft with-preview

@@ -45,7 +45,8 @@ export async function buildAndPublish(werft: Werft, jobConfig: JobConfig) {
if (publishRelease) {
exec(`gcloud auth activate-service-account --key-file "/mnt/secrets/gcp-sa-release/service-account.json"`);
}
exec(

await exec(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the change I'm talking about in the PR description. Without this traces break.

@mads-hartmann mads-hartmann requested a review from a team September 15, 2022 12:32
@mads-hartmann mads-hartmann mentioned this pull request Sep 15, 2022
1 task
branchNameCheck(werft, config);
preCommitCheck(werft);
await Promise.all([branchNameCheck(werft, config), preCommitCheck(werft), typecheckWerftJobs(werft)]);
Copy link
Contributor

Choose a reason for hiding this comment

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

That's really nice, I bet there are more places that we could do the same thing 🙂

Copy link
Contributor

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

Nice 💅

@roboquat roboquat merged commit 62a6639 into main Sep 15, 2022
@roboquat roboquat deleted the mads/move-tsc-to-validate branch September 15, 2022 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants