Skip to content
Merged
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
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
pull_request:
branches: [main]
push:
branches: [main]

# Least-privilege: the workflow only needs to read code (checkout +
# submodule). No writes anywhere.
permissions:
contents: read

# Cancel in-flight runs on the same ref when a new push lands.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
Comment thread
chris-colinsky marked this conversation as resolved.
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Conformance fixtures live in the openarmature-spec submodule.
submodules: recursive

Comment thread
chris-colinsky marked this conversation as resolved.
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true

# No explicit `uv python install` — `uv sync` auto-provisions the
# interpreter pinned in `.python-version`, so CI tests the same
# version developers run locally.

- name: Sync deps
run: uv sync --frozen

- name: Lint (ruff check)
run: uv run ruff check .

- name: Format check (ruff format --check)
run: uv run ruff format --check .

- name: Type check (pyright)
run: uv run pyright src/ tests/

- name: Run tests (pytest)
run: uv run pytest -q
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
rev: v0.15.11
hooks:
- id: ruff
args: [--fix]
Expand Down
3 changes: 2 additions & 1 deletion tests/conformance/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Annotated, Any, cast

from pydantic import Field, create_model

from openarmature.graph import (
END,
CompiledGraph,
Expand All @@ -32,7 +34,6 @@
)
from openarmature.graph.events import NodeEvent
from openarmature.graph.observer import Observer
from pydantic import Field, create_model

if TYPE_CHECKING:
from openarmature.graph.observer import _InvocationContext
Expand Down
13 changes: 7 additions & 6 deletions tests/conformance/test_conformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import pytest
import yaml

from openarmature.graph import (
CompileError,
NodeException,
Expand Down Expand Up @@ -139,15 +140,15 @@ async def test_runtime_fixture(fixture_path: Path) -> None:
for name, expected_events in expected["observer_events"].items():
actual = observer_fixtures[name].events
normalized = [normalize_expected_event(ev) for ev in expected_events]
assert (
actual == normalized
), f"observer events mismatch for {name!r}: actual={actual}, expected={normalized}"
assert actual == normalized, (
f"observer events mismatch for {name!r}: actual={actual}, expected={normalized}"
)

if "delivery_order" in expected:
expected_delivery = [(d["observer"], d["step"]) for d in expected["delivery_order"]]
assert (
delivery == expected_delivery
), f"delivery_order mismatch: actual={delivery}, expected={expected_delivery}"
assert delivery == expected_delivery, (
f"delivery_order mismatch: actual={delivery}, expected={expected_delivery}"
)


# ---------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_compile_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Any

import pytest

from openarmature.graph import (
END,
DanglingEdge,
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_generics.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

from typing import Annotated, Any, assert_type

from pydantic import Field

from openarmature.graph import (
END,
CompiledGraph,
Expand All @@ -20,7 +22,6 @@
State,
append,
)
from pydantic import Field


class ParentS(State):
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_projection.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"""Projection strategy unit coverage: FieldNameMatching + ExplicitMapping."""

import pytest
from pydantic import Field

from openarmature.graph import (
ExplicitMapping,
FieldNameMatching,
MappingReferencesUndeclaredField,
State,
)
from pydantic import Field


class Parent(State):
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_runtime_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from typing import Annotated, Any

import pytest
from pydantic import Field

from openarmature.graph import (
END,
EdgeException,
Expand All @@ -20,7 +22,6 @@
StateValidationError,
append,
)
from pydantic import Field


class S(State):
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_state_and_reducers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
from typing import Annotated

import pytest
from pydantic import Field, ValidationError

from openarmature.graph import END, State, append, last_write_wins, merge
from openarmature.graph.state import field_reducers, resolve_reducer
from pydantic import Field, ValidationError


class S(State):
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_subgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

from typing import Annotated, Any

from pydantic import Field

from openarmature.graph import (
END,
FieldNameMatching,
Expand All @@ -16,7 +18,6 @@
SubgraphNode,
append,
)
from pydantic import Field


class Inner(State):
Expand Down
Loading