1
1
name : continuous-integration
2
2
3
+ # README
4
+ # ======
5
+ #
6
+ # All the jobs are defined with `matrix` for OS and Python version, even if we
7
+ # only run them on one combination of OS/Python. The reason for this is you get
8
+ # a nice side-effect that the OS and Python version of the job are listed in
9
+ # parentheses next to the job name in the Actions UI.
10
+
3
11
# This prevents workflows from being run twice on PRs
4
12
# ref: https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662
5
13
on :
@@ -14,86 +22,123 @@ env:
14
22
15
23
jobs :
16
24
lint :
17
- runs-on : ubuntu-latest
25
+ strategy :
26
+ matrix :
27
+ os : [ubuntu-latest]
28
+ python-version : ["3.11"]
29
+ runs-on : ${{ matrix.os }}
18
30
steps :
19
31
- uses : actions/checkout@v3
20
- - uses : actions/setup-python@v4
32
+ - name : Setup Python
33
+ uses : actions/setup-python@v4
21
34
with :
22
- python-version : " 3.9 "
35
+ python-version : ${{ matrix.python-version }}
23
36
cache : " pip"
24
37
cache-dependency-path : " pyproject.toml"
25
38
-
uses :
pre-commit/[email protected]
26
39
27
- tests :
28
- runs-on : ${{ matrix.os }}
40
+ # run our test suite on various combinations of OS / Python / Sphinx version
41
+ run-pytest :
29
42
strategy :
30
43
fail-fast : false
31
44
matrix :
32
45
os : [ubuntu-latest]
33
- python-version : ["3.7", "3. 8", "3.9", "3.10", "3.11-dev "]
46
+ python-version : ["3.8", "3.9", "3.10", "3.11"]
34
47
include :
48
+ # legacy test
49
+ - os : ubuntu-latest
50
+ python-version : " 3.7"
51
+ sphinx-version : " 4.2"
52
+ # macos test
35
53
- os : macos-latest
36
- python-version : " 3.9"
54
+ python-version : " 3.11"
55
+ # windows test
37
56
- os : windows-latest
38
- python-version : " 3.9 "
39
-
57
+ python-version : " 3.11 "
58
+ runs-on : ${{ matrix.os }}
40
59
steps :
41
60
- uses : actions/checkout@v3
42
- - name : Set up Python ${{ matrix.python-version }}
61
+ - name : Setup Python
43
62
uses : actions/setup-python@v4
44
63
with :
45
64
python-version : ${{ matrix.python-version }}
46
65
cache : " pip"
47
66
cache-dependency-path : " pyproject.toml"
48
-
49
67
- name : Install dependencies
68
+ # if Sphinx version not specified in matrix, the constraints in the
69
+ # pyproject.toml file determine Sphinx version
70
+ if : false == matrix.sphinx-version
71
+ shell : bash
72
+ # setting shell to BASH and using PYTHONUTF8 env var makes the editable
73
+ # install work on Windows even though there are emoji in our README
50
74
run : |
75
+ export PYTHONUTF8=1
51
76
python -m pip install --upgrade pip wheel setuptools
52
- python -m pip install -e .[coverage ]
53
- python -m pip list
54
-
55
- - name : Test Sphinx==4.2
56
- if : matrix.python -version == '3.7'
77
+ python -m pip install -e .[test ]
78
+ - name : Install dependencies (legacy Sphinx)
79
+ # here we override the pyproject.toml constraints to get a specific
80
+ # Sphinx version.
81
+ if : matrix.sphinx -version
57
82
run : |
58
- python -m pip install sphinx==4.2
59
- python -m pip list
83
+ python -m pip install --upgrade pip wheel setuptools
84
+ python -m pip install -e .[test] sphinx==${{ matrix.sphinx-version }}
85
+ - name : Show installed versions
86
+ run : python -m pip list
87
+ - name : Run tests
88
+ run : pytest --color=yes --cov pydata_sphinx_theme --cov-branch --cov-report term-missing:skip-covered --cov-fail-under ${{ env.COVERAGE_THRESHOLD }}
60
89
61
- - name : Build docs to store
90
+ # Build our site on the 3 major OSes and check for Sphinx warnings
91
+ build-site :
92
+ strategy :
93
+ fail-fast : false
94
+ matrix :
95
+ os : [ubuntu-latest, macos-latest, windows-latest]
96
+ python-version : ["3.11"]
97
+ runs-on : ${{ matrix.os }}
98
+ steps :
99
+ - uses : actions/checkout@v3
100
+ - name : Setup Python
101
+ uses : actions/setup-python@v4
102
+ with :
103
+ python-version : ${{ matrix.python-version }}
104
+ cache : " pip"
105
+ cache-dependency-path : " pyproject.toml"
106
+ - name : Install dependencies
107
+ shell : bash
108
+ # setting shell to BASH and using PYTHONUTF8 env var makes the editable
109
+ # install work on Windows even though there are emoji in our README
110
+ run : |
111
+ export PYTHONUTF8=1
112
+ python -m pip install --upgrade pip wheel setuptools
113
+ python -m pip install -e .[doc]
114
+ - name : Show installed versions
115
+ run : python -m pip list
116
+ - name : Build docs
62
117
run : sphinx-build -b html docs/ docs/_build/html --keep-going -w warnings.txt
63
-
64
- - name : Check that there are no unexpected Sphinx warnings
65
- if : matrix.python-version == '3.9'
118
+ - name : Check for unexpected Sphinx warnings
66
119
run : python tests/check_warnings.py
67
120
68
- - name : Run the tests
69
- run : pytest --color=yes --cov pydata_sphinx_theme --cov-branch --cov-report term-missing:skip-covered --cov-fail-under ${{ env.COVERAGE_THRESHOLD }}
70
-
71
- - name : Upload coverage
72
- if : ${{ always() }}
73
- run : codecov
74
-
75
121
# Run local Lighthouse audit against built site
76
122
audit :
77
- runs-on : ubuntu-latest
78
123
strategy :
79
124
matrix :
80
- python-version : ["3.8"]
81
-
125
+ os : [ubuntu-latest]
126
+ python-version : ["3.11"]
127
+ runs-on : ${{ matrix.os }}
82
128
steps :
83
129
- uses : actions/checkout@v3
84
-
85
- - name : Set up Python ${{ matrix.python-version }}
130
+ - name : Setup Python
86
131
uses : actions/setup-python@v4
87
132
with :
88
133
python-version : ${{ matrix.python-version }}
89
134
cache : " pip"
90
135
cache-dependency-path : " pyproject.toml"
91
-
92
136
- name : Install dependencies
93
137
run : |
94
138
python -m pip install --upgrade pip wheel setuptools
95
- python -m pip install -e .[coverage]
96
-
139
+ python -m pip install -e .[doc]
140
+ - name : Show installed versions
141
+ run : python -m pip list
97
142
# We want to run the audit on a simplified documentation build so that
98
143
# the audit results aren't affected by non-theme things like extensions.
99
144
# Here we copy over just the kitchen sink into an empty docs site with
@@ -107,7 +152,6 @@ jobs:
107
152
echo 'html_theme = "pydata_sphinx_theme"' > audit/site/conf.py
108
153
echo '.. toctree::\n :glob:\n\n *' >> audit/site/index.rst
109
154
sphinx-build audit/site audit/_build
110
-
111
155
# The lighthouse audit runs directly on the HTML files, no serving needed
112
156
- name : Audit with Lighthouse
113
157
uses : treosh/lighthouse-ci-action@v9
@@ -119,30 +163,28 @@ jobs:
119
163
120
164
# Generate a profile of the code and upload as an artifact
121
165
profile :
122
- runs-on : ubuntu-latest
123
166
strategy :
124
167
matrix :
125
- python-version : ["3.8"]
126
-
168
+ os : [ubuntu-latest]
169
+ python-version : ["3.11"]
170
+ runs-on : ${{ matrix.os }}
127
171
steps :
128
172
- uses : actions/checkout@v3
129
-
130
- - name : Set up Python ${{ matrix.python-version }}
173
+ - name : Setup Python
131
174
uses : actions/setup-python@v4
132
175
with :
133
176
python-version : ${{ matrix.python-version }}
134
177
cache : " pip"
135
178
cache-dependency-path : " pyproject.toml"
136
-
137
179
- name : Install dependencies
138
180
run : |
139
181
python -m pip install --upgrade pip wheel setuptools nox
140
-
182
+ python -m pip install -e .[test]
183
+ - name : Show installed versions
184
+ run : python -m pip list
141
185
- name : Generate a profile
142
- run : |
143
- nox -s profile
186
+ run : nox -s profile
144
187
continue-on-error : true
145
-
146
188
- uses : actions/upload-artifact@v3
147
189
with :
148
190
name : profile-results
0 commit comments