Skip to content

Commit

Permalink
CI: Move Node memory leak workaround to .npmrc file (#5622)
Browse files Browse the repository at this point in the history
  • Loading branch information
4ludwig4 authored Dec 8, 2022
1 parent a30c2b8 commit 5a1155b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 23 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ jobs:
cache: 'gradle'
- name: Production Build
run: ./gradlew -Pprod -Pwar clean bootWar
env:
NODE_OPTIONS: --max_old_space_size=6144
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ jobs:
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
env:
NODE_OPTIONS: --max_old_space_size=6144

- run: rm -rf build/resources/main/static

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
# It seems like there is some memory issue with these tests with the project-wide default node option
# `--max-old-space-size` set in the .npmrc, therefore we delete it for this test as a workaround
- name: remove project-wide node options set in .npmrc just for this test
run: rm .npmrc || true
- name: Setup Node.js
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -140,8 +144,6 @@ jobs:
client-style:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
NODE_OPTIONS: '--max_old_space_size=3072'
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
Expand Down
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# project wide workaround for the webapp build which might fail due to problems regarding JavaScript heap memory leaks
node-options=--max-old-space-size=6144

27 changes: 10 additions & 17 deletions docs/dev/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -471,26 +471,19 @@ above in `Server Setup <#server-setup>`__) and if you have configured
``application-artemis.yml`` correctly, then you should be able to login
with your TUM Online account.

In case you encounter any problems regarding JavaScript heap memory leaks when executing ``npm run serve`` or any other
scripts from ``package.json``,
you can add a memory limit parameter (``--max_old_space_size=5120``) in the script.
You can do it by changing the **start** script in ``package.json`` from:
.. HINT::
In case you encounter any problems regarding JavaScript heap memory leaks when executing ``npm run serve`` or
any other scripts from ``package.json``, you can adjust a
`memory limit parameter <https://nodejs.org/docs/latest-v16.x/api/cli.html#--max-old-space-sizesize-in-megabytes>`__
(``node-options=--max-old-space-size=6144``) which is set by default in the project-wide `.npmrc` file.

::

"start": "ng serve --hmr",

to

::

"start": "node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng serve --hmr",

If you still face the issue, you can try to set a higher value than 5120. Possible values are 6144, 7168, and 8192.
If you still face the issue, you can try to set a lower/higher value than 6144 MB.
Recommended values are 3072 (3GB), 4096 (4GB), 5120 (5GB) , 6144 (6GB), 7168 (7GB), and 8192 (8GB).

The same change could be applied to each **ng** command as in the example above.
You can override the project-wide `.npmrc` file by
`using a per-user config file (~/.npmrc) <https://docs.npmjs.com/cli/v8/configuring-npm/npmrc>`__.

Make sure to **not commit this change** in ``package.json``.
Make sure to **not commit changes** in the project-wide ``.npmrc`` unless the Github build also needs these settings.


For more information, review `Working with
Expand Down

0 comments on commit 5a1155b

Please sign in to comment.