Skip to content

Build

Build #41

Workflow file for this run

name: Build
on:
workflow_call:
workflow_dispatch:
pull_request: # to register the in-branch workflow
jobs:
verify:
name: Check code formatting and run tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install pre-commit
run: pip install pre-commit
- name: Check code formatting
run: pre-commit run --all-files
- name: Install test requirements
run: pip install pytest setuptools
- name: Run tests
run : python3 -m unittest discover test
define-python-version-matrix:
needs: verify
runs-on: ubuntu-latest
outputs:
python-version: ${{ steps.python-version.outputs.python-version }}
steps:
- name: Define supported Python versions
id: python-version
run: |
echo 'python-version=["3.10", "3.13"]' >> "$GITHUB_OUTPUT"
build:
needs: define-python-version-matrix
runs-on: [ubuntu-latest]
strategy:
matrix:
python-version: ${{ fromJSON(needs.define-python-version-matrix.outputs.python-version) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install build
- run: python -m build
pip-install:
needs: define-python-version-matrix
runs-on: [ubuntu-latest]
strategy:
matrix:
python-version: ${{ fromJSON(needs.define-python-version-matrix.outputs.python-version) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install build
- run: pip install .
pip-editable-install:
needs: define-python-version-matrix
runs-on: [ubuntu-latest]
strategy:
matrix:
python-version: ${{ fromJSON(needs.define-python-version-matrix.outputs.python-version) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install build
- run: pip install -e .
build-docs:
needs: verify
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: install cflib
run: pip install .
- name: install pdoc3
run: pip install pdoc3
- name: build docs
run: pdoc3 docs/api/template