Add NextJS build cache#8
Open
cskrov wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds steps to cache the NextJS build in the deploy workflow to reduce build time.
- Adds restore and save cache steps for the .next/cache directory.
- Uses file hashes for ts/tsx files to compute the cache key.
Comments suppressed due to low confidence (1)
.github/workflows/deploy-to-dev.yaml:64
- The cache key calculation only includes TypeScript files, which may omit other critical files (e.g., next.config.js, package.json) that influence the NextJS build output. Consider including these files in the hashFiles pattern to ensure the cache is invalidated when relevant changes occur.
key: nextjs-${{ hashFiles('**/*.ts', '**/*.tsx') }}
9b768ef to
e82d124
Compare
e82d124 to
92267bf
Compare
92267bf to
1e18c7b
Compare
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.
The cache spends more time than it saves!
At least for now.
Some numbers from testing
Cache saves 8-10 seconds, depending on the run. Build time typically went from 45 to 36 seconds.
The cache spends around 15-17 seconds (roughly 50-50 restore and save).