chore: ci

This commit is contained in:
chrismclarke
2023-01-16 19:16:23 -08:00
parent 13cececd57
commit 62127760f3
2 changed files with 10 additions and 17 deletions

View File

@@ -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

View File

@@ -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()
} }