From 0bd11346ff5289b493125a70e81d8c3734058ea6 Mon Sep 17 00:00:00 2001 From: Martyn Welch <martyn.welch@collabora.com> Date: Wed, 30 Jun 2021 15:03:02 +0100 Subject: [PATCH] Add URL testing as CI step In order to ensure we are notified of broken URLs, add testing of external URLs as a step in the CI. It is added as `allow_failure` because it would be inapproprate to stop merges because an unrelated link has broken. Additionally, only test when CI is run on master branch to save repeatedly testing the URLs each time a merge request or branch is updated. Signed-off-by: Martyn Welch <martyn.welch@collabora.com> --- .gitlab-ci.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eceddfe18..756c90a91 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,9 +2,27 @@ variables: GIT_SUBMODULE_STRATEGY: recursive stages: + - test - generate-html - generate-pdf +test-urls: + image: debian:buster-slim + stage: test + tags: + - lightweight + before_script: + - apt update && apt install -y --no-install-recommends + python3 + python3-markdown + python3-requests + script: + - scripts/test_urls.py content/ + # We are running this for all commits for all URLs on the website, so it + # wouldn't be fair to block a merge due to an unrelated URL suddenly failing. + # Treat this as a warning that the site has degraded. + allow_failure: true + test-html: image: name: klakegg/hugo:latest -- GitLab