Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ test-feedback-load = [

build-e2e = "build --bin gateway --features e2e_tests"
run-e2e = "run --bin gateway --features e2e_tests -- --config-file tensorzero-core/tests/e2e/config/tensorzero.*.toml"
run-e2e-mock-batch = "run --bin gateway --features e2e_tests -- --config-file tensorzero-core/tests/e2e/config/{tensorzero.*.toml,mock_batch.toml}"
run-e2e-mock-optimization = "run --bin gateway --features e2e_tests -- --config-file tensorzero-core/tests/e2e/config/{tensorzero.*.toml,mock_optimization.toml}"
migrate-postgres = "run --bin gateway --features e2e_tests -- --run-postgres-migrations"
watch-e2e = "watch -x run-e2e"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-gateway-e2e-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ jobs:

# For some reason, 'docker compose build --push' doesn't work when using a remote builder (i.e. Namespace)
- name: Build test containers
run: docker compose -f tensorzero-core/tests/e2e/docker-compose.live.yml build --push mock-inference-provider provider-proxy gateway live-tests
run: docker compose -f tensorzero-core/tests/e2e/docker-compose.live.yml build --push provider-proxy gateway live-tests

# Note that this pushes an e2e build of the gateway to 'tensorzero/gateway-e2e'.
# It does *not* push to the production 'tensorzero/gateway' repo.
- name: Push test containers
run: docker compose -f tensorzero-core/tests/e2e/docker-compose.live.yml push mock-inference-provider provider-proxy gateway live-tests
run: docker compose -f tensorzero-core/tests/e2e/docker-compose.live.yml push provider-proxy gateway live-tests
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Build Mock Inference Container
name: Build Mock Provider API Container

on:
workflow_call:

jobs:
build-mock-inference-container:
build-mock-provider-api-container:
runs-on: ubuntu-latest
if: github.repository == 'tensorzero/tensorzero'
permissions:
Expand All @@ -30,18 +30,18 @@ jobs:
wait-for-builder: true
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}

- name: Build `mock-inference-provider` container
- name: Build `mock-provider-api` container
run: |
docker buildx build --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 -f tensorzero-core/tests/mock-inference-provider/Dockerfile . -t tensorzero/mock-inference-provider:sha-${{ github.sha }} -t nscr.io/igvf4asmf8kri/mock-inference-provider:sha-${{ github.sha }}
docker buildx build --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 -f tensorzero-core/tests/mock-provider-api/Dockerfile . -t tensorzero/mock-provider-api:sha-${{ github.sha }} -t nscr.io/igvf4asmf8kri/mock-provider-api:sha-${{ github.sha }}

- name: Save `mock-inference-provider` container
run: docker save tensorzero/mock-inference-provider:sha-${{ github.sha }} > mock-inference-container.tar
- name: Save `mock-provider-api` container
run: docker save tensorzero/mock-provider-api:sha-${{ github.sha }} > mock-provider-api-container.tar

- name: Upload `mock-inference-provider` container as an artifact
- name: Upload `mock-provider-api` container as an artifact
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: build-mock-inference-container
path: mock-inference-container.tar
name: build-mock-provider-api-container
path: mock-provider-api-container.tar
retention-days: 1
if-no-files-found: error
overwrite: false
Expand All @@ -50,6 +50,6 @@ jobs:
run: nsc docker login
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}

- name: Push `mock-inference` container to Namespace registry
run: docker push nscr.io/igvf4asmf8kri/mock-inference-provider:sha-${{ github.sha }}
- name: Push `mock-provider-api` container to Namespace registry
run: docker push nscr.io/igvf4asmf8kri/mock-provider-api:sha-${{ github.sha }}
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
33 changes: 16 additions & 17 deletions .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ jobs:
contents: read
# Permission to download artifacts and for rust-cache
actions: read
needs: [build-gateway-container, build-mock-inference-container]
needs: [build-gateway-container, build-mock-provider-api-container]

