323 lines
13 KiB
YAML
323 lines
13 KiB
YAML
name: Live Tests
|
|
|
|
permissions: {}
|
|
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
ANTHROPIC_API_KEY:
|
|
required: true
|
|
AWS_ACCESS_KEY_ID:
|
|
required: true
|
|
AWS_BEARER_TOKEN_BEDROCK:
|
|
required: true
|
|
AWS_SECRET_ACCESS_KEY:
|
|
required: true
|
|
AZURE_API_KEY_NEW:
|
|
required: true
|
|
DEEPSEEK_API_KEY:
|
|
required: true
|
|
DOCKERHUB_LIMITED_TOKEN:
|
|
required: true
|
|
FIREWORKS_ACCOUNT_ID:
|
|
required: true
|
|
FIREWORKS_API_KEY:
|
|
required: true
|
|
GCP_JWT_KEY:
|
|
required: true
|
|
GCP_STORAGE_ACCESS_KEY_ID:
|
|
required: true
|
|
GCP_STORAGE_SECRET_ACCESS_KEY:
|
|
required: true
|
|
GOOGLE_AI_STUDIO_API_KEY:
|
|
required: true
|
|
GROQ_API_KEY:
|
|
required: true
|
|
HYPERBOLIC_API_KEY:
|
|
required: true
|
|
MISTRAL_API_KEY:
|
|
required: true
|
|
MODAL_KEY:
|
|
required: true
|
|
MODAL_SECRET:
|
|
required: true
|
|
OPENAI_API_KEY:
|
|
required: true
|
|
OPENROUTER_API_KEY:
|
|
required: true
|
|
R2_ACCESS_KEY_ID:
|
|
required: true
|
|
R2_SECRET_ACCESS_KEY:
|
|
required: true
|
|
SGLANG_API_KEY:
|
|
required: true
|
|
TGI_API_KEY:
|
|
required: true
|
|
TOGETHER_API_KEY:
|
|
required: true
|
|
VLLM_API_BASE:
|
|
required: true
|
|
VLLM_API_KEY:
|
|
required: true
|
|
VOYAGE_API_KEY:
|
|
required: true
|
|
XAI_API_KEY:
|
|
required: true
|
|
|
|
env:
|
|
CARGO_INCREMENTAL: 0
|
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_BEARER_TOKEN_BEDROCK: ${{ secrets.AWS_BEARER_TOKEN_BEDROCK }}
|
|
AWS_REGION: "us-east-1"
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AZURE_API_KEY: ${{ secrets.AZURE_API_KEY_NEW }}
|
|
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
|
|
FIREWORKS_ACCOUNT_ID: ${{ secrets.FIREWORKS_ACCOUNT_ID }}
|
|
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
|
|
FORCE_COLOR: 1
|
|
GCP_STORAGE_ACCESS_KEY_ID: ${{ secrets.GCP_STORAGE_ACCESS_KEY_ID }}
|
|
GCP_STORAGE_SECRET_ACCESS_KEY: ${{ secrets.GCP_STORAGE_SECRET_ACCESS_KEY }}
|
|
GCP_VERTEX_CREDENTIALS_PATH: ${{ github.workspace }}/gcp_jwt_key.json
|
|
GOOGLE_AI_STUDIO_API_KEY: ${{ secrets.GOOGLE_AI_STUDIO_API_KEY }}
|
|
GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/gcp_jwt_key.json
|
|
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
|
|
HYPERBOLIC_API_KEY: ${{secrets.HYPERBOLIC_API_KEY}}
|
|
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
|
|
MODAL_KEY: ${{ secrets.MODAL_KEY }}
|
|
MODAL_SECRET: ${{ secrets.MODAL_SECRET }}
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
|
|
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
|
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
|
SGLANG_API_KEY: ${{ secrets.SGLANG_API_KEY }}
|
|
TGI_API_KEY: ${{ secrets.TGI_API_KEY }}
|
|
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }}
|
|
VLLM_API_BASE: ${{ secrets.VLLM_API_BASE }}
|
|
VLLM_API_KEY: ${{ secrets.VLLM_API_KEY }}
|
|
VLLM_MODEL_NAME: "microsoft/Phi-3.5-mini-instruct"
|
|
VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }}
|
|
XAI_API_KEY: ${{ secrets.XAI_API_KEY }}
|
|
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: https://localhost:4316
|
|
SQLX_OFFLINE: 1
|
|
TENSORZERO_E2E_PROXY: http://localhost:3003
|
|
TENSORZERO_COMMIT_TAG: sha-${{ github.sha }}
|
|
TENSORZERO_GATEWAY_TAG: sha-${{ github.sha }}
|
|
TENSORZERO_MOCK_PROVIDER_API_TAG: sha-${{ github.sha }}
|
|
TENSORZERO_CI: 1
|
|
CARGO_NEXTEST_FLAKY_TESTS: ${{ vars.CARGO_NEXTEST_FLAKY_TESTS }}
|
|
|
|
jobs:
|
|
live-tests:
|
|
if: github.repository == 'tensorzero/tensorzero'
|
|
name: "live-tests (batch_writes: ${{ matrix.batch_writes }}, database: ${{ matrix.database }})"
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read # Required for checkout or repository metadata reads.
|
|
actions: read # Required to read workflow run, cache, or artifact metadata.
|
|
timeout-minutes: 45
|
|
strategy:
|
|
matrix:
|
|
batch_writes: [true, false]
|
|
database: [clickhouse, postgres]
|
|
# Don't fail-fast for manual/cron runs, so that we get the full picture of what broke
|
|
fail-fast: ${{ github.event_name == 'merge_group' }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Cleanup disk space
|
|
run: bash ci/free-disk-space.sh
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
|
with:
|
|
username: tensorzero
|
|
password: ${{ secrets.DOCKERHUB_LIMITED_TOKEN }}
|
|
|
|
- name: Pull container images
|
|
run: |
|
|
./ci/docker-pull-with-retry.sh \
|
|
tensorzero/gateway-dev:sha-$GITHUB_SHA \
|
|
tensorzero/provider-proxy:sha-$GITHUB_SHA \
|
|
tensorzero/gateway-e2e:sha-$GITHUB_SHA \
|
|
tensorzero/live-tests:sha-$GITHUB_SHA \
|
|
tensorzero/fixtures:sha-$GITHUB_SHA
|
|
docker tag tensorzero/gateway-dev:sha-$GITHUB_SHA tensorzero/gateway:sha-$GITHUB_SHA
|
|
docker tag tensorzero/fixtures:sha-$GITHUB_SHA tensorzero/fixtures-postgres:sha-$GITHUB_SHA
|
|
|
|
- name: Restore provider-proxy cache
|
|
if: github.event_name != 'schedule'
|
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
|
with:
|
|
path: ./ci/provider-proxy-cache/
|
|
key: provider-proxy-cache-${{ github.run_id }}
|
|
restore-keys: provider-proxy-cache-
|
|
|
|
- name: Download provider-proxy cache
|
|
# When running as a cron job, don't use the provider-proxy cache.
|
|
# The cron job is used to gather information about provider flakiness.
|
|
if: github.event_name != 'schedule'
|
|
run: |
|
|
AWS_ACCESS_KEY_ID=$R2_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$R2_SECRET_ACCESS_KEY PROVIDER_PROXY_CACHE_BUCKET=provider-proxy-cache ./ci/download-provider-proxy-cache.sh
|
|
|
|
- name: Write GCP JWT key to file
|
|
env:
|
|
GCP_JWT_KEY: ${{ secrets.GCP_JWT_KEY }}
|
|
run: echo "$GCP_JWT_KEY" > $GITHUB_WORKSPACE/gcp_jwt_key.json
|
|
|
|
- name: Set Postgres as primary datastore
|
|
if: matrix.database == 'postgres'
|
|
run: |
|
|
echo "TENSORZERO_INTERNAL_TEST_OBSERVABILITY_BACKEND=postgres" >> $GITHUB_ENV
|
|
echo "GATEWAY_CONFIG_GLOB={tensorzero,postgres}.*.toml" >> $GITHUB_ENV
|
|
|
|
- name: Configure batch writes in tensorzero.toml
|
|
if: matrix.batch_writes == true
|
|
run: |
|
|
echo "[gateway.observability.batch_writes]" >> crates/tensorzero-core/tests/e2e/config/tensorzero.misc.toml
|
|
echo "enabled = true" >> crates/tensorzero-core/tests/e2e/config/tensorzero.misc.toml
|
|
echo "flush_interval_ms = 80" >> crates/tensorzero-core/tests/e2e/config/tensorzero.misc.toml
|
|
echo "__force_allow_embedded_batch_writes = true" >> crates/tensorzero-core/tests/e2e/config/tensorzero.misc.toml
|
|
|
|
- name: Pull images referenced by the compose file
|
|
run: docker compose -f crates/tensorzero-core/tests/e2e/docker-compose.live.yml --profile provider-proxy pull --ignore-pull-failures
|
|
|
|
- name: Run live tests container via Docker Compose
|
|
env:
|
|
BATCH_WRITES: ${{ matrix.batch_writes }}
|
|
run: |
|
|
DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) docker compose -f crates/tensorzero-core/tests/e2e/docker-compose.live.yml --profile provider-proxy run --rm \
|
|
-e TENSORZERO_CI=1 \
|
|
-e TENSORZERO_CLICKHOUSE_BATCH_WRITES="$BATCH_WRITES" \
|
|
-e TENSORZERO_INTERNAL_TEST_OBSERVABILITY_BACKEND=${TENSORZERO_INTERNAL_TEST_OBSERVABILITY_BACKEND:-} \
|
|
live-tests
|
|
|
|
- name: Print live tests logs
|
|
if: always()
|
|
run: docker compose -f crates/tensorzero-core/tests/e2e/docker-compose.live.yml --profile provider-proxy logs -t
|
|
|
|
- name: Check e2e logs for impossible error messages
|
|
run: |
|
|
LOGS=$(docker compose -f crates/tensorzero-core/tests/e2e/docker-compose.live.yml --profile provider-proxy logs gateway)
|
|
if [ -z "$LOGS" ]; then
|
|
echo "ERROR: Gateway logs are empty"
|
|
exit 1
|
|
fi
|
|
grep --invert-match -i "please file a bug report" <<< "$LOGS"
|
|
|
|
- name: Check gateway started with correct batch writes mode
|
|
env:
|
|
BATCH_WRITES: ${{ matrix.batch_writes }}
|
|
run: |
|
|
LOGS=$(docker compose -f crates/tensorzero-core/tests/e2e/docker-compose.live.yml --profile provider-proxy logs gateway)
|
|
if [ -z "$LOGS" ]; then
|
|
echo "ERROR: Gateway logs are empty"
|
|
exit 1
|
|
fi
|
|
if [ "$BATCH_WRITES" = "true" ]; then
|
|
echo "Checking that batch writes are enabled..."
|
|
grep "Batch Writes: enabled" <<< "$LOGS"
|
|
else
|
|
echo "Checking that batch writes are disabled..."
|
|
grep "Batch Writes: disabled" <<< "$LOGS"
|
|
fi
|
|
|
|
# TODO - re-enable this: https://github.com/tensorzero/tensorzero/issues/3989
|
|
# - name: Check e2e logs for deprecation warnings (gateway e2e tests only)
|
|
# run: |
|
|
# LOGS=$(docker compose -f crates/tensorzero-core/tests/e2e/docker-compose.live.yml logs gateway)
|
|
# if [ -z "$LOGS" ]; then
|
|
# echo "ERROR: Gateway logs are empty"
|
|
# exit 1
|
|
# fi
|
|
# ! grep -i "Deprecation Warning" "$LOGS"
|
|
|
|
- name: Upload provider-proxy cache
|
|
# Only upload the cache from trusted runs (merge queue or cron)
|
|
if: github.event_name == 'merge_group' || github.event_name == 'schedule'
|
|
run: |
|
|
AWS_ACCESS_KEY_ID=$R2_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$R2_SECRET_ACCESS_KEY PROVIDER_PROXY_CACHE_BUCKET=provider-proxy-cache ./ci/upload-provider-proxy-cache.sh
|
|
|
|
# Run evaluation tests against both ClickHouse and Postgres backends.
|
|
# Evaluation tests use an embedded gateway and connect directly to the database,
|
|
# so they don't need the external gateway service — just the database infrastructure
|
|
# and provider-proxy for LLM judge calls.
|
|
evaluation-tests:
|
|
if: github.repository == 'tensorzero/tensorzero'
|
|
name: "evaluation-tests (database: ${{ matrix.database }})"
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read # Required for checkout or repository metadata reads.
|
|
actions: read # Required to read workflow run, cache, or artifact metadata.
|
|
timeout-minutes: 45
|
|
strategy:
|
|
matrix:
|
|
database: [clickhouse, postgres]
|
|
fail-fast: ${{ github.event_name == 'merge_group' }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Cleanup disk space
|
|
run: bash ci/free-disk-space.sh
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
|
with:
|
|
username: tensorzero
|
|
password: ${{ secrets.DOCKERHUB_LIMITED_TOKEN }}
|
|
|
|
- name: Pull container images
|
|
run: |
|
|
./ci/docker-pull-with-retry.sh \
|
|
tensorzero/gateway-dev:sha-$GITHUB_SHA \
|
|
tensorzero/provider-proxy:sha-$GITHUB_SHA \
|
|
tensorzero/gateway-e2e:sha-$GITHUB_SHA \
|
|
tensorzero/live-tests:sha-$GITHUB_SHA \
|
|
tensorzero/fixtures:sha-$GITHUB_SHA
|
|
docker tag tensorzero/gateway-dev:sha-$GITHUB_SHA tensorzero/gateway:sha-$GITHUB_SHA
|
|
docker tag tensorzero/fixtures:sha-$GITHUB_SHA tensorzero/fixtures-postgres:sha-$GITHUB_SHA
|
|
|
|
- name: Restore provider-proxy cache
|
|
if: github.event_name != 'schedule'
|
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
|
with:
|
|
path: ./ci/provider-proxy-cache/
|
|
key: provider-proxy-cache-${{ github.run_id }}
|
|
restore-keys: provider-proxy-cache-
|
|
|
|
- name: Download provider-proxy cache
|
|
if: github.event_name != 'schedule'
|
|
run: |
|
|
AWS_ACCESS_KEY_ID=$R2_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$R2_SECRET_ACCESS_KEY PROVIDER_PROXY_CACHE_BUCKET=provider-proxy-cache ./ci/download-provider-proxy-cache.sh
|
|
|
|
- name: Write GCP JWT key to file
|
|
env:
|
|
GCP_JWT_KEY: ${{ secrets.GCP_JWT_KEY }}
|
|
run: echo "$GCP_JWT_KEY" > $GITHUB_WORKSPACE/gcp_jwt_key.json
|
|
|
|
- name: Pull images referenced by the compose file
|
|
run: docker compose -f crates/tensorzero-core/tests/e2e/docker-compose.live.yml --profile provider-proxy pull --ignore-pull-failures
|
|
|
|
- name: Set Postgres as primary datastore
|
|
if: matrix.database == 'postgres'
|
|
run: |
|
|
echo "TENSORZERO_INTERNAL_TEST_OBSERVABILITY_BACKEND=postgres" >> $GITHUB_ENV
|
|
|
|
- name: Run evaluation tests
|
|
run: |
|
|
DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) docker compose -f crates/tensorzero-core/tests/e2e/docker-compose.live.yml --profile provider-proxy run --rm \
|
|
-e TENSORZERO_CI=1 \
|
|
-e TENSORZERO_INTERNAL_TEST_OBSERVABILITY_BACKEND=${TENSORZERO_INTERNAL_TEST_OBSERVABILITY_BACKEND:-} \
|
|
live-tests \
|
|
sh -c "cargo-nextest nextest run --no-fail-fast --archive-file tests.tar.zst --workspace-remap /app/crates --config-file /app/crates/.config/nextest.toml --profile evaluations -j 4"
|
|
|
|
- name: Print evaluation tests logs
|
|
if: always()
|
|
run: docker compose -f crates/tensorzero-core/tests/e2e/docker-compose.live.yml --profile provider-proxy logs -t
|