Skip to content

Commit

Permalink
Check external links in CI (#100)
Browse files Browse the repository at this point in the history
* Add a session to check links in documentation

* Ignore internal html link

Workarround as the linkcheck don't see internal html.

* Check links in doc workflow

* Update jobs name
  • Loading branch information
oncleben31 committed Dec 14, 2020
1 parent 05b0608 commit 3986347
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build documentation
name: Check documentation

on:
push:
Expand All @@ -8,6 +8,7 @@ on:

jobs:
docs:
name: Build documentation & check links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
Expand All @@ -17,8 +18,11 @@ jobs:
- run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt nox
- run: nox --force-color --session=docs
- name: Build documentation
run: nox --force-color --session=docs
- uses: actions/upload-artifact@v2
with:
name: docs
path: docs/_build
- name: Check links
run: nox --force-color --session=linkcheck
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
"fixed_sidebar": "true",
"sidebar_width": "250px",
}
linkcheck_ignore = ["codeofconduct.html"]
16 changes: 16 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import nox
from nox.sessions import Session

nox.options.sessions = (
"linkcheck",
)

@nox.session
def docs(session: Session) -> None:
Expand All @@ -24,3 +27,16 @@ def docs(session: Session) -> None:
session.run("sphinx-autobuild", *args)
else:
session.run("sphinx-build", *args)

@nox.session
def linkcheck(session: Session) -> None:
"""Build the documentation."""
args = session.posargs or ["-W", "-b", "linkcheck", "docs", "docs/_build"]

builddir = Path("docs", "_build")
if builddir.exists():
shutil.rmtree(builddir)

session.install("-r", "docs/requirements.txt")

session.run("sphinx-build", *args)

0 comments on commit 3986347

Please sign in to comment.