"GitHub CI is easy", he said. "It's just bash ", he said.
Until he actually had to use it.
Took 2 hours of reading through examples just to deploy the site.
Turns out, it is hard to do even just the bash stuff when you can't see the container.
Normally, you don't want to commit code unless it's been at least minimally tested, and preferably more than that.
All the CI's, however, force a workflow where you can only test it by committing the code and seeing if it works. I'm not sure how to fix that, but I see the problem.
If you can test it on a feature branch then at least you can squash or tidy the commits after you've got them working. If you can only test by committing to main though, curse whoever designed that.
Write as much of your CICD in a scripting language like bash/python/whatever. You'll be able to test it locally and then the testing phase of your CICD will just be setting up the environment so it has the right git branches coined, permissions, etc.
You won't need to do 30 commits now, only like 7! And you'll cry for only like 20 minutes instead of a whole afternoon!
What i recommend is to create a private repo with the same content, create and test the workflow file there and copy it back into the main repo when you get it to work.
Unless I'm doing a simple bash or pwsh script, I prefer to use GHA Script due to the headaches caused by how things are translated down and missing quotes/slashes/etc can cause massive headaches.
I've been meaning on spending a morning getting Nektos/ACT running.
I’ve been meaning on spending a morning getting Nektos/ACT running.
I was just going to say I need to find a way to run it all on my system to learn it.
If this can do it without actually having to push to GitHub, it would be really good for practice.
Act works out pretty good but you need to pass it a token and stuff so the actual github CLI bits can work which is kind of a hassle. It took me much too long to discover you need a classic token, the one from the github CLI app gh auth token won't work.
Edit:
Ah! Also getting act setup involved getting docker setup which involved me enabling virtualization in my bios for what I swear is like the 4th time I've done so. Also because I'm on Windows (iirc at least) I had to setup WSL or just make a windows container ಠ_ಠ
Instead of using up time/$$ on github actions, you should try running the script locally to make sure everything works before commiting: https://github.com/nektos/act
Github CI still feels like an alpha project sometimes. Certain stacks look like they are supported, but it can be difficult to do the same thing as other CI tools (like GitLab/CircleCI/etc...) such as running things locally. Their tool will get you 95% of the way there. Other tools will also allow you to ssh into the box itself (Gitlab/Circleci) which is extremity useful when debugging scripts/processes.
My personal opinion is that github actions is a work in progress given the state of much of the community. GitLab has much better tools. But this is a great learning experience for sure. And more projects that use CI/CD the better!
yep! After doing CI/CD for close to 10 years, its one of the things Travis/CircleCI/GitLab has done that make it soooo much easier to debug. Saves time and sanity. Because as much as we hate it, sometimes the only way to debug is to actually dig into the system your working under.