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

Build performance: Avoid preview on mainline builds, and cache dependencies #300

Merged
merged 4 commits into from
Aug 23, 2023

Conversation

holly-cummins
Copy link
Collaborator

As a result of #299, our builds have got atrociously slow. We were already doing three npm installs per build, so let's see if caching helps.

I also noticed we were doing a 5m upload of artifacts for previews, even on mainline builds.

@github-actions
Copy link

github-actions bot commented Aug 22, 2023

🚀 PR Preview 85a605b has been successfully built and deployed to https://extensions-quarkus-pr-300-preview.surge.sh

@holly-cummins
Copy link
Collaborator Author

It looks like the cache flag on the setup-node step doesn't cache as much as you'd hope. I'm finding the docs a bit unclear, but I think it's caching global dependencies only.

As an alternative, we can cache the whole node_modules directory. This has some risk, but let's try it until we hit problems.

@holly-cummins
Copy link
Collaborator Author

I think I've just tripped over the risk. Some of the gatsby code does this:

cp ./node_modules/gatsby-page-utils/dist/apply-trailing-slash-option.js ./node_modules/gatsby-page-utils && gatsby build

... and then falls over. I'll do a more restricted cache, just of the dependency that's very slow.

@holly-cummins holly-cummins force-pushed the no-preview-on-main-builds branch from 7db66de to 6f99090 Compare August 23, 2023 09:51
@holly-cummins
Copy link
Collaborator Author

Even with a populated ~/.npm folder and --prefer-offline, the npm ci phase was still taking around seven minutes. The cache was being downloaded, but it didn't seem to affect the speed of the github dependency. I've switched to using a binary package of the forked dependency, and npm ci is down to 1m 16s on a 'clean' run, and (disappointingly) the same on a run where a cache exists. That's basically the same as it was before all these changes, but at least it's not worse.

@holly-cummins
Copy link
Collaborator Author

The build seems to be a bit faster without the cache and composite action, so I've removed it.

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