Skip to content

Commit

Permalink
CI : cache du build Webpack (#4375)
Browse files Browse the repository at this point in the history
* Try caching priv/static

* Bump JS cache version

* Cache webpack build in prod

* Bump JS cache version

* Fix comma

* Trigger CI

* Cache only in CI

* Trigger CI

* Add logging

* Add logging

* Add logging

---------

Co-authored-by: Thibaut Barrère <[email protected]>
  • Loading branch information
AntoineAugusti and thbar authored Dec 12, 2024
1 parent ef33ac3 commit 8f57b87
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defaults: &defaults
default: plt-v4
type: string
js_cache_key:
default: js-v2
default: js-v4
type: string
working_directory: ~/transport
docker:
Expand Down Expand Up @@ -116,6 +116,7 @@ jobs:
key: js-<< parameters.js_cache_key >>-{{ checksum "apps/transport/client/yarn.lock" }}
paths:
- ~/transport/apps/transport/client/node_modules
- ~/transport/apps/transport/priv/static

- run:
name: Run gettext check
Expand Down
17 changes: 15 additions & 2 deletions apps/transport/client/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')

console.log('webpack production configuration is used 🚀')

module.exports = merge(common, {
const config = {
mode: 'production',
optimization: {
minimizer: [
Expand All @@ -13,4 +13,17 @@ module.exports = merge(common, {
new CssMinimizerPlugin()
]
}
})
}

// Enable caching only in the continuous integration env to speed-up builds
if (process.env.CI === 'true') {
console.log('cache is enabled ♻️⚡️')

config.cache = {
type: 'filesystem',
compression: 'gzip'
}
config.infrastructureLogging = { debug: true }
}

module.exports = merge(common, config)

0 comments on commit 8f57b87

Please sign in to comment.