Skip to content

Commit fd792c3

Browse files
committed
Split the test and doc building into separate Actions.
This allows us to propagate docfixes more quickly. We also add ccache for faster doc builds and PR tests where we don't need the full tox checks from a clean slate.
1 parent ce35486 commit fd792c3

File tree

2 files changed

+64
-20
lines changed

2 files changed

+64
-20
lines changed

.github/workflows/build-docs.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
test:
10+
name: Build docs
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
submodules: true
17+
18+
- name: Set up Python 3.9
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: 3.9
22+
cache: 'pip'
23+
24+
- name: Set up ccache
25+
uses: hendrikmuhs/[email protected]
26+
27+
- name: Install Python dependencies
28+
run: |
29+
python -m pip install --upgrade pip setuptools
30+
DEPENDENCIES=$(python -c 'from setuptools.config.setupcfg import read_configuration as c; a = c("setup.cfg"); print(" ".join(a["options"]["install_requires"][1:]))')
31+
pip install ${DEPENDENCIES}
32+
pip install sphinx myst-parser[linkify] furo
33+
34+
# Note that doc building requires the inplace shared library.
35+
- name: Build docs
36+
run: |
37+
CC="ccache gcc" python setup.py build_ext --inplace
38+
sphinx-build --color -b html -d docs/doctrees docs docs/_build/html
39+
touch ./docs/_build/html/.nojekyll
40+
41+
- name: GH Pages Deployment
42+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
43+
uses: JamesIves/[email protected]
44+
with:
45+
branch: gh-pages # The branch the action should deploy to.
46+
folder: ./docs/_build/html
47+
clean: true # Automatically remove deleted files from the deploy branch

.github/workflows/pypi-test.yml

+17-20
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,34 @@ jobs:
2121
with:
2222
submodules: true
2323

24-
- name: "Install dependencies"
25-
run: |
26-
sudo apt-get install zlib1g-dev
27-
2824
- name: Set up Python 3.9
2925
uses: actions/setup-python@v2
3026
with:
3127
python-version: 3.9
3228
cache: 'pip'
3329

34-
- name: Install dependencies
30+
- name: Install python dependencies
3531
run: |
36-
python -m pip install --upgrade pip
37-
pip install pytest tox numpy mattress
32+
python -m pip install --upgrade pip setuptools
33+
DEPENDENCIES=$(python -c 'from setuptools.config.setupcfg import read_configuration as c; a = c("setup.cfg"); print(" ".join(a["options"]["install_requires"][1:] + a["options"]["extras_require"]["testing"][1:]))')
34+
pip install ${DEPENDENCIES}
3835
3936
- name: Test with tox
40-
run: tox
41-
42-
- name: Build docs
43-
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
37+
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
4438
run: |
45-
tox -e docs
46-
touch ./docs/_build/html/.nojekyll
39+
pip install tox
40+
tox
4741
48-
- name: GH Pages Deployment
49-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
50-
uses: JamesIves/[email protected]
51-
with:
52-
branch: gh-pages # The branch the action should deploy to.
53-
folder: ./docs/_build/html
54-
clean: true # Automatically remove deleted files from the deploy branch
42+
# In a PR, we don't need the full clean test.
43+
- name: Set up ccache
44+
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags')
45+
uses: hendrikmuhs/[email protected]
46+
47+
- name: Quickly build and test
48+
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags')
49+
run: |
50+
CC="ccache gcc" python setup.py install
51+
pytest
5552
5653
build_wheels:
5754
name: Build wheels on ${{ matrix.os }}

0 commit comments

Comments
 (0)