Skip to content

Commit 2f9bf52

Browse files
committed
ci: Break CI build on broken links, ommitted files
Mkdocs is able to detect broken links or files ommitted from the "nav" configuration, etc. By default, it reports them at the "INFO" level. Instead, we can have "mkdocs build" report them as warnings. To do so, we follow the documentation's "recommended settings for most sites (maximal strictness)" (see link). Once "mkdocs build" emits warnings for these issues, we can use the strict mode (-s|--strict) to have the build error out if anything looks wrong. Let's use this in CI to detect broken links, for example. Link: https://www.mkdocs.org/user-guide/configuration/#validation Signed-off-by: Quentin Monnet <qmo@qmon.net>
1 parent f685895 commit 2f9bf52

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
uses: extractions/setup-just@v2
3232

3333
- name: Build docs
34-
run: just build
34+
run: just build --strict
3535

3636
- name: Deploy preview to Netlify
3737
uses: nwtgck/actions-netlify@v2

Justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ _run +cmd:
1414
docker run -q --pull=always --rm -v $(pwd):/docs -p 8000:8000 {{image}} {{cmd}}
1515

1616
# Build docs site (unversioned)
17-
build: (_run "mkdocs build")
17+
build *opts: (_run "mkdocs build" opts)
1818

1919
# Clean generated docs site
2020
clean:

mkdocs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ markdown_extensions:
133133
emoji_index: !!python/name:material.extensions.emoji.twemoji
134134
emoji_generator: !!python/name:material.extensions.emoji.to_svg
135135

136+
validation:
137+
omitted_files: warn
138+
absolute_links: warn
139+
unrecognized_links: warn
140+
anchors: warn
141+
136142
watch:
137143
- includes
138144
- overrides

0 commit comments

Comments
 (0)