-
Notifications
You must be signed in to change notification settings - Fork 2.6k
GHA evals #4472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+407
−287
Merged
GHA evals #4472
Changes from 15 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
91ad6ac
GHA evals
cte f5d3852
Add GitHub Actions workflows for evals Docker Compose testing
cte 1465297
Revert this
cte 1b02cce
Remove "validate-compose-file"
cte dd568b1
Add .env.local file
cte e369005
Install nc
cte 92e70b1
Add Docker layer caching
cte 70a940f
Merge branch 'main' into cte/gha-evals
cte 1c77f66
Retry logic fix
cte 88f93ca
Add ci mode to evals cli
cte 2bc65ca
Increase timeout
cte 6adb2a6
Add web health check
cte 43a4110
Forward ports for running locally
cte bacb17d
Trigger on label
cte 8453c4a
Remove this
cte 1d305ab
More powerful runner
cte 1ffe324
Remove web container
cte d0e8f2b
Increase timeout
cte e2ced71
Don't start the web container
cte e1132c7
Oops
cte 41df128
More cleanup
cte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| name: Evals | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [labeled] | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| DOCKER_BUILDKIT: 1 | ||
| COMPOSE_DOCKER_CLI_BUILD: 1 | ||
|
|
||
| jobs: | ||
| evals: | ||
| # Run if triggered manually or if PR has 'evals' label. | ||
| if: github.event_name == 'workflow_dispatch' || contains(github.event.label.name, 'evals') | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Create environment | ||
| run: | | ||
| cd packages/evals | ||
|
|
||
| cat > .env.local << EOF | ||
| OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY || 'test-key-for-build' }} | ||
| EOF | ||
|
|
||
| cat > .env.development << EOF | ||
| NODE_ENV=development | ||
| DATABASE_URL=postgresql://postgres:password@db:5432/evals_development | ||
| REDIS_URL=redis://redis:6379 | ||
| HOST_EXECUTION_METHOD=docker | ||
| EOF | ||
|
|
||
| - name: Build web image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: packages/evals/Dockerfile.web | ||
| tags: evals-web:latest | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| push: false | ||
| load: true | ||
|
|
||
| - name: Build runner image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: packages/evals/Dockerfile.runner | ||
| tags: evals-runner:latest | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| push: false | ||
| load: true | ||
|
|
||
| - name: Tag images | ||
| run: | | ||
| cd packages/evals | ||
| docker tag evals-web:latest evals-web | ||
| docker tag evals-runner:latest evals-runner | ||
|
|
||
| - name: Start containers | ||
| run: | | ||
| cd packages/evals | ||
| docker compose --profile server up -d | ||
|
|
||
| - name: Wait for containers | ||
| run: | | ||
| cd packages/evals | ||
|
|
||
| # Wait for services | ||
| echo "Waiting for PostgreSQL..." | ||
| timeout 60 bash -c 'until docker compose exec -T db pg_isready -U postgres; do sleep 2; done' | ||
|
|
||
| echo "Waiting for Redis..." | ||
| timeout 60 bash -c 'until docker compose exec -T redis redis-cli ping | grep -q PONG; do sleep 2; done' | ||
|
|
||
| echo "Testing database connection from web container..." | ||
| docker compose exec -T web sh -c 'nc -z db 5432 && echo "✓ Database connection successful"' | ||
|
|
||
| echo "Testing Redis connection from web container..." | ||
| docker compose exec -T web sh -c 'nc -z redis 6379 && echo "✓ Redis connection successful"' | ||
|
|
||
| echo "Testing web service startup..." | ||
| timeout 60 bash -c 'until curl -f http://localhost:3000/api/health 2>/dev/null; do echo "Waiting for web service..."; sleep 2; done' | ||
|
|
||
| echo "✓ Web service is healthy" | ||
| echo "Health check response:" | ||
| curl -s http://localhost:3000/api/health | jq 2>/dev/null || curl -s http://localhost:3000/api/health | ||
|
|
||
| - name: Test runner container networking | ||
| run: | | ||
| cd packages/evals | ||
|
|
||
| echo "Testing runner container can connect to services..." | ||
| docker compose run --rm runner sh -c 'nc -z db 5432 && echo "✓ Runner -> Database connection successful"' | ||
| docker compose run --rm runner sh -c 'nc -z redis 6379 && echo "✓ Runner -> Redis connection successful"' | ||
| docker compose run --rm runner sh -c 'nc -z web 3000 && echo "✓ Runner -> Web service connection successful"' | ||
|
|
||
| - name: Test Docker socket access | ||
| run: | | ||
| cd packages/evals | ||
|
|
||
| echo "Testing Docker socket access in runner..." | ||
| docker compose run --rm runner docker --version | ||
| docker compose run --rm runner docker ps | ||
|
|
||
| - name: Show service status | ||
| if: always() | ||
| run: | | ||
| cd packages/evals | ||
|
|
||
| echo "=== Service Status ===" | ||
| docker compose ps | ||
|
|
||
| echo "=== Network Information ===" | ||
| docker network ls | grep evals || echo "No evals network found" | ||
|
|
||
| echo "=== Container Information ===" | ||
| docker compose exec -T db sh -c 'echo "Database container hostname: $(hostname)"' | ||
| docker compose exec -T redis sh -c 'echo "Redis container hostname: $(hostname)"' | ||
|
|
||
| - name: Run evals | ||
| run: | | ||
| cd packages/evals | ||
| docker compose run --rm runner pnpm --filter @roo-code/evals cli --ci | ||
|
|
||
| - name: Cleanup | ||
| if: always() | ||
| run: | | ||
| cd packages/evals | ||
| docker compose down -v --remove-orphans |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,22 @@ | ||
| "use server" | ||
|
|
||
| import * as fs from "fs/promises" | ||
| import * as path from "path" | ||
| import { fileURLToPath } from "url" | ||
|
|
||
| import { type ExerciseLanguage, exerciseLanguages } from "@roo-code/evals" | ||
| import { exerciseLanguages, listDirectories } from "@roo-code/evals" | ||
|
|
||
| const __dirname = path.dirname(fileURLToPath(import.meta.url)) // <repo>/apps/web-evals/src/actions | ||
|
|
||
| const EXERCISES_BASE_PATH = path.resolve(__dirname, "../../../../../evals") | ||
|
|
||
| export const listDirectories = async (relativePath: string) => { | ||
| try { | ||
| const targetPath = path.resolve(__dirname, relativePath) | ||
| const entries = await fs.readdir(targetPath, { withFileTypes: true }) | ||
| return entries.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name) | ||
| } catch (error) { | ||
| console.error(`Error listing directories at ${relativePath}:`, error) | ||
| return [] | ||
| } | ||
| } | ||
| const EVALS_REPO_PATH = path.resolve(__dirname, "../../../../../evals") | ||
|
|
||
| export const getExercises = async () => { | ||
| const result = await Promise.all( | ||
| exerciseLanguages.map(async (language) => { | ||
| const languagePath = path.join(EXERCISES_BASE_PATH, language) | ||
| const exercises = await listDirectories(languagePath) | ||
| const languagePath = path.join(EVALS_REPO_PATH, language) | ||
| const exercises = await listDirectories(__dirname, languagePath) | ||
| return exercises.map((exercise) => `${language}/${exercise}`) | ||
| }), | ||
| ) | ||
|
|
||
| return result.flat() | ||
| } | ||
|
|
||
| export const getExercisesForLanguage = async (language: ExerciseLanguage) => | ||
| listDirectories(path.join(EXERCISES_BASE_PATH, language)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { NextResponse } from "next/server" | ||
|
|
||
| export async function GET() { | ||
| try { | ||
| return NextResponse.json( | ||
| { | ||
| status: "healthy", | ||
| timestamp: new Date().toISOString(), | ||
| uptime: process.uptime(), | ||
| environment: process.env.NODE_ENV || "production", | ||
| }, | ||
| { status: 200 }, | ||
| ) | ||
| } catch (error) { | ||
| return NextResponse.json( | ||
| { | ||
| status: "unhealthy", | ||
| timestamp: new Date().toISOString(), | ||
| error: error instanceof Error ? error.message : "Unknown error", | ||
| }, | ||
| { status: 503 }, | ||
| ) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out that we still need this if you want to run the evals natively instead of inside Docker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, forgot about that case.