Skip to content

Commit

Permalink
Split the test and doc building into separate Actions.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
LTLA committed Sep 20, 2023
1 parent ce35486 commit fd792c3
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 20 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build documentation

on:
push:
branches:
- master

jobs:
test:
name: Build docs
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
cache: 'pip'

- name: Set up ccache
uses: hendrikmuhs/[email protected]

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools
DEPENDENCIES=$(python -c 'from setuptools.config.setupcfg import read_configuration as c; a = c("setup.cfg"); print(" ".join(a["options"]["install_requires"][1:]))')
pip install ${DEPENDENCIES}
pip install sphinx myst-parser[linkify] furo
# Note that doc building requires the inplace shared library.
- name: Build docs
run: |
CC="ccache gcc" python setup.py build_ext --inplace
sphinx-build --color -b html -d docs/doctrees docs docs/_build/html
touch ./docs/_build/html/.nojekyll
- name: GH Pages Deployment
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./docs/_build/html
clean: true # Automatically remove deleted files from the deploy branch
37 changes: 17 additions & 20 deletions .github/workflows/pypi-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,34 @@ jobs:
with:
submodules: true

- name: "Install dependencies"
run: |
sudo apt-get install zlib1g-dev
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
cache: 'pip'

- name: Install dependencies
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest tox numpy mattress
python -m pip install --upgrade pip setuptools
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:]))')
pip install ${DEPENDENCIES}
- name: Test with tox
run: tox

- name: Build docs
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
run: |
tox -e docs
touch ./docs/_build/html/.nojekyll
pip install tox
tox
- name: GH Pages Deployment
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./docs/_build/html
clean: true # Automatically remove deleted files from the deploy branch
# In a PR, we don't need the full clean test.
- name: Set up ccache
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags')
uses: hendrikmuhs/[email protected]

- name: Quickly build and test
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags')
run: |
CC="ccache gcc" python setup.py install
pytest
build_wheels:
name: Build wheels on ${{ matrix.os }}
Expand Down

0 comments on commit fd792c3

Please sign in to comment.