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

Speed up CI/deploy #110

Merged
merged 3 commits into from
Jan 19, 2024
Merged

Speed up CI/deploy #110

merged 3 commits into from
Jan 19, 2024

Conversation

thejcannon
Copy link
Member

Using suggestions in facebook/docusaurus#4765 which are:

  • Using swc-loader as a webpack JS loader
    • Full disclosure, this is greek to me. I'm just being a lemming and copying Docusaurus' own configuration
  • Caching in CI/deployment

Copy link
Contributor

@huonw huonw left a comment

Choose a reason for hiding this comment

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

Thanks for trying to make improvements here.

I've kicked off a rebuild to see how much difference this makes in the 'perfect' case (fully cached/no changes).

uses: actions/cache@v3
with:
path: node_modules/.cache/webpack
key: docusaurus-${{ github.ref_name }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this key will cause the cache to be created once and never refreshed for each ref, which is probably fine for PRs (presumably their first build and their later builds are similar enough to likely-benefit), but... won't be good for main.

Maybe we could do something like https://www.pantsbuild.org/2.18/docs/using-pants/using-pants-in-ci 's coarse-grained caching with a commit or a bulk hashFiles in there too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, see latest commit.

I got this from https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache.

As I understand it the key will always miss, and then go to the restore key. That'll essentially be the last build on this branch (or main in the case of a PR). The downside is it'll eat up cache quota like a hungry hungry hippo. But meh?

A repository can have up to 10GB of caches. Once the 10GB limit is reached, older caches will be evicted based on when the cache was last accessed. Caches that are not accessed within the last week will also be evicted.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yeah. We might want to nuke the cache when it gets too big (along the lines of the pants docs), or else each cache entry will eventually grow to be 5GB, 10GB, 20GB, ... by itself, and we'll spend more time uploading/downloading than it saves.

@huonw
Copy link
Contributor

huonw commented Jan 14, 2024

Seems like it cut the build time from:

So a reasonable 7.5 minute saving, but not exactly getting us to "fast" CI.

@thejcannon thejcannon merged commit f7e427c into main Jan 19, 2024
1 check passed
@thejcannon thejcannon deleted the jcannon/speedup branch January 19, 2024 18:17
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.

3 participants