# We don't run many tests here, so use a normal runner with Github Actions caching
# to avoid unnecessarily using Namespace credits (it should still always finish before
Expand Down Expand Up @@ -803,10 +803,10 @@ jobs:
- name: Download container images
run: |
docker pull nscr.io/igvf4asmf8kri/gateway:sha-${{ github.sha }}
docker pull nscr.io/igvf4asmf8kri/mock-inference-provider:sha-${{ github.sha }}
docker pull nscr.io/igvf4asmf8kri/mock-provider-api:sha-${{ github.sha }}
# Retag the images to what we expect the names to be
docker tag nscr.io/igvf4asmf8kri/gateway:sha-${{ github.sha }} tensorzero/gateway:sha-${{ github.sha }}
docker tag nscr.io/igvf4asmf8kri/mock-inference-provider:sha-${{ github.sha }} tensorzero/mock-inference-provider:sha-${{ github.sha }}
docker tag nscr.io/igvf4asmf8kri/mock-provider-api:sha-${{ github.sha }} tensorzero/mock-provider-api:sha-${{ github.sha }}
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}

- name: Download ClickHouse fixtures
Expand Down Expand Up @@ -834,9 +834,9 @@ jobs:
run: |
echo "TENSORZERO_GATEWAY_TAG=sha-${{ github.sha }}" >> $GITHUB_ENV

- name: Set TENSORZERO_MOCK_INFERENCE_PROVIDER_TAG
- name: Set TENSORZERO_MOCK_PROVIDER_API_TAG
run: |
echo "TENSORZERO_MOCK_INFERENCE_PROVIDER_TAG=sha-${{ github.sha }}" >> $GITHUB_ENV
echo "TENSORZERO_MOCK_PROVIDER_API_TAG=sha-${{ github.sha }}" >> $GITHUB_ENV

- name: Launch dependency services with non-replicated ClickHouse container for E2E tests
if: matrix.replicated == false
Expand Down Expand Up @@ -945,7 +945,7 @@ jobs:
if: always()
run: cat e2e_logs.txt

# Run 'cargo test-optimization' against mock-inference-provider
# Run 'cargo test-optimization' against mock-provider-api
mock-optimization-tests:
permissions:
contents: read
Expand All @@ -956,9 +956,8 @@ jobs:
env:
OPENAI_API_KEY: not_used
FIREWORKS_API_KEY: not_used
FIREWORKS_ACCOUNT_ID: not_used
TOGETHER_API_KEY: not_used
TENSORZERO_USE_MOCK_INFERENCE_PROVIDER: 1
TENSORZERO_INTERNAL_MOCK_PROVIDER_API: http://localhost:3030
TENSORZERO_SKIP_LARGE_FIXTURES: 1
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
Expand Down Expand Up @@ -1012,7 +1011,7 @@ jobs:

- name: Launch the gateway for E2E tests
run: |
cargo run-e2e-mock-optimization > e2e_logs.txt 2>&1 &
cargo run-e2e > e2e_logs.txt 2>&1 &
GATEWAY_PID=$!
while ! curl -s http://localhost:3000/health; do
if ! kill -0 $GATEWAY_PID 2>/dev/null; then
Expand Down Expand Up @@ -1058,8 +1057,8 @@ jobs:
# Permission to fetch GitHub OIDC token authentication
id-token: write

build-mock-inference-container:
uses: ./.github/workflows/build-mock-inference-container.yml
build-mock-provider-api-container:
uses: ./.github/workflows/build-mock-provider-api-container.yml
permissions:
# Permission to checkout the repository
contents: read
Expand All @@ -1073,7 +1072,7 @@ jobs:
uses: ./.github/workflows/ui-tests.yml
with:
is_merge_group: ${{ github.event_name == 'merge_group' }}
needs: [build-gateway-container, build-mock-inference-container]
needs: [build-gateway-container, build-mock-provider-api-container]

ui-tests-e2e:
permissions:
Expand All @@ -1086,7 +1085,7 @@ jobs:
[
build-gateway-container,
build-ui-container,
build-mock-inference-container,
build-mock-provider-api-container,
]
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -1150,7 +1149,7 @@ jobs:
[
build-gateway-container,
build-ui-container,
build-mock-inference-container,
build-mock-provider-api-container,
]
secrets:
S3_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -1167,7 +1166,7 @@ jobs:
[
build-gateway-container,
build-gateway-e2e-container,
build-mock-inference-container,
build-mock-provider-api-container,
]
if: (github.repository == 'tensorzero/tensorzero' && github.event_name == 'merge_group')
permissions:
Expand All @@ -1191,7 +1190,7 @@ jobs:
actions: read
if: github.repository == 'tensorzero/tensorzero' && github.event_name == 'merge_group'
uses: ./.github/workflows/mocked-batch-test.yml
needs: [build-mock-inference-container]
needs: [build-mock-provider-api-container]
secrets: inherit

