Skip to content

Use gitlab npm cache in gitlab CI

Marwan Zibaoui requested to merge npm-cache into master

What

We run npm install multiple times during a CI pipeline. This always downloads npm packages from the internet, which is not necessary.

We can instead cache the npm modules and avoid downloading them from the internet if they have not changed between job runs. This should make things a bit faster. We should also be using npm ci instead of npm install in CI jobs.

This will speed up CI a bit and save some money.

More infos:

Results

After comparing some pipeline job runs with and without cache I can't see any improvement to speed. For an example on an audit job on this branch and another: CleanShot_2024-03-05_at_10.20.37_2x (link to job) CleanShot_2024-03-05_at_10.22.29_2x (link to job)

It's quite strange, i've always seen good speed improvements when doing this, somehow it's not reflected for this project 🤔

Edited by Marwan Zibaoui

Merge request reports