mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-10-26 21:26:39 +00:00
* fix(examples): keep the extension example's tests passing as the contract grows The README's package-test commands failed one test on main: isinstance(registry, ExtensionRegistry) is False because the test's FakeRegistry does not implement knowledge_provider(), which extension-api 0.2.7 added to the runtime-checkable protocol. The same assertion broke earlier when plugin() was added. Nothing in CI runs these tests, so each addition to the contract broke them silently. FakeRegistry now records knowledge_provider() and plugin() calls, and the test asserts the example registers neither, as its README says. Extension Package Check, which already runs when the contract changes, now installs each bundled example that has a tests/ directory next to the checkout's extension-api and runs the README's pytest and ruff commands. A backend test pins that step and checks that every tested example declares those tools in its dev extra. The example README and the extensions guide now count nine contribution kinds, including knowledge providers. * docs(changelog): reference #7364 for the extension example test fix * test(extensions): name the missing package-test step in the wiring pin --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
75 lines
2.5 KiB
YAML
75 lines
2.5 KiB
YAML
name: Extension Package Check
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
|
paths:
|
|
- 'examples/deerflow-extension-*/**'
|
|
- 'scripts/check_extension.py'
|
|
- 'backend/packages/extension-api/**'
|
|
- 'backend/packages/harness/deerflow/extensions/**'
|
|
- 'backend/pyproject.toml'
|
|
- 'backend/uv.lock'
|
|
- '.github/workflows/extension-package-check.yml'
|
|
push:
|
|
branches: [main, "*-dev"]
|
|
paths:
|
|
- 'examples/deerflow-extension-*/**'
|
|
- 'scripts/check_extension.py'
|
|
- 'backend/packages/extension-api/**'
|
|
- 'backend/packages/harness/deerflow/extensions/**'
|
|
- 'backend/pyproject.toml'
|
|
- 'backend/uv.lock'
|
|
- '.github/workflows/extension-package-check.yml'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: extension-package-check-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
check-packages:
|
|
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.12'
|
|
- uses: astral-sh/setup-uv@v7
|
|
with:
|
|
version: '0.11.1'
|
|
- name: Install host dependencies
|
|
working-directory: backend
|
|
run: uv sync --locked
|
|
- name: Build and check all bundled extension packages
|
|
shell: bash
|
|
run: |
|
|
for package in examples/deerflow-extension-*/; do
|
|
echo "::group::Check ${package%/}"
|
|
uv run --project backend --no-sync python scripts/check_extension.py "$package"
|
|
echo "::endgroup::"
|
|
done
|
|
# Each package's own tests run in an isolated environment against this
|
|
# checkout's extension-api, so a contract change that breaks them fails here.
|
|
- name: Test bundled extension packages that ship tests
|
|
shell: bash
|
|
run: |
|
|
for package in examples/deerflow-extension-*/; do
|
|
[ -d "${package}tests" ] || continue
|
|
echo "::group::Test ${package%/}"
|
|
(
|
|
cd "$package"
|
|
uv venv --python 3.12
|
|
uv pip install -e ../../backend/packages/extension-api
|
|
uv pip install -e ".[dev]"
|
|
uv run --no-project pytest -q
|
|
uv run --no-project ruff check .
|
|
uv run --no-project ruff format --check .
|
|
)
|
|
echo "::endgroup::"
|
|
done
|