feat: simplify developing against local notebooks #90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI & CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
release: | |
types: | |
- published | |
jobs: | |
dist: | |
name: Build package | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.13" | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build SDist & wheel | |
# Installs `build` before invoking pyproject-build | |
run: | | |
pip install build wheel | |
pyproject-build -ws | |
- name: Check metadata | |
run: | | |
pip install twine | |
twine check dist/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: dist/* | |
checks: | |
name: Check Python ${{ matrix.python-version }} | |
needs: [dist] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
- "3.13" | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build | |
path: dist | |
- name: Install build + test dependencies | |
run: pip install pytest dist/*.whl nbconvert ipykernel | |
- name: Test package | |
env: | |
# Set PYTHONPATH to include example | |
PYTHONPATH: "${{ github.workspace }}/src:${{ github.workspace }}/examples/src" | |
run: literary test | |
publish: | |
name: Publish to PyPI | |
needs: [dist, checks] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
environment: release | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 |