Basically, it means that after every commit some automatic actions happen (well, actually, not on every commit, depends on how you configure it). In my case
.gitlab-ci.ymllooks like this:
It means that after I commit something into
masterbranch it performs deploy stage (script
move-content-to-public.sh) and test stage (script
w3c-html-validation.sh). Both scripts are my own custom sripts and in this post I want to talk about the second one – W3C validation of HTML file.
You can find the script content in my repo:
w3c-html-validation.sh. The good thing is that W3C has public API for validating some URL. So all I need is just requesting this API with URL of my page as an input parameter. And that's the reason why I perform the test stage after the deploy stage: new changes need to be published to check them. Also, W3C errors are not verty critical, so I dond't want to fail the whole deploy because of them.
It looks like a very simple thing (it actually is), but it took a time for me to configure this validation (as I was not very familiar with YAML), so I decided to leave some notes here.