Skip to content

feat: Implement Phase 13 - CI/CD Integration#30

Merged
himanshu231204 merged 4 commits into
mainfrom
feature/cicd-integration
Jul 11, 2026
Merged

feat: Implement Phase 13 - CI/CD Integration#30
himanshu231204 merged 4 commits into
mainfrom
feature/cicd-integration

Conversation

@himanshu231204

Copy link
Copy Markdown
Contributor

Summary

This PR implements Phase 13: CI/CD Integration for OpenAgent Eval.

Changes

New Components

  1. pytest plugin (openagent_eval/cicd/plugin.py)

    • Integrates with pytest for running RAG evaluations as tests
    • Adds custom command-line options (--oaeval-config, --oaeval-threshold)
    • Provides threshold-based test gating for CI/CD pipelines
  2. Threshold evaluator (openagent_eval/cicd/thresholds.py)

    • Evaluates metric thresholds with multiple operators (gt, gte, lt, lte, eq, neq)
    • Supports multiple gates with different behaviors (fail, warn, skip)
    • Generates detailed test results with pass/fail status
  3. CI/CD models (openagent_eval/cicd/models.py)

    • Pydantic models for configuration and results
    • CICDConfig, ThresholdConfig, EvaluationGate, TestResult
  4. oaeval test CLI command (openagent_eval/cli/commands/test.py)

    • Runs evaluation as a CI/CD test with threshold gating
    • Supports multiple thresholds via -t flag
    • JSON output for CI/CD parsing
    • Exit codes: 0 (pass), 1 (threshold failed), 2 (config error)
  5. CI/CD documentation (docs/13_cicd_integration.md)

    • Comprehensive guide for CI/CD integration
    • Examples for GitHub Actions, GitLab CI, CircleCI
    • Best practices and troubleshooting
  6. GitHub Actions workflow (.github/workflows/eval.yml)

    • Complete workflow with corpus audit, evaluation, and reporting
    • Caches dependencies and models
    • Comments on PRs with results

Usage Examples

`�ash

Run evaluation with a threshold gate

oaeval test config.yaml -t faithfulness:gte:0.8

Multiple thresholds

oaeval test config.yaml
-t faithfulness:gte:0.8
-t answer_relevancy:gte:0.7
-t latency:lte:5000

JSON output for CI/CD parsing

oaeval test config.yaml -t faithfulness:gte:0.8 --json
`

Files Modified

  • openagent_eval/cicd/init.py - Module initialization
  • openagent_eval/cicd/models.py - CI/CD configuration models
  • openagent_eval/cicd/plugin.py - pytest plugin implementation
  • openagent_eval/cicd/thresholds.py - Threshold evaluation logic
  • openagent_eval/cli/commands/test.py - oaeval test command
  • openagent_eval/cli/main.py - Register test command and update completions
  • docs/13_cicd_integration.md - CI/CD documentation
  • .github/workflows/eval.yml - GitHub Actions workflow
  • .ai/00_PROJECT.md - Update feature matrix
  • .ai/02_AGENT.md - Update phase status
  • .ai/03_CONTEXT.md - Update current state
  • .ai/05_TASKS.md - Mark Phase 13 as complete

Breaking Changes

None

Testing

  • Manual testing of oaeval test command
  • Verified threshold evaluation logic
  • Tested JSON output format
  • Verified CLI help and completions

Remaining TODOs

  • Add unit tests for CI/CD module (can be done in follow-up PR)
  • Add integration tests for pytest plugin

Assumptions & Limitations

  • Requires existing evaluation configuration
  • Threshold metrics must be available in evaluation results
  • External dependencies (LLM providers, retrievers) must be configured separately

- Add pytest plugin for RAG evaluation (openagent_eval/cicd/plugin.py)
- Add threshold-based test gating (openagent_eval/cicd/thresholds.py)
- Add CI/CD models (openagent_eval/cicd/models.py)
- Add 'oaeval test' CLI command with threshold support
- Add CI/CD documentation (docs/13_cicd_integration.md)
- Add GitHub Actions workflow example (.github/workflows/eval.yml)
- Update .ai/ documentation files to reflect Phase 13 completion
- Update CLI shell completions for test command
from __future__ import annotations

import time
from pathlib import Path
except Exception as e:
duration = time.time() - start_time
# Create a failed result
evaluator = ThresholdEvaluator(cicd_config)
- Add tests for CI/CD models (ThresholdConfig, EvaluationGate, CICDConfig, TestResult)
- Add tests for threshold evaluation logic (ThresholdEvaluator)
- Add tests for CLI test command validation
- Add tests for plugin structure
- Fix floating point comparison in NEQ test
- Coverage: models 100%, thresholds 95%, plugin 31%

def test_all_operators(self):
"""Test creating thresholds with all operators."""
for op in ThresholdOperator:
@@ -0,0 +1,79 @@
"""Unit tests for CLI test command."""

import pytest
Comment on lines +5 to +10
from openagent_eval.cicd.models import (
CICDConfig,
EvaluationGate,
ThresholdConfig,
ThresholdOperator,
)
@@ -0,0 +1,294 @@
"""Unit tests for threshold evaluation."""

import pytest
Test User added 2 commits July 11, 2026 18:35
- Strip ANSI codes in CLI help tests for reliable text matching
- Fix eval.yml workflow: audit command uses positional arg, not --corpus
This workflow is a documentation example only (shown in docs/13_cicd_integration.md).
It requires knowledge_base/ and config.yaml which don't exist in the repo.
Keeping it in .github/workflows/ caused CI failures on every push.
@himanshu231204 himanshu231204 merged commit 135a4f5 into main Jul 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant