|
| 1 | +name: Gevals MCP Evaluation |
| 2 | + |
| 3 | +on: |
| 4 | + # Weekly schedule - runs every Monday at 9 AM UTC |
| 5 | + schedule: |
| 6 | + - cron: '0 9 * * 1' |
| 7 | + |
| 8 | + # Manual trigger via PR comments |
| 9 | + issue_comment: |
| 10 | + types: [created] |
| 11 | + |
| 12 | + # Allow manual workflow dispatch for testing |
| 13 | + workflow_dispatch: |
| 14 | + inputs: |
| 15 | + task-filter: |
| 16 | + description: 'Regular expression to filter tasks (optional)' |
| 17 | + required: false |
| 18 | + default: '' |
| 19 | + verbose: |
| 20 | + description: 'Enable verbose output' |
| 21 | + required: false |
| 22 | + type: boolean |
| 23 | + default: false |
| 24 | + |
| 25 | +permissions: |
| 26 | + contents: read |
| 27 | + pull-requests: write |
| 28 | + issues: write |
| 29 | + |
| 30 | +concurrency: |
| 31 | + # Only run once for latest commit per ref and cancel other (previous) runs. |
| 32 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 33 | + cancel-in-progress: true |
| 34 | + |
| 35 | +env: |
| 36 | + GO_VERSION: 1.25 |
| 37 | + KIND_CLUSTER_NAME: mcp-eval-cluster |
| 38 | + |
| 39 | +defaults: |
| 40 | + run: |
| 41 | + shell: bash |
| 42 | + |
| 43 | +jobs: |
| 44 | + # Check if workflow should run based on trigger |
| 45 | + check-trigger: |
| 46 | + name: Check if evaluation should run |
| 47 | + runs-on: ubuntu-latest |
| 48 | + if: | |
| 49 | + github.event_name == 'schedule' || |
| 50 | + github.event_name == 'workflow_dispatch' || |
| 51 | + (github.event_name == 'issue_comment' && |
| 52 | + github.event.issue.pull_request && |
| 53 | + contains(github.event.comment.body, '/run-gevals')) |
| 54 | + outputs: |
| 55 | + should-run: ${{ steps.check.outputs.should-run }} |
| 56 | + pr-number: ${{ steps.check.outputs.pr-number }} |
| 57 | + pr-ref: ${{ steps.check.outputs.pr-ref }} |
| 58 | + steps: |
| 59 | + - name: Check trigger conditions |
| 60 | + id: check |
| 61 | + run: | |
| 62 | + if [[ "${{ github.event_name }}" == "issue_comment" ]]; then |
| 63 | + # Check if commenter is a maintainer (has write access) |
| 64 | + PERMISSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ |
| 65 | + "https://api.github.com/repos/${{ github.repository }}/collaborators/${{ github.event.comment.user.login }}/permission" \ |
| 66 | + | jq -r '.permission') |
| 67 | +
|
| 68 | + if [[ "$PERMISSION" == "admin" || "$PERMISSION" == "write" ]]; then |
| 69 | + echo "should-run=true" >> $GITHUB_OUTPUT |
| 70 | + echo "pr-number=${{ github.event.issue.number }}" >> $GITHUB_OUTPUT |
| 71 | + echo "pr-ref=refs/pull/${{ github.event.issue.number }}/head" >> $GITHUB_OUTPUT |
| 72 | + else |
| 73 | + echo "should-run=false" >> $GITHUB_OUTPUT |
| 74 | + echo "User ${{ github.event.comment.user.login }} does not have permission to trigger evaluations" |
| 75 | + fi |
| 76 | + else |
| 77 | + echo "should-run=true" >> $GITHUB_OUTPUT |
| 78 | + echo "pr-ref=${{ github.ref }}" >> $GITHUB_OUTPUT |
| 79 | + fi |
| 80 | +
|
| 81 | + # Run gevals evaluation with Kind cluster |
| 82 | + run-evaluation: |
| 83 | + name: Run MCP Evaluation |
| 84 | + needs: check-trigger |
| 85 | + if: needs.check-trigger.outputs.should-run == 'true' |
| 86 | + runs-on: ubuntu-latest |
| 87 | + steps: |
| 88 | + - name: Checkout |
| 89 | + uses: actions/checkout@v4 |
| 90 | + with: |
| 91 | + ref: ${{ needs.check-trigger.outputs.pr-ref }} |
| 92 | + |
| 93 | + - name: Setup Go |
| 94 | + uses: actions/setup-go@v5 |
| 95 | + with: |
| 96 | + go-version: ${{ env.GO_VERSION }} |
| 97 | + |
| 98 | + - name: Setup Kind cluster |
| 99 | + run: make kind-create-cluster KIND_CLUSTER_NAME=${{ env.KIND_CLUSTER_NAME }} |
| 100 | + |
| 101 | + - name: Start MCP server |
| 102 | + run: make run-server |
| 103 | + |
| 104 | + - name: Run gevals evaluation |
| 105 | + id: gevals |
| 106 | + uses: genmcp/gevals/.github/actions/gevals-action@main |
| 107 | + with: |
| 108 | + eval-config: 'evals/openai-agent/eval.yaml' |
| 109 | + gevals-version: 'latest' |
| 110 | + task-filter: ${{ github.event.inputs.task-filter || '' }} |
| 111 | + output-format: 'json' |
| 112 | + verbose: ${{ github.event.inputs.verbose || 'false' }} |
| 113 | + upload-artifacts: 'true' |
| 114 | + artifact-name: 'gevals-results' |
| 115 | + fail-on-error: 'false' |
| 116 | + task-pass-threshold: '0.8' |
| 117 | + assertion-pass-threshold: '0.8' |
| 118 | + working-directory: '.' |
| 119 | + env: |
| 120 | + # OpenAI Agent configuration |
| 121 | + MODEL_BASE_URL: ${{ secrets.MODEL_BASE_URL }} |
| 122 | + MODEL_KEY: ${{ secrets.MODEL_KEY }} |
| 123 | + MODEL_NAME: ${{ secrets.MODEL_NAME }} |
| 124 | + # LLM Judge configuration |
| 125 | + JUDGE_BASE_URL: ${{ secrets.JUDGE_BASE_URL }} |
| 126 | + JUDGE_API_KEY: ${{ secrets.JUDGE_API_KEY }} |
| 127 | + JUDGE_MODEL_NAME: ${{ secrets.JUDGE_MODEL_NAME }} |
| 128 | + |
| 129 | + - name: Cleanup |
| 130 | + if: always() |
| 131 | + run: | |
| 132 | + make stop-server || true |
| 133 | + make kind-delete-cluster KIND_CLUSTER_NAME=${{ env.KIND_CLUSTER_NAME }} || true |
| 134 | +
|
| 135 | + - name: Post results comment on PR |
| 136 | + if: github.event_name == 'issue_comment' && always() |
| 137 | + env: |
| 138 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 139 | + run: | |
| 140 | + PASS_RATE=$(awk "BEGIN {printf \"%.1f\", ${{ steps.gevals.outputs.task-pass-rate }} * 100}") |
| 141 | +
|
| 142 | + gh pr comment ${{ needs.check-trigger.outputs.pr-number }} --body "$(cat <<EOF |
| 143 | + ## Gevals MCP Evaluation Results |
| 144 | +
|
| 145 | + **Summary:** ${{ steps.gevals.outputs.tasks-passed }}/${{ steps.gevals.outputs.tasks-total }} tasks passed (${PASS_RATE}%) |
| 146 | +
|
| 147 | + | Metric | Result | |
| 148 | + |--------|--------| |
| 149 | + | Tasks Passed | ${{ steps.gevals.outputs.tasks-passed }}/${{ steps.gevals.outputs.tasks-total }} | |
| 150 | + | Assertions Passed | ${{ steps.gevals.outputs.assertions-passed }}/${{ steps.gevals.outputs.assertions-total }} | |
| 151 | + | Overall | ${{ steps.gevals.outputs.passed == 'true' && 'Passed' || 'Failed' }} | |
| 152 | +
|
| 153 | + [View full results](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) |
| 154 | + EOF |
| 155 | + )" |
0 commit comments