chore(build): broke up pr workflow & measure package size - #1031
Merged
Conversation
dreamorosi
commented
Jul 29, 2022
| }, | ||
| "devDependencies": { | ||
| "@types/aws-lambda": "^8.10.86", | ||
| "@types/jest": "^27.5.2", |
Contributor
Author
There was a problem hiding this comment.
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.
dreamorosi
commented
Jul 29, 2022
dreamorosi
marked this pull request as ready for review
August 4, 2022 08:46
dreamorosi
requested review from
flochaz,
ijemmy and
saragerion
and removed request for
saragerion
August 4, 2022 08:47
flochaz
previously approved these changes
Aug 4, 2022
ijemmy
previously approved these changes
Aug 4, 2022
ijemmy
left a comment
Contributor
There was a problem hiding this comment.
Got a question around environment variable for cache key.
Apart from that, everything looks good to me.
flochaz
approved these changes
Aug 9, 2022
dreamorosi
added a commit
that referenced
this pull request
Aug 9, 2022
* 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 workspacesrelated 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_modulesfolders (both main and ones inexamples/*) between different executions. The cache uses a combination of environment variables, node version, and hash of thepackage-lock.jsonas 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
headandbaseand 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
lernarelated commands and used thenpm workspacesones. 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 updateworkflow 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.