Skip to content

Added a link checker step in the doctests jobs using both Lychee and … #6

Added a link checker step in the doctests jobs using both Lychee and …

Added a link checker step in the doctests jobs using both Lychee and … #6

Workflow file for this run

name: Check URLs with Lychee and Sphinx
on:
push:
branches:
- main
- develop
pull_request:
schedule:
# Run everyday at 3 am UTC
- cron: "0 3 * * *"
jobs:
linkCheckerLychee:
runs-on: ubuntu-latest
steps:
# Cache Lychee results to avoid hitting rate limits
- name: Restore lychee cache
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
# Check URLs with Lychee
- uses: actions/checkout@v4
- name: Lychee URL checker
uses: lycheeverse/[email protected]
with:
args: >-
--cache
--no-progress
--max-cache-age 2d
--timeout 10
--max-retries 5
--skip-missing
--exclude-loopback
--exclude https://twitter.com/pybamm_
--exclude "https://doi\.org|www.sciencedirect\.com/*"
--exclude https://www.rse.ox.ac.uk
--accept 200,429
--exclude-path ./CHANGELOG.md
--exclude-path ./scripts/update_version.py
--exclude-path asv.conf.json
--exclude-path docs/conf.py
--exclude-path all_contributors.md
'./**/*.rst'
'./**/*.md'
'./**/*.py'
'./**/*.ipynb'
'./**/*.json'
'./**/*.toml'
fail: true
jobSummary: true
format: markdown
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
linkcheckerSphinx:
runs-on: ubuntu-latest
needs: linkCheckerLychee
steps:
# Checkout repository code
- uses: actions/checkout@v4
# Install Python and dependencies for Sphinx
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install PyBaMM with [docs,all]
run: |
python -m pip install --upgrade pip
pip install -e .[docs,all]
# Run Sphinx's linkcheck builder
- name: Run Sphinx linkcheck
run: |
sphinx-build -b linkcheck . _build/linkcheck || exit 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}