发布

  • [OPIK-5921] [CI] ci: decouple guardrails tests into dedicated workflows (#6283)

    frostbyte_neo 发布于 2026-04-20 13:16:34 +00:00

    • [OPIK-5921] [CI] ci: decouple guardrails tests into dedicated workflows

    Move guardrails test execution out of the main SDK E2E pipelines into
    two dedicated workflows. Previously every Python SDK PR paid the cost
    of starting the heavy guardrails ML container regardless of whether
    the change touched guardrails.

    • guardrails_unit_tests.yml: runs apps/opik-guardrails-backend/tests/unit
      on Python 3.10 (matching Dockerfile pin). These tests had no CI
      coverage before.
    • guardrails_e2e_tests.yml: runs sdks/python/tests/e2e/test_guardrails.py
      on the Python 3.10-3.14 matrix with the full stack + --guardrails.

    Both workflows trigger on PR (path-filtered), push to main, and
    workflow_dispatch. Failure-only Slack notifications use the same
    secrets as e2e_tests_post_merge.yml.

    Main SDK E2E pipelines updated to drop the --guardrails flag,
    OPIK_GUARDRAILS_URL_OVERRIDE env var, and the guardrails path triggers.
    test_guardrails.py is excluded from the main pytest invocation since
    it now runs in the dedicated workflow.

    opik-optimizer-e2e-tests.yaml also had leftover --guardrails wiring
    that was never exercised by the optimizer tests — removed.

    Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

    • ci(optimizer): align triggers with other SDK E2E workflows

    • ci(guardrails): widen push-to-main path triggers to catch upstream regressions

    • refactor(ci): extract Slack notifications into reusable scripts

    Move inline Slack notification logic from 5 workflow YAML files into
    dedicated shell scripts under .github/scripts/. All scripts share a
    common base (send-slack-message.sh) for webhook check, curl, and HTTP
    status handling.

    Also:

    • Add missing ./opik.sh --stop step to optimizer E2E workflow
    • Guard guardrails Slack notifications to only fire on merge-to-main,
      not on pull requests

    Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

    • fix(ci): handle multi-word suite names in Slack notification

    The lib-integration Slack script iterated suite keys via
    for name in $(... | jq -r 'keys[]'), which word-splits on whitespace.
    Suite names like "CrewAI v0" got split into two separate tokens,
    miscounting the suite as 2 skipped entries instead of 1 categorized
    entry.

    Switch to a tab-delimited while read loop so names with spaces stay
    intact.

    Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

    • ci(guardrails): use centralized PYTHON_VERSIONS matrix

    Replace the hardcoded Python version matrix with the repo-level
    vars.PYTHON_VERSIONS introduced in OPIK-6019, matching the pattern
    used by opik-optimizer-e2e-tests.yaml and other SDK E2E workflows.

    Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com


    Co-authored-by: Claude Opus 4.6 (1M context) noreply@anthropic.com

    下载附件