- Notifications
You must be signed in to change notification settings - Fork746
regen-fixtures-command#122
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
| name:Regenerate fixtures and push to PR | |
| on: | |
| workflow_dispatch: | |
| repository_dispatch: | |
| types:[regen-fixtures-command] | |
| env: | |
| OPENAI_API_KEY:${{ secrets.OPENAI_API_KEY }} | |
| AWS_ACCESS_KEY_ID:${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY:${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| ANTHROPIC_API_KEY:${{ secrets.ANTHROPIC_API_KEY }} | |
| permissions: | |
| pull-requests:write# For doing the emoji reaction on a PR comment | |
| contents:write | |
| jobs: | |
| regen-fixtures: | |
| runs-on:namespace-profile-tensorzero-8x16 | |
| if:github.repository == 'tensorzero/tensorzero' | |
| steps: | |
| -uses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
| with: | |
| repository:${{ github.event.client_payload.pull_request.head.repo.full_name }} | |
| ref:${{ github.event.client_payload.pull_request.head.ref }} | |
| ssh-key:"${{ secrets.REGEN_FIXTURES_DEPLOY_KEY }}" | |
| -name:Setup Node | |
| uses:actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 | |
| with: | |
| node-version:"24.11.0" | |
| -name:Setup `pnpm` | |
| run:| | |
| for attempt in 1 2 3; do | |
| if npm install -g pnpm@latest; then | |
| break | |
| fi | |
| if [ $attempt -eq 3 ]; then | |
| echo "Failed to install pnpm after 3 attempts" | |
| exit 1 | |
| fi | |
| sleep $((10 * attempt)) | |
| done | |
| shell:bash | |
| -name:Install `pnpm` dependencies | |
| run:pnpm install --frozen-lockfile | |
| -name:Setup Playwright | |
| run:pnpm --filter=tensorzero-ui exec playwright install --with-deps chromium | |
| -name:Regenerate fixtures | |
| id:e2e_tests | |
| run:| | |
| # Set real OpenAI and S3 keys here, so that we can run image evaluations to regenerate fixtures. | |
| # If we ever need to use any other providers to regenerate the fixtures, set those keys here. | |
| echo "ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }}" >> ui/fixtures/.env | |
| echo "FIREWORKS_ACCOUNT_ID=fake_fireworks_account" >> ui/fixtures/.env | |
| echo "FIREWORKS_API_KEY=not_used" >> ui/fixtures/.env | |
| echo "FIREWORKS_BASE_URL=http://mock-inference-provider:3030/fireworks/" >> ui/fixtures/.env | |
| echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> ui/fixtures/.env | |
| echo "OPENAI_BASE_URL=http://mock-inference-provider:3030/openai/" >> ui/fixtures/.env | |
| echo "S3_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" >> ui/fixtures/.env | |
| echo "S3_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> ui/fixtures/.env | |
| echo "TENSORZERO_CLICKHOUSE_URL=http://chuser:chpassword@clickhouse:8123/tensorzero_ui_fixtures" >> ui/fixtures/.env | |
| echo "TENSORZERO_GATEWAY_TAG=sha-${{ github.sha }}" >> ui/fixtures/.env | |
| echo "TENSORZERO_GATEWAY_URL=http://gateway:3000" >> ui/fixtures/.env | |
| echo "TENSORZERO_UI_TAG=sha-${{ github.sha }}" >> ui/fixtures/.env | |
| echo "TOGETHER_API_KEY=not_used" >> ui/fixtures/.env | |
| echo "TOGETHER_BASE_URL=http://mock-inference-provider:3030/together/" >> ui/fixtures/.env | |
| ./ui/fixtures/regenerate-model-inference-cache.sh | |
| -name:Push to PR | |
| run:| | |
| git config --global user.name "TensorZero Bot" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "Regenerate ModelInferenceCache fixtures" | |
| git push | |
| -name:Add reaction | |
| uses:peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 | |
| with: | |
| token:${{ secrets.GITHUB_TOKEN }} | |
| repository:${{ github.event.client_payload.github.payload.repository.full_name }} | |
| comment-id:${{ github.event.client_payload.github.payload.comment.id }} | |
| reactions:hooray | |
| -name:Print Docker Compose logs | |
| if:always() | |
| working-directory:ui | |
| run:docker compose -f fixtures/docker-compose.e2e.yml -f fixtures/docker-compose.ui.yml logs -t | |
| -name:Print ClickHouse error logs | |
| if:always() | |
| run:docker exec fixtures-clickhouse-1 cat /var/log/clickhouse-server/clickhouse-server.err.log | |
| -name:Print ClickHouse trace logs | |
| if:always() | |
| run:docker exec fixtures-clickhouse-1 cat /var/log/clickhouse-server/clickhouse-server.log | |
| -name:Upload Playwright artifacts | |
| if:always() | |
| uses:namespace-actions/upload-artifact@9a78c62e083914789d908952f9773e42744b9f68 | |
| with: | |
| name:playwright-report | |
| path:| | |
| ui/playwright-report/ | |
| ui/test-results/ | |
| retention-days:7 |