TypeScript SDK Compatibility V1 E2E Tests 7910/merge by @miguelgrc #4551
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: TypeScript SDK Compatibility V1.x E2E Tests | |
| run-name: "TypeScript SDK Compatibility V1 E2E Tests ${{ github.ref_name }} by @${{ github.actor }}" | |
| permissions: | |
| contents: read | |
| packages: read | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - 'sdks/typescript/**' | |
| - 'apps/opik-backend/**' | |
| - '.github/workflows/typescript_sdk_compatibility_v1_e2e_tests.yml' | |
| push: | |
| branches: | |
| - 'main' | |
| paths: | |
| - 'sdks/typescript/**' | |
| - 'apps/opik-backend/**' | |
| - '.github/workflows/typescript_sdk_compatibility_v1_e2e_tests.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| env: | |
| OPIK_ENABLE_LITELLM_MODELS_MONITORING: False | |
| OPIK_SENTRY_ENABLE: False | |
| OPIK_URL_OVERRIDE: http://localhost:8080 | |
| OPIK_CONSOLE_LOGGING_LEVEL: DEBUG | |
| jobs: | |
| select-matrix: | |
| name: Select Node version matrix | |
| # select-e2e-matrix lists changed files via the PR files API; without | |
| # pull-requests: read that call 403s and fails every job needing this one. | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 2 | |
| outputs: | |
| node_versions: ${{ steps.pick.outputs.versions }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| sparse-checkout: .github/actions/select-e2e-matrix | |
| sparse-checkout-cone-mode: false | |
| - uses: ./.github/actions/select-e2e-matrix | |
| id: pick | |
| with: | |
| all-versions: ${{ vars.NODE_VERSIONS }} | |
| match-regex: '^sdks/typescript/|^\.github/workflows/typescript_sdk_compatibility_v1_e2e_tests\.yml$' | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| build-opik: | |
| # The reusable build workflow pushes images to GHCR; pass down the | |
| # packages: write grant here rather than at the workflow level (a called | |
| # workflow's permissions can only be maintained or reduced from the | |
| # caller's, never elevated). | |
| permissions: | |
| contents: read | |
| packages: write | |
| uses: ./.github/workflows/build_e2e_docker.yaml | |
| run-compatibility-v1-e2e: | |
| needs: [select-matrix, build-opik] | |
| name: TypeScript SDK Compatibility V1.x E2E Tests Node ${{matrix.node_version}} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| # Only the "Publish Test Report" step needs checks/pull-requests write; | |
| # keep them off the workflow-level default (least privilege). | |
| permissions: | |
| contents: read | |
| packages: read | |
| checks: write | |
| pull-requests: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node_version: ${{ fromJSON(needs.select-matrix.outputs.node_versions) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull Docker images from GHCR | |
| env: | |
| TAG: ${{ needs.build-opik.outputs.image_tag }} | |
| run: | | |
| docker pull "ghcr.io/comet-ml/opik/opik-backend:$TAG" | |
| docker pull "ghcr.io/comet-ml/opik/opik-python-backend:$TAG" | |
| docker tag "ghcr.io/comet-ml/opik/opik-backend:$TAG" ghcr.io/comet-ml/opik/opik-backend:latest | |
| docker tag "ghcr.io/comet-ml/opik/opik-python-backend:$TAG" ghcr.io/comet-ml/opik/opik-python-backend:latest | |
| - name: Set up Node.js ${{matrix.node_version}} | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: ${{matrix.node_version}} | |
| - name: Run latest Opik server | |
| env: | |
| OPIK_USAGE_REPORT_ENABLED: false | |
| COMPOSE_BAKE: false | |
| OPIK_BACKEND_PULL_POLICY: never | |
| PYTHON_BACKEND_PULL_POLICY: never | |
| run: | | |
| cd ${{ github.workspace }} | |
| ./opik.sh --backend --port-mapping | |
| - name: Check Opik server availability | |
| shell: bash | |
| run: | | |
| chmod +x ${{ github.workspace }}/tests_end_to_end/installer_utils/*.sh | |
| cd ${{ github.workspace }}/deployment/docker-compose | |
| echo "Check Docker pods are up" | |
| ${{ github.workspace }}/tests_end_to_end/installer_utils/check_docker_compose_pods.sh | |
| echo "Check backend health" | |
| ${{ github.workspace }}/tests_end_to_end/installer_utils/check_backend.sh | |
| - name: Install TypeScript SDK dependencies | |
| working-directory: sdks/typescript | |
| run: npm ci | |
| - name: Build TypeScript SDK | |
| working-directory: sdks/typescript | |
| run: npm run build | |
| - name: Run compatibility V1 tests | |
| working-directory: sdks/typescript | |
| run: | | |
| npm run test:compatibility -- --reporter=default --reporter=junit --outputFile.junit=${{ github.workspace }}/compat_v1_results_node${{matrix.node_version}}.xml | |
| - name: Publish Test Report | |
| uses: EnricoMi/publish-unit-test-result-action/linux@v2 | |
| if: always() | |
| with: | |
| action_fail: true | |
| comment_mode: failures | |
| check_name: "TS SDK Compat V1 E2E Tests - Node ${{matrix.node_version}}" | |
| files: ${{ github.workspace }}/compat_v1_results_node${{matrix.node_version}}.xml | |
| - name: Keep BE log in case of failure | |
| if: failure() | |
| run: | | |
| PROJECT_NAME=$(docker compose ls --format json 2>/dev/null | jq -r '.[].Name' | grep '^opik' | head -1) | |
| CONTAINER="${PROJECT_NAME:-opik}-backend-1" | |
| docker logs "$CONTAINER" > ${{ github.workspace }}/opik-backend_compat_v1_node${{matrix.node_version}}.log 2>&1 || echo "Could not capture logs from $CONTAINER" | |
| - name: Attach BE log | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: opik-backend-compat-v1-log-node${{matrix.node_version}} | |
| path: ${{ github.workspace }}/opik-backend_compat_v1_node${{matrix.node_version}}.log | |
| - name: Stop opik server | |
| if: always() | |
| run: | | |
| cd ${{ github.workspace }} | |
| ./opik.sh --stop |