From b73b404fda6a275982d0ef36bb528a5ffbb7a887 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Thu, 14 Dec 2023 15:26:41 +0100 Subject: [PATCH 1/2] CI: add link-checker. Fixes #953 --- .../continuous-integration-workflow.yml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index 35eb2b7f..a7f42c9e 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -37,6 +37,26 @@ jobs: env: JEKYLL_ENV: production + - name: Check validity of links + uses: lycheeverse/lychee-action@v1.8.0 + with: + # Reasons for exclude + # - https://root.cern/[0-9]+: Breaks checking local builds due to links in the metadata + # - https://root.cern/(?!(files|download|doc)): Checking links to the deployed website breaks appearing in the metadata of newly added webpages. Exceptions are links to files, download and doc, which are not part of the Jekyll setup. + # - rootbnch-grafana-test.cern.ch: Breaks due to SSO + # - lcgapp-services.cern.ch: Breaks due to SSO + # - indico.desy.de: Returns frequently error code 403 + # - https://www.sciencedirect.com: frequent 403 errors + # - nbviewer: When notebook generation fails, nbviewer returns 404 errors, and errors might even be cached in CDNs for a while + # - lcginfo.cern.ch: does not support HTTPS, see https://sft.its.cern.ch/jira/browse/SPI-1672 + # - http://simul.iro.umontreal.ca/testu01/tu01.html does not support HTTPS + # Reasons for file-ignore + # - Broken links in historic ROOT v5 release notes + # add `--include-fragments` once released! + args: --base build --no-progress --exclude-mail --exclude-path 'build/install/all_releases/' --exclude https://rootbnch-grafana-test.cern.ch --exclude https://lcgapp-services.cern.ch/root-jenkins --exclude https://indico.desy.de --exclude https://nbviewer.jupyter.org --exclude https://www.sciencedirect.com --exclude https://github.com/root-project/web/tree/ --exclude https://twitter.com/ROOT_Project 'build/**/*.html' + # Fail action on broken links + fail: true + - name: Only allow links to root.cern, never root.cern.ch run: | grep -n -R 'root\.cern\.ch' build || exit 0 # grep returns non-zero if no match is found From 8f32042383963246117a62a85776ccdf17717f51 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Thu, 14 Dec 2023 16:28:53 +0100 Subject: [PATCH 2/2] CI: rewrite links to yet-to-be-uploaded PR artifacts to local. Just use @1. --- .github/workflows/continuous-integration-workflow.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index a7f42c9e..fdda85fe 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -38,7 +38,7 @@ jobs: JEKYLL_ENV: production - name: Check validity of links - uses: lycheeverse/lychee-action@v1.8.0 + uses: lycheeverse/lychee-action@v1 with: # Reasons for exclude # - https://root.cern/[0-9]+: Breaks checking local builds due to links in the metadata @@ -50,10 +50,11 @@ jobs: # - nbviewer: When notebook generation fails, nbviewer returns 404 errors, and errors might even be cached in CDNs for a while # - lcginfo.cern.ch: does not support HTTPS, see https://sft.its.cern.ch/jira/browse/SPI-1672 # - http://simul.iro.umontreal.ca/testu01/tu01.html does not support HTTPS - # Reasons for file-ignore + # Reasons for --exclude-path # - Broken links in historic ROOT v5 release notes + # # add `--include-fragments` once released! - args: --base build --no-progress --exclude-mail --exclude-path 'build/install/all_releases/' --exclude https://rootbnch-grafana-test.cern.ch --exclude https://lcgapp-services.cern.ch/root-jenkins --exclude https://indico.desy.de --exclude https://nbviewer.jupyter.org --exclude https://www.sciencedirect.com --exclude https://github.com/root-project/web/tree/ --exclude https://twitter.com/ROOT_Project 'build/**/*.html' + args: --base build/ --no-progress --exclude-mail --exclude-path './build/${PR_NUMBER}/install/all_releases/' --exclude https://rootbnch-grafana-test.cern.ch --exclude https://lcgapp-services.cern.ch/root-jenkins --exclude https://indico.desy.de --exclude https://nbviewer.jupyter.org --exclude https://www.sciencedirect.com --exclude https://github.com/root-project/web/tree/ --exclude https://twitter.com/ROOT_Project ${{ github.event_name == 'pull_request' && '--remap "https://root.cern/${PR_NUMBER} file://" ' || ''}} 'build/**/*.html' # Fail action on broken links fail: true