Skip to content

Commit 25a9e73

Browse files
ci: Divide checkers to docs and samples
- One workflow will check documentation and the other one samples. Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
1 parent 1ea7c8b commit 25a9e73

7 files changed

Lines changed: 599 additions & 213 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Matter Documentation Validation
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- 'v*-branch'
8+
9+
paths:
10+
- 'docs/**'
11+
- 'samples/**/*.rst'
12+
- 'scripts/matter_sample_checker/**'
13+
- '.github/workflows/doc-validation.yml'
14+
- 'west.yml'
15+
16+
permissions:
17+
contents: read
18+
19+
env:
20+
WEST_PATH_CACHE: ${{ github.workspace }}/west-path-cache
21+
22+
jobs:
23+
matter-doc-validation:
24+
runs-on: ubuntu-24.04
25+
steps:
26+
- name: Checkout the code
27+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
28+
with:
29+
path: ncs-matter
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
33+
with:
34+
python-version: 3.12
35+
cache: pip
36+
cache-dependency-path: |
37+
ncs-matter/scripts/requirements.txt
38+
ncs-matter/docs/requirements-doc.txt
39+
40+
- name: Install packages
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y wget python3-pip git
44+
pip install -r ncs-matter/scripts/requirements.txt
45+
pip install -r ncs-matter/docs/requirements-doc.txt
46+
47+
- name: Restore west module path cache
48+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
49+
with:
50+
path: west-path-cache
51+
key: west-path-cache-${{ hashFiles('ncs-matter/west.yml') }}
52+
restore-keys: |
53+
west-path-cache-
54+
55+
- name: Prepare west workspace
56+
run: |
57+
rm -rf .west
58+
west init -l ncs-matter --mf west.yml
59+
west update -n -o=--depth=1 --path-cache "${WEST_PATH_CACHE}"
60+
61+
- name: Validate Matter documentation
62+
run: |
63+
python ncs-matter/scripts/matter_sample_checker/matter_doc_checker.py \
64+
--base ncs-matter

.github/workflows/sample-validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
west init -l ncs-matter --mf west.yml
5757
west update -n -o=--depth=1 --path-cache "${WEST_PATH_CACHE}"
5858
59-
- name: validate Matter samples and documentation
59+
- name: Validate Matter samples
6060
run: |
6161
python ncs-matter/scripts/matter_sample_checker/matter_sample_checker.py \
6262
--samples-zap-yaml ncs-matter/scripts/zap_samples.yml \

docs/checks/conf.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,27 @@
6767
"https://google.com:443",
6868
]
6969

70-
linkcheck_anchors_ignore = [r"page="]
70+
# Keep Sphinx default ^! for Kconfig hashbang anchors (#!CONFIG_*), plus page=.
71+
linkcheck_anchors_ignore = [r"^!", r"page="]
72+
73+
# docs.nordicsemi.com redirects to nrfconnectdocs.nordicsemi.com and many section
74+
# anchors are rendered client-side, so verify the page responds but not anchors.
75+
linkcheck_allowed_redirects = {
76+
r"https://docs\.nordicsemi\.com/.*": r"https://nrfconnectdocs\.nordicsemi\.com/.*",
77+
}
78+
linkcheck_anchors_ignore_for_url = (
79+
r"https://docs\.nordicsemi\.com/.*",
80+
r"https://nrfconnectdocs\.nordicsemi\.com/.*",
81+
)
82+
83+
# Sphinx defaults to a Firefox/Sphinx User-Agent. Some sites return HTTP 403 to
84+
# that client while serving browsers normally. check_doc_links.py re-tests 403
85+
# failures with a browser-like GET before reporting them as broken.
86+
user_agent = (
87+
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 "
88+
"(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
89+
)
90+
7191
linkcheck_timeout = 30
7292
linkcheck_retries = 2
7393
linkcheck_workers = 5

0 commit comments

Comments
 (0)