-
Notifications
You must be signed in to change notification settings - Fork 146
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
chore(build): broke up pr workflow & measure package size #1031
Conversation
@@ -18,6 +18,7 @@ | |||
}, | |||
"devDependencies": { | |||
"@types/aws-lambda": "^8.10.86", | |||
"@types/jest": "^27.5.2", |
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.
This change is needed because we are now running the tests outside of the lerna
scope. For this reason the dependency (which is present in both the examples/cdk
and the main package) is also needed here now.
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.
Got a question around environment variable for cache key.
Apart from that, everything looks good to me.
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.
LGTM
* Add a cdk app capable of building and publishing Lambda Layer * add github action for e2e * add local layer construct npm package * disable fail fast * fix RUNTIME naming in matrix * fix tests * fix outputs export name * Add capability to pass package version to layer builder/publisher * Add initial doc * Add github workflows * add gitignore * fix install deps * pass layer name * make layer public and store details in ssm * fix e2e tests * fix context * remvove groups for tests * publish layer on release * fix account in doc * fix test deps * deploy to all region * fix account number for layer * fix unit tests * add install for layer deps in pr workflow * run unit test of layer publisher for supported node versions only * fix node version in doc * add node 16 to layer e2e * fix comments * fix doc * rename layer to TypeScript * take care of comments * remove layer from doc for now * remove pasted commenbt * chore(build): broke up pr workflow & measure package size (#1031) * chore: broke up pr workflow & measure package size * chore: explicitly set packages where to run cmds * fix: added missing dependency to examples/sam * added cache in workflow * chore: updated workflow + removed env var from command * chore: updated action version * fix: removed redundant env variable Co-authored-by: Florian Chazal <chazalf@amazon.com> Co-authored-by: Andrea Amorosi <dreamorosi@gmail.com>
Description of your changes
This PR proposes changes to the workflow that is run every time a new PR is created & synchronised (aka new commit is pushed). It also spins off in a separate file the workflow that measures the size of the packages as well as changing is trigger from even based to on-demand.
On PR code update
The workflow that runs every time new code is added to a PR was running completely in sequential mode before this PR, aside from the matrix feature that was used to select the runtime. I have applied the same pattern also to the examples and break up the two sections in two different jobs that can now run in parallel:
I also have removed completely all the
lerna
-related commands in favor of thenpm workspaces
related ones. This allows us to select the packages we want to run the commands in.Initially I used a more terse version:
but then I moved to a slightly longer, but more explicit one, that will allow us to exclude packages that are work in progress until they are ready, while still being part of the workspace:
Each job is also now caching the content of the
node_modules
folders (both main and ones inexamples/*
) between different executions. The cache uses a combination of environment variables, node version, and hash of thepackage-lock.json
as key so that if environment, version, or dependencies change the cache is rebuilt.Here's an example of cache hit.
The current time for all the checks to run is now ~2.5 minutes when all caches are hit 💨 🥵 ⚡ (around ~3min when no cache)
Measure packages size
This action was previously running after the one described in the section above. This meant each new commit was causing the action to run and leave a comment. After several weeks some of us (me included) have felt like this was generating a bit too much noise in the comments section.
This PR moves the action in its own workflow and allows maintainers to run it on demand by specifying a PR number. The action will use the PR number to get the info related to
head
andbase
and then, after having computed the changes and sizes, it will leave a comment only when manually triggered.This PR is dependant on this other PR made in the action's repo.
Like in the previous workflow, I have also removed the
lerna
related commands and used thenpm workspaces
ones. This has the added benefit of avoiding running unnecessary commands in theexamples/*
folders.Finally, this new version of the action and workflow, once merged will allow to safely run the checks also for PRs that come from external contributors.
Additionally, both workflows are now
lerna
-free and usenpm workspaces
🤟How to verify this change
See example of the
On PR code update
workflow run in a fork here:https://github.com/dreamorosi/aws-lambda-powertools-typescript/actions/runs/2724186137
Also see an example of the comment left on a PR opened by an external user on a fork (of a fork):
https://github.com/dreamorosi/aws-lambda-powertools-typescript/pull/3
Related issues, RFCs
Issue number: #991
PR status
Is this ready for review?: YES
Is it a breaking change?: NO
Checklist
Breaking change checklist
N/A
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.