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