Skip to content

Deduplicate install+test step between ci.yml and publish.yml #8

@ryanmcmillan

Description

@ryanmcmillan

Problem

`.github/workflows/ci.yml` (PR gate) and `.github/workflows/publish.yml` (tag gate) each declare their own install step with their own dep list:

ci.yml:27-29
```yaml

  • name: Install dependencies
    run: |
    python -m pip install --upgrade pip
    pip install -e ".[async]"
    pip install pytest pytest-asyncio
    ```

publish.yml:25-30
```yaml

  • name: Install and test
    run: |
    python -m pip install --upgrade pip
    pip install -e ".[async]"
    pip install pytest pytest-asyncio
    pytest tests/ -v
    ```

When deps change, both files have to update in lockstep. Drift between them is exactly the kind of bug that catches you on release day because the PR gate is green but the tag gate fails.

Evidence this isn't theoretical

Tonight, publishing `delega==0.2.1` (PR #7) failed on the first `v0.2.1` tag push because:

  1. The PR added `pytest-asyncio` to ci.yml but not publish.yml.
  2. PR CI passed (used the updated ci.yml).
  3. Merge landed, `v0.2.1` tag pushed, publish.yml ran — it still used the pre-PR install list without `pytest-asyncio`.
  4. All 11 new async tests failed with "async def functions are not natively supported. You need to install a suitable plugin...". Publish failed before reaching PyPI.
  5. Fixed with commit `a71b699` (cherry-picked to main) adding `pytest-asyncio` to publish.yml, then deleting and re-pushing the `v0.2.1` tag.

Failed run: https://github.com/delega-dev/delega-python/actions/runs/24416588206

No bad artifact reached PyPI — the install-and-test step runs before build/upload — but the 15-minute recovery dance shouldn't have been necessary.

Proposed fixes

Option A — Reusable workflow (recommended)

Extract the shared install+test into `.github/workflows/test.yml` with `on: workflow_call`, then both ci.yml and publish.yml use `uses: ./.github/workflows/test.yml`. Single source of truth for install deps.

Option B — Drop the duplicate test step in publish.yml

Remove the install-and-test block from publish.yml entirely. Rely on the fact that the merge commit passed CI on the PR. Smaller change but loses the belt-and-suspenders "never publish if tests broke since merge" guarantee (usually overkill for a tag-gated release).

Recommendation

Option A. ~15 min of work, no safety tradeoff, eliminates the class of drift bug.

Context

Discovered during delega==0.2.1 release (part of the delega-mcp 1.2.0 follow-up work). Documented in `/Users/openclaw/.claude/plans/remaining-loose-ends.md` section L1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions