Speed up nanoc by only testing root html files
When the internal link and anchor tests run, it usually takes 20-25 minutes to complete. The reason it takes so long is that the navbar is embedded in every doc page, and so hundreds of links are checked repeatedly, but those links are identical in every page. We should only need to test a single product doc page to verify the navbar links are fine, because all the relative links and anchors are already tested in the main project pipelines.
The other non-product-doc pages, like the landing page and archives page are still checked.
To make this tweak simpler, I've moved the checks:
section in nanoc.yaml
to the very end of the file. After that, we can use echo "lines to add" >> nanoc.yaml
to add the following code to the yaml file, which is what tells it to skip every file that's not in one of the project root folders:
all:
exclude_files:
- '\/(ee|runner|omnibus|charts)\/.*\/.*'
It works by looking for paths with two /
s. So ee/ci/index.html
has two slashes and is skipped, but ee/index.html
has only one slash and is fully tested. (same for the root files in runner/
, omnibus/
and charts/
)
Sample job from this branch without the exclude code:
-
https://gitlab.com/gitlab-org/gitlab-docs/-/jobs/2060629591
Duration: 16 minutes 4 seconds
Sample job from this branch with the exclude code:
-
https://gitlab.com/gitlab-org/gitlab-docs/-/jobs/2060742862
Duration: 6 minutes 43 seconds