-
-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add docs.yml workflow to handle all CI tasks related to documen…
…tation
- Loading branch information
1 parent
38d3e96
commit 404b928
Showing
2 changed files
with
100 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,75 @@ | ||
name: Check URLs with Lychee and Sphinx | ||
name: Documentation | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_requests: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
pull_request: | ||
schedule: | ||
# Run everyday at 3 am UTC | ||
# 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: | ||
linkCheckerLychee: | ||
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 | ||
|
||
# Cache Lychee results to avoid hitting rate limits | ||
- name: Restore lychee cache | ||
uses: actions/cache@v4 | ||
# 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: | ||
path: .lycheecache | ||
key: cache-lychee-${{ github.sha }} | ||
restore-keys: cache-lychee- | ||
python-version: "3.11" | ||
cache: 'pip' | ||
|
||
# Check URLs with Lychee | ||
- uses: actions/checkout@v4 | ||
# 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/[email protected] | ||
with: | ||
|
@@ -57,29 +101,3 @@ jobs: | |
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters