File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
src/content/configuration Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -438,3 +438,43 @@ module.exports = {
438438```
439439
440440W> Don't share the cache between calls with different options.
441+
442+ ## Setup cache in CI/CD system
443+
444+ Filesystem cache allows to share cache between builds in CI. To setup cache:
445+
446+ - CI should have an option to share cache between builds.
447+ - CI should run job in the same absolute path. This is important since webpack cache files store absolute paths.
448+
449+ ### GitLab CI/CD
450+
451+ Common config could looks like
452+
453+ ``` yaml
454+ variables :
455+ # fallback to use "main" branch cache, requires GitLab Runner 13.4
456+ CACHE_FALLBACK_KEY : main
457+
458+ # this is webpack build job
459+ build-job :
460+ cache :
461+ key : ' $CI_COMMIT_REF_SLUG' # branch/tag name
462+ paths :
463+ # cache directory
464+ # make sure that you don't run "npm ci" in this job or change default cache directory
465+ # otherwise "npm ci" will prune cache files
466+ - node_modules/.cache/webpack/
467+ ` ` `
468+
469+ ### Github actions
470+
471+ ` ` ` yaml
472+ - uses : actions/cache@v3
473+ with :
474+ # cache directory
475+ path : node_modules/.cache/webpack/
476+ key : ${{ GITHUB_REF_NAME }}-webpack-build
477+ # fallback to use "main" branch cache
478+ restore-keys : |
479+ main-webpack-build
480+ ` ` `
You can’t perform that action at this time.
0 commit comments