Skip to content

Commit 0e0a3a0

Browse files
authored
Docs: migrate Sphinx docs starter-pack to latest extension (infra) (#2054)
* Migrate docs starter-pack to extension version 1.2.0 The starter-pack has been upgraded to the extension-based version: more tooling supports are provided and most styling configurations are centralized in the canonical-sphinx extension. This upgrade uses the extension v5.1.0, and the starter-pack 1.2.0 https://github.com/canonical/sphinx-docs-starter-pack/releases/tag/1.2.0 * Update Makefile to the latest version * update conf.py to latest and clean up requirements * update spelling wordlist and doc fix * add release version to title * black formatting * update doc check workflow to use new tooling * build readthedocs only upon docs changes * remove unused docs scripts: metrics and update
1 parent 9cb7756 commit 0e0a3a0

26 files changed

+774
-818
lines changed

.github/workflows/documentation-check.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ jobs:
3131
with:
3232
persist-credentials: false
3333

34-
- name: Install Aspell
35-
run: |
36-
sudo apt update -qq
37-
sudo apt install -qq -y aspell aspell-en
38-
3934
- name: Install the doc framework
4035
working-directory: docs/
4136
run: |
@@ -63,13 +58,16 @@ jobs:
6358
with:
6459
persist-credentials: false
6560

66-
- name: woke
67-
uses: get-woke/woke-action@b2ec032c4a2c912142b38a6a453ad62017813ed0
68-
with:
69-
# Cause the check to fail on any broke rules
70-
fail-on-error: true
71-
workdir: docs/
72-
woke-args: "*.rst **/*.rst -c https://github.com/canonical-web-and-design/Inclusive-naming/raw/main/config.yml"
61+
- name: Install the doc framework
62+
working-directory: docs/
63+
run: |
64+
sudo apt install -y -qq python3-venv
65+
make install
66+
67+
- name: Run woke checker
68+
working-directory: docs/
69+
run: |
70+
make woke
7371
7472
linkcheck:
7573
name: Link check

.readthedocs.yaml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,26 @@ build:
1313
jobs:
1414
post_checkout:
1515
- git fetch --unshallow || true
16+
# Cancel building pull requests when there aren't changed in the docs directory.
17+
# If there are no changes (git diff exits with 0) we force the command to return with 183.
18+
# This is a special exit code on Read the Docs that will cancel the build immediately.
19+
# https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition
20+
- |
21+
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- 'docs/' '.readthedocs.yaml';
22+
then
23+
exit 183;
24+
fi
1625
post_create_environment:
1726
- pip install --upgrade pip
1827
- pip install checkbox-ng/
1928

2029
# Build documentation in the docs/ directory with Sphinx
2130
sphinx:
22-
configuration: docs/conf.py
23-
fail_on_warning: true # Fail on all warnings to avoid broken references
31+
builder: dirhtml
32+
configuration: docs/conf.py
33+
fail_on_warning: true # Fail on all warnings to avoid broken references
2434

2535
# Optionally declare the Python requirements required to build your docs
2636
python:
27-
install:
28-
- requirements: docs/.sphinx/requirements.txt
37+
install:
38+
- requirements: docs/.sphinx/requirements.txt

docs/.custom_wordlist.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
debhelper
2+
ethernet
3+
gen_control
4+
json
5+
Makefile
6+
mylauncher
7+
nlink_info_kind
8+
nlink_type
9+
noperstate
10+
plainbox
11+
subprocess
12+
unary

docs/.gitignore

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1-
/*env*/
2-
.sphinx/venv
1+
# Environment
2+
*env*/
3+
.sphinx/venv/
4+
5+
# Sphinx
36
.sphinx/warnings.txt
47
.sphinx/.wordlist.dic
8+
.sphinx/.doctrees/
9+
.sphinx/update/
10+
.sphinx/node_modules/
11+
12+
# Vale
13+
.sphinx/styles/*
14+
.sphinx/vale.ini
15+
16+
# Build outputs
517
_build
18+
19+
# Node.js
20+
package*.json
21+
22+
# Unrelated cache and config files
623
.DS_Store
724
__pycache__
825
.idea/
26+
.vscode/
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: make-spelling
5+
name: Run make spelling
6+
entry: make -C docs spelling
7+
language: system
8+
pass_filenames: false
9+
files: ^docs/.*\.(rst|md|txt)$
10+
11+
- id: make-linkcheck
12+
name: Run make linkcheck
13+
entry: make -C docs linkcheck
14+
language: system
15+
pass_filenames: false
16+
files: ^docs/.*\.(rst|md|txt)$
17+
18+
- id: make-woke
19+
name: Run make woke
20+
entry: make -C docs woke
21+
language: system
22+
pass_filenames: false
23+
files: ^docs/.*\.(rst|md|txt)$

docs/.sphinx/.pymarkdown.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"plugins": {
3+
"selectively_enable_rules": true,
4+
"heading-style": {
5+
"enabled": true,
6+
"style": "atx"
7+
},
8+
"commands-show-output": {
9+
"enabled": true
10+
},
11+
"no-missing-space-atx": {
12+
"enabled": true
13+
},
14+
"blanks-around-headings": {
15+
"enabled": true
16+
},
17+
"heading-start-left": {
18+
"enabled": true
19+
},
20+
"no-trailing-punctuation": {
21+
"enabled": true,
22+
"punctuation": ".,;。,;"
23+
},
24+
"blanks-around-fences": {
25+
"enabled": true,
26+
"list_items": false
27+
},
28+
"blanks-around-lists": {
29+
"enabled": true
30+
},
31+
"hr-style": {
32+
"enabled": true
33+
},
34+
"no-empty-links": {
35+
"enabled": true
36+
},
37+
"no-alt-text": {
38+
"enabled": true
39+
}
40+
},
41+
"extensions": {
42+
"front-matter" : {
43+
"enabled" : true
44+
}
45+
}
46+
}

docs/.sphinx/_static/custom.css

Lines changed: 0 additions & 189 deletions
This file was deleted.

docs/.sphinx/_static/github_issue_links.css

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)