Skip to content

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

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 … #3

Workflow file for this run

name: Documentation

Check failure on line 1 in .github/workflows/docs.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/docs.yml

Invalid workflow file

`pull_requests` is not a valid event name
on:
workflow_dispatch:
pull_requests:
push:
branches:
- main
- develop
schedule:
# Run every day at 3 am UTC
- cron: "0 3 * * *"
env:
PYBAMM_DISABLE_TELEMETRY: "true"
FORCE_COLOR: 3
PYBAMM_IDAKLU_EXPR_CASADI: ON
PYBAMM_IDAKLU_EXPR_IREE: ON
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
docs:
runs-on: ubuntu-latest
steps:
# Checkout repository code
- name: Check out repository
uses: actions/checkout@v4
# Install Linux system dependencies
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2
with:
packages: graphviz pandoc
execute_install_scripts: true
# Install TeXLive for Linux
- name: Install TeXLive for Linux
run: |
sudo apt-get update
sudo apt-get install texlive-latex-extra dvipng
# Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'
# Upgrade pip and install dependencies for PyBaMM
- name: Install PyBaMM with [docs,all]
run: |
python -m pip install --upgrade pip
pip install -e .[docs,all]
# Run doctests for Python 3.11
- name: Run doctests
run: python -m nox -s doctests
# Build the docs (HTML)
- name: Build docs (HTML)
run: sphinx-build -b html docs/ docs/_build/html
# Check links in the documentation with Sphinx
- name: Run Sphinx linkcheck
run: sphinx-build -b linkcheck docs/ docs/_build/linkcheck
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Run Lychee URL checker in parallel (No redundant checkout)
- name: Lychee URL checker
uses: lycheeverse/lychee-action@v2.1.0
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 }}