Otel judgment.agent #1306
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: CI | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
permissions: read-all | |
jobs: | |
validate-branch: | |
uses: ./.github/workflows/merge-branch-check.yaml | |
run-tests: | |
needs: [validate-branch] | |
if: needs.validate-branch.result == 'success' || needs.validate-branch.result == 'skipped' | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: | |
- "3.11" | |
name: Unit Tests | |
runs-on: ${{ matrix.os }} | |
env: | |
PYTHONPATH: "." | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }} | |
JUDGMENT_DEV: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install uv | |
uv sync --dev | |
- name: Run tests | |
run: | | |
cd src | |
uv run pytest tests | |
run-e2e-tests-staging: | |
needs: [validate-branch] | |
if: "github.base_ref == 'staging' && !contains(github.actor, '[bot]') && (needs.validate-branch.result == 'success' || needs.validate-branch.result == 'skipped')" | |
name: Staging E2E Tests | |
runs-on: ubuntu-latest | |
env: | |
TEST_TIMEOUT_SECONDS: ${{ secrets.TEST_TIMEOUT_SECONDS }} | |
steps: | |
- name: Wait for turn | |
uses: softprops/turnstyle@v2 | |
with: | |
poll-interval-seconds: 10 | |
same-branch-only: false | |
job-to-wait-for: "Staging E2E Tests" | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-west-1 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install judgeval dependencies | |
run: | | |
pip install uv | |
uv sync --dev | |
- name: Check if server is running | |
run: | | |
if ! curl -s https://staging.api.judgmentlabs.ai/health > /dev/null; then | |
echo "Staging Judgment server is not running properly. Check logs on AWS CloudWatch for more details." | |
exit 1 | |
else | |
echo "Staging server is running." | |
fi | |
- name: Run E2E tests | |
working-directory: src | |
run: | | |
SECRET_VARS=$(aws secretsmanager get-secret-value --secret-id gh-actions-stg-judgeval/api-keys/judgeval --query SecretString --output text) | |
export $(echo "$SECRET_VARS" | jq -r 'to_entries | .[] | "\(.key)=\(.value)"') | |
timeout ${TEST_TIMEOUT_SECONDS}s uv run pytest --durations=0 --cov=. --cov-config=.coveragerc --cov-report=html ./e2etests | |
- name: Upload coverage HTML report (staging) | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-html-staging | |
path: src/htmlcov | |
run-e2e-tests-main: | |
needs: [validate-branch] | |
if: "github.base_ref == 'main' && !contains(github.actor, '[bot]') && needs.validate-branch.result == 'success'" | |
name: Production E2E Tests | |
runs-on: ubuntu-latest | |
env: | |
TEST_TIMEOUT_SECONDS: ${{ secrets.TEST_TIMEOUT_SECONDS }} | |
steps: | |
- name: Wait for turn | |
uses: softprops/turnstyle@v2 | |
with: | |
poll-interval-seconds: 10 | |
same-branch-only: false | |
job-to-wait-for: "Production E2E Tests" | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-west-1 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install judgeval dependencies | |
run: | | |
pip install uv | |
uv sync --dev | |
- name: Check if server is running | |
run: | | |
if ! curl -s https://api.judgmentlabs.ai/health > /dev/null; then | |
echo "Production Judgment server is not running properly. Check logs on AWS CloudWatch for more details." | |
exit 1 | |
else | |
echo "Production server is running." | |
fi | |
- name: Run E2E tests | |
working-directory: src | |
run: | | |
SECRET_VARS=$(aws secretsmanager get-secret-value --secret-id gh-actions-judgeval/api-keys/judgeval --query SecretString --output text) | |
export $(echo "$SECRET_VARS" | jq -r 'to_entries | .[] | "\(.key)=\(.value)"') | |
timeout ${TEST_TIMEOUT_SECONDS}s uv run pytest --durations=0 --cov=. --cov-config=.coveragerc --cov-report=html ./e2etests | |
- name: Upload coverage HTML report (production) | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-html-production | |
path: src/htmlcov |