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

Don't run cdk package for every TypeScript lambda #2703

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tjmw
Copy link
Member

@tjmw tjmw commented Feb 12, 2025

What does this change?

I noticed that the cdk package step is by far the slowest part of each TypeScript lambda build. The package script does type checking, formatting checking, linting, runs the tests and synths the Cloudformation. We don't need to do all of this for every lambda, so instead run all the checks in the common job and only synth the Cloudformation in the invidual lambda jobs (which we need to upload to Riff Raff).

This doesn't really improve the overall speed for a TypeScript build to complete as it just moves the cdk checks to the common job and the main TS builds still have to wait for common to complete. It does mean the combined overall time for runners is lower and provides slightly faster feedback in the case of a cdk issue (tests failing for example). It also means in the case of a cdk issue only one job (common) will fail, instead of repeating the same failure in the individual TS lambda jobs.

Update 14/2: I've now split the cdk checks and module checks (previously running sequentially in common) to separate jobs which run in parallel (there are no dependencies between them). Then when they're both successfully completed the individual lambda builds run. This does have an overall speedup effect, and maintains the benefit of a cdk failure happening in only one place.

How to test

Picking on the ticket-tailor-webhook build as an example.

Before:
CI-Typescript / common: 1m23s
CI-Typescript / gu-cdk-build (ticket-tailor-webhook): 1m27s

After:
CI-Typescript / common: 2m10s
CI-Typescript / gu-cdk-build (ticket-tailor-webhook): 40s

Latest:
In parallel:
CI-Typescript / modules: 1m
CI-Typescript / cdk-checks: 1m
Then:
CI-Typescript / gu-cdk-build (ticket-tailor-webhook): 37s

(There's some variability in build run times, so take these with a grain of salt. But there does seem to be an overall improvement).

How can we measure success?

Have we considered potential risks?

Images

Accessibility

tjmw added 2 commits February 12, 2025 16:54
I noticed that the cdk package step is by far the slowest part of each
TypeScript lambda build. The package script does type checking,
formatting checking, linting, runs the tests and synths the
Cloudformation. We don't need to do all of this for every lambda, so
instead run all the checks in the common job and only synth the
Cloudformation in the invidual lambda jobs (which we need to upload to
Riff Raff.
@tjmw tjmw marked this pull request as ready for review February 14, 2025 10:03
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.

1 participant