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

Add support for dependency caching #2383

Merged
merged 24 commits into from
Oct 29, 2024
Merged

Add support for dependency caching #2383

merged 24 commits into from
Oct 29, 2024

Conversation

mbg
Copy link
Member

@mbg mbg commented Jul 22, 2024

Work-in-progress to add support for dependency caching to the init Action.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@mbg mbg self-assigned this Jul 22, 2024
Copy link
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

Looks good so far, some initial comments:

src/dependency-caching.ts Show resolved Hide resolved
src/dependency-caching.ts Outdated Show resolved Hide resolved
src/dependency-caching.ts Show resolved Hide resolved
// with an empty string.
const globber = await makeGlobber(cacheConfig.hash);

if ((await globber.glob()).length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean we list files twice (once here and once in cacheKey)? Might not be a performance problem in practice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it does. I looked at this before your review but, unfortunately, the hashFiles implementation in @action/glob isn't exposed in a way that we can just throw an existing array of paths at it, so we'd have to copy the implementation (or a variant of it, depending on how much we care about the intricacies of theirs).

src/dependency-caching.ts Show resolved Hide resolved
src/init-action-post.ts Outdated Show resolved Hide resolved
src/init-action.ts Outdated Show resolved Hide resolved
src/dependency-caching.ts Fixed Show fixed Hide fixed
@mbg mbg force-pushed the mbg/add/dependency-caching branch from a2bb99e to ff98043 Compare October 7, 2024 10:46
@mbg mbg force-pushed the mbg/add/dependency-caching branch from c898cb9 to ad48d53 Compare October 14, 2024 17:48
henrymercer
henrymercer previously approved these changes Oct 28, 2024
Copy link
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

Thanks, this LGTM to start shipping disabled by default! Some final minor suggestions.

src/caching-utils.ts Show resolved Hide resolved
src/caching-utils.ts Outdated Show resolved Hide resolved
src/dependency-caching.ts Show resolved Hide resolved
src/dependency-caching.ts Show resolved Hide resolved
@mbg mbg force-pushed the mbg/add/dependency-caching branch from ba64dbe to bab8f1d Compare October 29, 2024 12:10
@mbg mbg marked this pull request as ready for review October 29, 2024 12:10
@mbg mbg requested a review from a team as a code owner October 29, 2024 12:10
@mbg
Copy link
Member Author

mbg commented Oct 29, 2024

@henrymercer I have addressed your comments and rebased the PR branch on main to resolve the merge conflicts. 21e6a62 onwards are the changes in response to your comments.

Copy link
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

Thanks, looking forward to seeing the results of this internally!

@mbg mbg merged commit dfc2731 into main Oct 29, 2024
542 checks passed
@mbg mbg deleted the mbg/add/dependency-caching branch October 29, 2024 16:09
@mbg mbg restored the mbg/add/dependency-caching branch October 29, 2024 16:09
@mbg mbg deleted the mbg/add/dependency-caching branch October 29, 2024 16:09
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.

2 participants