# See 'ci/README.md' at the repository root for more details.
Expand All @@ -1212,7 +1211,7 @@ jobs:
build-ui-container,
build-gateway-container,
build-gateway-e2e-container,
build-mock-inference-container,
build-mock-provider-api-container,
mocked-batch-tests,
minikube,
rust-build,
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/merge-queue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ jobs:
contents: read
# Permission to fetch GitHub OIDC token authentication
id-token: write
# Permission to download artifacts
actions: read
timeout-minutes: 45
strategy:
matrix:
Expand Down Expand Up @@ -315,11 +317,11 @@ jobs:
- name: Install Python for python async client tests
run: uv python install 3.9

- name: "Python: PyO3 Client: pytest"
- name: "Python: PyO3 Client: pytest (non-mock tests)"
working-directory: clients/python
run: |
# Start the test in background and capture its PID
bash ./test.sh --verbose -n 8 &
bash ./test.sh --verbose -n 8 -m "not mock" &
TEST_PID=$!
echo "Started test.sh with PID: $TEST_PID"

Expand Down Expand Up @@ -358,6 +360,13 @@ jobs:
fi
exit 1

- name: "Python: PyO3 Client: pytest (mock tests)"
working-directory: clients/python
env:
TENSORZERO_INTERNAL_MOCK_PROVIDER_API: http://localhost:3030
run: |
bash ./test.sh --verbose -n 8 -m mock

- name: "Node.js: OpenAI Client: test"
working-directory: clients/openai-node
run: |
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/mocked-batch-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ env:
AZURE_OPENAI_DEPLOYMENT_ID: "fake_deployment_id"
DEEPSEEK_API_KEY: "fake_deepseek_key"
FIREWORKS_API_KEY: "fake_fireworks_key"
FIREWORKS_ACCOUNT_ID: "fake_fireworks_account"
FORCE_COLOR: 1
GCP_VERTEX_CREDENTIALS_PATH: ${{ github.workspace }}/gcp_jwt_key.json
GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/gcp_jwt_key.json
Expand All @@ -28,7 +27,7 @@ env:
VLLM_API_BASE: "http://fake-vllm-endpoint:8000"
VLLM_MODEL_NAME: "microsoft/Phi-3.5-mini-instruct"
XAI_API_KEY: "fake_xai_key"
TENSORZERO_USE_MOCK_INFERENCE_PROVIDER: 1
TENSORZERO_INTERNAL_MOCK_PROVIDER_API: http://localhost:3030

on:
workflow_dispatch:
Expand Down Expand Up @@ -81,35 +80,35 @@ jobs:
GCP_JWT_KEY: ${{ secrets.GCP_JWT_KEY }}
run: echo "$GCP_JWT_KEY" > $GITHUB_WORKSPACE/gcp_jwt_key.json

- name: Download mock-inference-container
- name: Download mock-provider-api-container
continue-on-error: true # Skip if missing (e.g. triggered via `workflow_dispatch`)
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
with:
name: build-mock-inference-container
name: build-mock-provider-api-container
path: .

- name: Load mock-inference-container
id: load-mock-inference
- name: Load mock-provider-api-container
id: load-mock-provider-api
continue-on-error: true # Skip if missing (e.g. triggered via `workflow_dispatch`)
run: |
docker load < mock-inference-container.tar
docker load < mock-provider-api-container.tar

- name: Set TENSORZERO_MOCK_INFERENCE_PROVIDER_TAG
if: steps.load-mock-inference.outcome == 'success' # Only run if artifact was successfully loaded
- name: Set TENSORZERO_MOCK_PROVIDER_API_TAG
if: steps.load-mock-provider-api.outcome == 'success' # Only run if artifact was successfully loaded
run: |
echo "TENSORZERO_MOCK_INFERENCE_PROVIDER_TAG=sha-${{ github.sha }}" >> $GITHUB_ENV
echo "TENSORZERO_MOCK_PROVIDER_API_TAG=sha-${{ github.sha }}" >> $GITHUB_ENV

