Add API doc. Use autosummary to generate docs for each module. #51
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: CI | |
on: | |
push: | |
pull_request: | |
workflow_call: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
id: setup | |
uses: ./.github/actions/setup | |
with: | |
setup-pre-commit: true | |
cache-python: true | |
install-options: --only lint --all-extras --sync | |
# for some reason poetry won't install the extras | |
- name: Install extras | |
run: poetry install --all-extras | |
# Run pre-commit hooks | |
- name: Run pre-commit hooks | |
run: pre-commit run --all-files | |
# Run mypy since it cannot check imports in pre-commit hooks | |
- name: Run linters | |
run: make lint | |
# Determine files changed by pre-commit hooks | |
- name: Determine files changed by pre-commit hooks | |
id: changed-files | |
if: ${{ failure() }} | |
run: echo files=$(git diff --name-only --diff-filter=AM) >> "$GITHUB_OUTPUT" | |
# Upload changed files on pre-commit error | |
- name: Upload changed files | |
if: ${{ failure() && steps.changed-files.outputs.files }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Files modified by pre-commit | |
path: ${{ steps.changed-files.outputs.files }} | |
generate_test_matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Extract extras from `pyproject.toml` | |
id: set-matrix | |
shell: python | |
run: | | |
import tomllib | |
import os | |
import json | |
with open('pyproject.toml', 'rb') as f: | |
manifest = tomllib.load(f) | |
yaml = { 'include' : [{ 'extras' : extra} for extra in [''] + list(manifest['tool']['poetry']['extras'])]} | |
yaml['include'].append({'extras': 'all'}) | |
out = json.dumps(yaml) | |
print(out) | |
with open(os.environ['GITHUB_OUTPUT'], 'a') as f: | |
f.write('matrix=' + out) | |
test: | |
name: test ${{ matrix.extras && 'with' || '' }} ${{ matrix.extras }} | |
runs-on: ubuntu-latest | |
needs: generate_test_matrix | |
strategy: | |
matrix: ${{ fromJson(needs.generate_test_matrix.outputs.matrix) }} | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
id: setup | |
uses: ./.github/actions/setup | |
with: | |
install-options: --only test --sync ${{ matrix.extras && ( matrix.extras == 'all' && '--all-extras' || format('--extras "{0}"', matrix.extras)) || '' }} | |
- name: Run Tests | |
run: make test | |
# Upload summary of test results | |
- uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4 | |
if: failure() || success() | |
with: | |
paths: report.xml | |
# Upload coverage to job summary | |
- name: Summarize coverage | |
uses: livewing/lcov-job-summary@28126fb20073f4624d0f8e2c6f4afbe1c0670cbb # v1.2.0 | |
if: matrix.extras == 'all' && (failure() || success()) | |
with: | |
lcov: coverage.lcov | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
id: setup | |
uses: ./.github/actions/setup | |
with: | |
cache-python: true | |
install-options: --only docs --sync | |
- name: Build Docs | |
run: make docs | |
# Upload build | |
- name: Upload build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Docs | |
path: docs/build |