Skip to content

Enable execution for notebooks. Updated minimal example. #18

Enable execution for notebooks. Updated minimal example.

Enable execution for notebooks. Updated minimal example. #18

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Testing
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- created
jobs:
lint-ruff:
name: "Lint (ruff)"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.11"
deps:
- dev
- dev,docs,datatests
lib-pydantic:
- "2.0"
- "2.5"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Package with dependencies ${{ matrix.deps }}
run: |
pip install "pydantic~=${{ matrix.lib-pydantic }}"
pip install -e ".[${{ matrix.deps }}]"
- name: Lint with ruff
run: ruff check .
lint-mypy:
name: "Type Check (mypy)"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.11"
deps:
- dev
- dev,docs,datatests
lib-pydantic:
- "2.0"
- "2.5"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Package with dependencies ${{ matrix.deps }}
run: |
pip install "pydantic~=${{ matrix.lib-pydantic }}"
pip install -e ".[${{ matrix.deps }}]"
- name: Lint with mypy
run: mypy
test-unit:
name: "Unit Testing (pytest)"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.11"
deps:
- dev
- dev,docs,datatests
lib-pydantic:
- "2.0"
- "2.5"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Package with dependencies ${{ matrix.deps }}
run: |
pip install "pydantic~=${{ matrix.lib-pydantic }}"
pip install -e ".[${{ matrix.deps }}]"
- name: Test with pytest
run: pytest
test-docs:
name: "Test Docs Build (mkdocs)"
# NOTE: We don't actually upload these docs - this is done automatically by ReadTheDocs
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
deps:
- dev,docs,datatests
lib-pydantic:
- "2.5"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Package with dependencies ${{ matrix.deps }}
run: |
pip install "pydantic~=${{ matrix.lib-pydantic }}"
pip install -e ".[${{ matrix.deps }}]"
- name: Build with mkdocs
env:
JUPYTER_PLATFORM_DIRS: 1 # suppress warning for Jupyter build in mkdocs
run: mkdocs build
publish-testpypi:
name: "Publish to TestPyPI"
needs:
- "lint-ruff"
- "lint-mypy"
- "test-unit"
- "test-docs"
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
runs-on: ubuntu-latest
environment: testpypi
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
deps:
- dev,docs
lib-pydantic:
- "2.5"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Package with dependencies ${{ matrix.deps }}
run: |
pip install "pydantic~=${{ matrix.lib-pydantic }}"
pip install -e ".[${{ matrix.deps }}]"
- name: Build
run: python setup.py sdist bdist_wheel
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
publish-pypi:
name: "Publish to PyPI"
needs:
- "publish-testpypi" # ensure publishing is successful on TestPyPI first
# - "lint-ruff"
# - "lint-mypy"
# - "test-unit"
# - "test-docs"
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
deps:
- dev,docs
lib-pydantic:
- "2.5"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Package with dependencies ${{ matrix.deps }}
run: |
pip install "pydantic~=${{ matrix.lib-pydantic }}"
pip install -e ".[${{ matrix.deps }}]"
- name: Build
run: python setup.py sdist bdist_wheel
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1