DEV Community

Discussion on: Beginner-Friendly Introduction to GitLab CI/CD

Collapse
 
renatosuero profile image
Renato Suero • Edited

Great post Zuri, congrats =)
I'd like to suggest 2 things:
First, you could remove npm install in the action build-min-code:, because you added a before_script to run that. It is useful if you don't want to do the second suggestion. As you can see in the screenshot

Second, you could use cache+git strategy to save time and process, You could use cache in the first step to get the code and run npm install, the next can use that files.
Short explanation, you could use cache to store the code and files generated by npm install(so only need to run one time) and git strategy because in other actions you could see to ignore git clone and use the cache folder.

please let me know if you have questions about that, I can explain or send you a Merge Request to see my suggestion.

Collapse
 
webmutation profile image
DDd • Edited

It really depends on your gitlab setup. If you are using dynamic runners. The cost of compressing and decompressing a distributed shared cache is about the same. We have large projects with 600 to 1 GB dependencies and distributed cache shaves about 50 to 60 seconds from a yarn install. Cache is not a small topic. Would love to see more advanced articles on this topic.

Collapse
 
renatosuero profile image
Renato Suero

Yes, you are right. The most important is you know when use cache or not. in your case cache isn't good.