- name: Start Docker services (mock-inference-provider + dependencies)
- name: Start Docker services (mock-provider-api + dependencies)
run: |
docker compose -f tensorzero-core/tests/e2e/docker-compose.yml up -d --wait clickhouse postgres gateway-clickhouse-migrations gateway-postgres-migrations minio mock-inference-provider
docker compose -f tensorzero-core/tests/e2e/docker-compose.yml up -d --wait clickhouse postgres gateway-clickhouse-migrations gateway-postgres-migrations minio mock-provider-api

- name: Set up TENSORZERO_CLICKHOUSE_URL for batch tests
run: |
echo "TENSORZERO_CLICKHOUSE_URL=http://chuser:chpassword@localhost:8123/tensorzero_e2e_tests" >> $GITHUB_ENV

- name: Launch the gateway for batch tests
run: |
cargo run-e2e-mock-batch > batch_logs.txt 2>&1 &
cargo run-e2e > batch_logs.txt 2>&1 &
echo "GATEWAY_PID=$!" >> $GITHUB_ENV
while ! curl -s -f http://localhost:3000/health >/dev/null 2>&1; do
echo "Waiting for gateway to be healthy..."
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/slash-command-regen-fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,17 @@ jobs:
# 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_INTERNAL_MOCK_PROVIDER_API=http://mock-provider-api:3030" >> ui/fixtures/.env
echo "TENSORZERO_MOCK_PROVIDER_API_TAG=sha-${{ github.sha }}" >> 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: Upload to R2 and update download script
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/ui-tests-e2e-model-inference-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
- name: Download container images
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
with:
pattern: build-{gateway,ui,mock-inference}-container
pattern: build-{gateway,ui,mock-provider-api}-container
merge-multiple: true

- name: Load container images
Expand All @@ -98,7 +98,7 @@ jobs:
run: |
docker load < gateway-container.tar
docker load < ui-container.tar
docker load < mock-inference-container.tar
docker load < mock-provider-api-container.tar

# This allows us to use 'no-build' on subsequent steps
- name: Build needed docker images
Expand All @@ -111,16 +111,11 @@ jobs:
run: |
# Environment variables shared by the gateway and ui containers
echo "TENSORZERO_CLICKHOUSE_URL=http://chuser:chpassword@clickhouse:8123/tensorzero_ui_fixtures" >> fixtures/.env
echo "TENSORZERO_GATEWAY_URL=http://gateway:3000" >> fixtures/.env
echo "TENSORZERO_GATEWAY_TAG=sha-${{ github.sha }}" >> fixtures/.env
echo "TENSORZERO_GATEWAY_URL=http://gateway:3000" >> fixtures/.env
echo "TENSORZERO_INTERNAL_MOCK_PROVIDER_API=http://mock-provider-api:3030" >> fixtures/.env
echo "TENSORZERO_MOCK_PROVIDER_API_TAG=sha-${{ github.sha }}" >> fixtures/.env
echo "TENSORZERO_UI_TAG=sha-${{ github.sha }}" >> fixtures/.env
echo "TENSORZERO_MOCK_INFERENCE_PROVIDER_TAG=sha-${{ github.sha }}" >> fixtures/.env
# We need these set in the ui container, so that we construct the correct optimizer config
# to pass to 'experimentalLaunchOptimizationWorkflow'
echo "FIREWORKS_BASE_URL=http://mock-inference-provider:3030/fireworks/" >> fixtures/.env
echo "OPENAI_BASE_URL=http://mock-inference-provider:3030/openai/" >> fixtures/.env
echo "TOGETHER_BASE_URL=http://mock-inference-provider:3030/together/" >> fixtures/.env
echo "FIREWORKS_ACCOUNT_ID=fake_fireworks_account" >> fixtures/.env
echo "VITE_TENSORZERO_FORCE_CACHE_ON=1" >> fixtures/.env

- name: Enable authentication in config
Expand Down
Loading
Loading