Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# Problem and change

Describe the concrete problem and the resulting behavior. Link the issue and
ExecPlan when applicable. List any dependency on another PR.
Describe the problem and the resulting behavior. Link the issue, and any PR this
depends on.

## Validation

Give the relevant commands and results, including positive/negative examples and
checker inference when the public API changes. Distinguish local validation from
hosted checks, and explain skips or remaining limitations.
List the commands you ran and their results. Explain skips or remaining
limitations.

## Documentation and compatibility
## Documentation

Identify updated guides, examples and changelog entries, or explain why none are
needed. Note public-contract, dependency or artifact changes. Merge approval is
separate from release or deployment approval.
List updated guides, examples and changelog entries, or say why none are needed.
158 changes: 156 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches: [main]
pull_request:
schedule:
# Weekly, so new beartype prereleases are tested even without bearshape pushes.
- cron: "0 4 * * 1"
workflow_dispatch:

permissions:
Expand All @@ -13,6 +16,157 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

env:
UV_TORCH_BACKEND: cpu

jobs:
validate:
uses: ./.github/workflows/validate.yml
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.0
with:
version: "0.13.0"
- run: uv run --locked --only-group dev prek run -a
- run: uv run --locked --only-group dev prek run actionlint -a --stage manual

test:
name: test (${{ matrix.os }}, ${{ matrix.python }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.11", "3.12", "3.13", "3.14"]
include:
- { os: macos-latest, python: "3.11" }
- { os: macos-latest, python: "3.14" }
- { os: windows-latest, python: "3.11" }
- { os: windows-latest, python: "3.14" }
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.0
with:
version: "0.13.0"
python-version: ${{ matrix.python }}
enable-cache: true
- run: uv sync --locked --no-default-groups --group optional --group test
- run: uv run --no-sync python tools/validate_runtime.py cpu
- run: >-
uv run --no-sync pytest tests/ --ignore=tests/test_typecheck.py -n 4
--cov=bearshape --cov-branch --cov-report=term-missing:skip-covered
--cov-fail-under=90

beartype-prerelease:
# Plum-style canary for beartype release candidates (#62). It installs the
# newest beartype, prerelease or not, over the locked environment.
name: test (beartype prerelease, 3.14)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.0
with:
version: "0.13.0"
python-version: "3.14"
enable-cache: true
- run: uv sync --locked --no-default-groups --group optional --group test
- run: uv pip install --upgrade --pre beartype
- run: uv run --no-sync python -c "import beartype; print('beartype', beartype.__version__)"
- run: uv run --no-sync pytest tests/ --ignore=tests/test_typecheck.py -n 4

checkers:
name: checkers (${{ matrix.python }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.0
with:
version: "0.13.0"
python-version: ${{ matrix.python }}
enable-cache: true
- run: uv sync --locked --no-default-groups --group optional --group static --group test
- run: uv run --no-sync pytest tests/test_typecheck.py -v

compatibility:
name: compatibility (${{ matrix.environment }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
environment:
- py311-bt0231-numpy22
- py311-bt0231-jax05
- py311-bt0231-torch26
- py311-bt0231-optree014
- py313-bt0231-numpy24
- py313-bt0231-jax09
- py313-bt0231-torch210
- py313-bt0231-optree019
- py313-bt0231-type-pyright1408
- py313-bt0231-type-mypy119
- py313-bt0231-type-ty
- py313-bt0231-type-pyrefly
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.0
with:
version: "0.13.0"
enable-cache: true
- run: uv run --locked --only-group test tox run -e "${{ matrix.environment }}"

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.0
with:
version: "0.13.0"
python-version: "3.14"
- run: uv run --locked --only-group docs zensical build --clean
- run: uv run --locked --only-group docs python tools/check_docs.py
- run: uv sync --locked --no-default-groups --group optional --group notebook
- run: uv run --no-sync python tools/check_notebook.py

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.0
with:
version: "0.13.0"
- run: uv build
- name: Smoke-test the wheel without optional backends
run: |
uv venv --python 3.11 .smoke
uv pip install --python .smoke/bin/python dist/*.whl
.smoke/bin/python -I -c "import bearshape, sys; assert 'numpy' not in sys.modules; print('bearshape', bearshape.__version__)"

# The one status check to require on main. It succeeds only when every job
# above succeeded, so branch rules never need to list matrix job names.
check:
if: always()
needs:
[quality, test, beartype-prerelease, checkers, compatibility, docs, build]
runs-on: ubuntu-latest
steps:
- name: Require every CI job to succeed
env:
RESULTS: ${{ toJSON(needs) }}
run: |
python - <<'PY'
import json
import os
results = json.loads(os.environ["RESULTS"])
failed = {name: job["result"] for name, job in results.items() if job["result"] != "success"}
if failed:
raise SystemExit(f"CI jobs did not succeed: {failed}")
print("All CI jobs succeeded")
PY
14 changes: 8 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Validate or deploy docs

on:
push:
branches: [main, docs]
branches: [main]
tags: ["v**"]
workflow_dispatch:

permissions:
Expand All @@ -18,18 +19,19 @@ jobs:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.0
with:
version: "0.13.0"
- run: uv run --locked --only-group docs zensical build --clean
- run: uv run --locked --only-group docs python tools/check_docs.py
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
- uses: actions/upload-pages-artifact@v5
with:
path: site

deploy:
if: github.event_name == 'workflow_dispatch'
# Deploy on release tags and manual runs; pushes to main only build.
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v')
needs: build
permissions:
pages: write
Expand All @@ -42,4 +44,4 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
uses: actions/deploy-pages@v5
65 changes: 0 additions & 65 deletions .github/workflows/nightly.yml

This file was deleted.

Loading
Loading