Add Python docs #43
Workflow file for this run
This file contains 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: Python π | |
on: | |
push: | |
branches: [main] | |
paths: | |
- "openapi.yaml" | |
- "python/remotebmi/**" | |
- "python/tests/**" | |
- "python/pyproject.toml" | |
- .github/workflows/python.yml | |
pull_request: | |
paths: | |
- "openapi.yaml" | |
- "python/remotebmi/**" | |
- "python/tests/**" | |
- "python/pyproject.toml" | |
- .github/workflows/python.yml | |
types: [opened, synchronize, reopened] | |
workflow_call: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write # This is required for codecov | |
defaults: | |
run: | |
working-directory: python | |
jobs: | |
setup-python: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
cache: "pip" | |
lint-format: | |
name: formatting and type checking ποΈ | |
runs-on: ubuntu-latest | |
needs: setup-python | |
steps: | |
- name: Install ruff | |
run: pip install ruff | |
- name: Run ruff check | |
run: ruff check | |
- name: Run ruff format | |
run: ruff format --check | |
typing: | |
runs-on: ubuntu-latest | |
needs: setup-python | |
steps: | |
- name: Install remotebmi | |
run: pip install .[dev] # dev too so tests can be type checked | |
- name: Install mypy | |
run: pip install mypy numpy | |
- name: Run mypy | |
run: mypy . | |
test: | |
name: run test suite π | |
runs-on: ${{ matrix.os }} | |
needs: setup-python | |
strategy: | |
fail-fast: true | |
matrix: | |
os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] | |
python-version: ['3.10', '3.13'] | |
steps: | |
- name: Install dependencies | |
run: pip install -e .[dev] | |
- name: Run tests | |
run: pytest | |
cov: | |
name: compute and upload coverage | |
runs-on: ubuntu-latest | |
needs: setup-python | |
steps: | |
- name: Install dependencies | |
run: pip install -e .[dev] | |
- name: Run tests | |
run: pytest --cov --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: coverage.xml | |
use_oidc: true | |
build: | |
name: build the package π οΈ | |
runs-on: ubuntu-latest | |
needs: setup-python | |
steps: | |
- name: Install build | |
run: pip install build | |
- name: Build package | |
run: python3 -m build | |
docs: | |
name: build docs π | |
runs-on: ubuntu-latest | |
needs: setup-python | |
steps: | |
- name: Install docs requirements | |
run: pip install -r docs/requirements.txt | |
- name: Build docs | |
run: make -C docs/ html |