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.
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.
Yes, you are right. The most important is you know when use cache or not. in your case cache isn't good.
Really well done! The info is clear and helpful. What I appreciated most was the structured approach you took to explaining a rather complex operation.
Congrats on your first tech post, too. Looking forward to seeing more. ☺💪👏💯
Thanks for writing about GitLab!
I learned ci/CD with gitlab. What a pleasure! Recently I tried Travis and of ok could aim up the experience in one Shreveport, it would be "why did this have to be so hard?"
I thoroughly recommend gitlab.
Well done on the article, @zurihunter
Awesome work @zurihunter
I literally wanted to do this as a first post 🤣
As a small side note - I would add usage of npm ci as a before_script - only works if you have a package-lock.json - but way faster than npm install
Hum depends on the version of npm. I would use yarn it still is faster. And like the first comment. With cache. Npm ci is very much abandoned, the idea was good but the speed is not there.
Nice Article. I would love to see some best practices around the actual deployment. Most examples just have fluff in those sections, similar to your gitlab (below).
"deploy-stage": "echo 'Deploying to STAGING'",
"deploy-prod": "echo 'Deploying to PRODUCTION'"
It feels like people are in two camps around deployment. Many just use Heroku or other services for the actual deployment and the rest are just scp'ing files around. I would love to better understand best practices in the non-heroku-ish case.
Looks perfect for beginners
What's the specifications of a gitlab CI/CD ?
Cool post, thanks for sharing :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.