-
Notifications
You must be signed in to change notification settings - Fork 201
132 lines (117 loc) · 4.28 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: continuous-integration
on:
push:
branches: [master]
tags:
- 'v*'
pull_request:
workflow_call:
env:
PY_COLORS: 1
FORCE_COLOR: True
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- uses: pre-commit/action@v3.0.1
tests:
continue-on-error: ${{ matrix.experimental || false }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12.*", "3.13"]
# Only test the latest major release of Sphinx because otherwise we need to
# keep multiple versions of regression tests on file and this creates lots of
# noise in the tests.
sphinx: ["~=6.0","~=7.0", "~=8.0"]
include:
- os: windows-latest
# Python 3.12 is broken on windows builds until the following PR is released:
# /~https://github.com/pradyunsg/sphinx-theme-builder/pull/47
python-version: 3.11
# Windows pulling in dependencies fails
experimental: true
- os: macos-latest
python-version: 3.x
# Sphinx <8 is 3.9+
- os: ubuntu-latest
python-version: "3.9"
sphinx: "~=7.0"
- os: ubuntu-latest
python-version: "3.9"
sphinx: "~=6.0"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies with Sphinx ${{ matrix.sphinx }}
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade "sphinx${{matrix.sphinx}}" -e .[test] --pre
- name: Run pytest
run: >
pytest --durations=10 --cov=sphinx_book_theme --cov-report=xml --cov-report=term-missing
# Only upload to codecov on pull requests so that we don't trigger rate limit blocks
# Disabled for now with false &&
- name: Upload to Codecov
if: false && matrix.os == 'ubuntu-latest' && matrix.python-version == 3.9 && matrix.sphinx == '~=7.0' && github.repository == 'executablebooks/sphinx-book-theme' && github.event_name == 'pull_request'
uses: codecov/codecov-action@v5.0.7
with:
name: ebp-sbt-pytests-py3.7
flags: pytests
file: ./coverage.xml
fail_ci_if_error: true
# Build the docs and fail if an *unexpected* warning occurs.
docs-audit:
runs-on: ubuntu-latest
name: Build and Audit Documentation
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: "pip"
cache-dependency-path: "pyproject.toml"
- name: Install fonts
# This is required until sphinx-opengraph fixes their fallback
run: sudo apt-get install -y fonts-roboto
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[doc]
# Only check for broken links on pull requests so that we don't block releases
- name: Check for broken links
if: github.event_name == 'pull_request'
run: >
sphinx-build -b linkcheck docs docs/_build/linkcheck
- name: Build documentation to audit
run: >
sphinx-build -b html docs docs/_build/html -w warnings.txt
- name: Check that there are no unexpected warnings
shell: python
run: |
from pathlib import Path
import re
text = Path("./warnings.txt").read_text().strip()
expected_warning_patterns = [r"kitchen\-sink", r"urllib/parse\.py", r"Glyph 10024 .*? missing from current font"]
print("\n=== Sphinx Warnings ===\n\n" + text) # Print just for reference so we can look at the logs
unexpected = [l for l in text.splitlines() if not any(re.search(p, l) for p in expected_warning_patterns)]
assert len(unexpected) == 0, unexpected
- name: Audit with Lighthouse
uses: treosh/lighthouse-ci-action@12.1.0
with:
configPath: ".github/workflows/lighthouserc.json"
temporaryPublicStorage: true
uploadArtifacts: true
runs: 5