mirror of
https://github.com/fergalmoran/onearmy-community-platform.git
synced 2025-12-22 09:37:54 +00:00
chore: ci
This commit is contained in:
@@ -287,9 +287,10 @@ jobs:
|
||||
environment:
|
||||
GENERATE_SOURCEMAP: 'false'
|
||||
SKIP_PREFLIGHT_CHECK: 'true'
|
||||
# Can increase if experiencing out-of-memory issues - https://circleci.com/docs/2.0/configuration-reference/#resourceclass
|
||||
# NOTE - memory available to node is automatically configured in .env-cmdrc
|
||||
resource_class: medium
|
||||
NODE_OPTIONS: '--max-old-space-size=5632'
|
||||
# If experiencing out-of-memory issues can increase resource_class below and max space size above
|
||||
# https://circleci.com/docs/2.0/configuration-reference/#resourceclass
|
||||
resource_class: medium+
|
||||
steps:
|
||||
# whilst checkout-install could be persisted from previous step, that is less efficient than just using caching
|
||||
- checkout
|
||||
|
||||
@@ -28,27 +28,19 @@ function getNodeOptions() {
|
||||
|
||||
let NODE_OPTIONS = process.env.NODE_OPTIONS || ''
|
||||
|
||||
// fix out-of-memory issues - dynamically set max available memory based on machine
|
||||
// use up to 4GB locally, and 90 % machine max when running on CI, loosely based on
|
||||
// https://github.com/cloudfoundry/nodejs-buildpack/pull/82
|
||||
// fix out-of-memory issues - default to 4GB but allow override from CI
|
||||
// NOTE - would like to auto-calculate but does not support CI (https://github.com/nodejs/node/issues/27170)
|
||||
if (!NODE_OPTIONS.includes('--max-old-space-size')) {
|
||||
let maxSize = 4096
|
||||
if (process.env.CI) {
|
||||
const totalMem = require('os').totalmem() / (1024 * 1024)
|
||||
maxSize = Math.floor(totalMem * 0.9)
|
||||
}
|
||||
NODE_OPTIONS += ` --max-old-space-size=${maxSize}`
|
||||
NODE_OPTIONS += ` --max-old-space-size=4096`
|
||||
}
|
||||
if (NODE_VERSION > '17') {
|
||||
// fix https://github.com/facebook/create-react-app/issues/11708
|
||||
// https://github.com/facebook/create-react-app/issues/12431
|
||||
NODE_OPTIONS += ' --openssl-legacy-provider --no-experimental-fetch'
|
||||
}
|
||||
console.log(process.env)
|
||||
if (process.env.CI) {
|
||||
console.log(NODE_OPTIONS)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (process.env.CI) {
|
||||
console.log('NODE_OPTIONS', NODE_OPTIONS, '\n')
|
||||
}
|
||||
return NODE_OPTIONS.trim()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user