test(openai): add vcr regression coverage for stream helpers (#214) #162
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: checks | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| fetch-depth: 0 # Fetch full history for proper diff | |
| - name: Set up mise | |
| uses: jdx/mise-action@5228313ee0372e111a38da051671ca30fc5a96db # v3.6.3 | |
| with: | |
| cache: true | |
| experimental: true | |
| - name: Run pre-commit | |
| run: | | |
| mise exec -- pre-commit run --from-ref origin/${{ github.base_ref || 'main' }} --to-ref HEAD | |
| ensure-pinned-actions: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Ensure SHA pinned actions | |
| uses: zgosalvez/github-actions-ensure-sha-pinned-actions@70c4af2ed5282c51ba40566d026d6647852ffa3e # v5.0.1 | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| os: [ubuntu-latest, windows-latest] | |
| shard: [0, 1] | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Set up mise | |
| uses: jdx/mise-action@5228313ee0372e111a38da051671ca30fc5a96db # v3.6.3 | |
| with: | |
| cache: true | |
| experimental: true | |
| install_args: python@${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| mise exec python@${{ matrix.python-version }} -- make -C py install-dev | |
| - name: Test whether the Python SDK can be installed | |
| run: | | |
| # This is already done by make install-dev, but we're keeping this as a separate step | |
| # to explicitly verify that installation works | |
| mise exec python@${{ matrix.python-version }} -- python -m uv pip install -e ./py[all] | |
| - name: Test whether the Python SDK can be imported | |
| run: | | |
| mise exec python@${{ matrix.python-version }} -- python -c 'import braintrust' | |
| - name: Run nox tests (shard ${{ matrix.shard }}/2) | |
| shell: bash | |
| run: | | |
| mise exec python@${{ matrix.python-version }} -- bash ./py/scripts/nox-matrix.sh ${{ matrix.shard }} 2 | |
| adk-py: | |
| uses: ./.github/workflows/adk-py-test.yaml | |
| langchain-py: | |
| uses: ./.github/workflows/langchain-py-test.yaml | |
| upload-wheel: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Set up mise | |
| uses: jdx/mise-action@5228313ee0372e111a38da051671ca30fc5a96db # v3.6.3 | |
| with: | |
| cache: true | |
| experimental: true | |
| - name: Install build dependencies and build wheel | |
| run: | | |
| mise exec -- make -C py install-build-deps build | |
| - name: Upload wheel as artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: python-wheel | |
| path: py/dist/*.whl | |
| retention-days: 5 | |
| checks-passed: | |
| name: checks-passed | |
| needs: | |
| - lint | |
| - ensure-pinned-actions | |
| - build | |
| - adk-py | |
| - langchain-py | |
| - upload-wheel | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| if: always() | |
| steps: | |
| - name: Verify all required checks passed | |
| run: | | |
| FAILED=0 | |
| check_result() { | |
| local job_name="$1" | |
| local job_result="$2" | |
| if [ "$job_result" != "success" ] && [ "$job_result" != "skipped" ]; then | |
| echo "Job '$job_name' finished with result: $job_result" | |
| FAILED=1 | |
| fi | |
| } | |
| check_result "lint" "${{ needs.lint.result }}" | |
| check_result "ensure-pinned-actions" "${{ needs.ensure-pinned-actions.result }}" | |
| check_result "build" "${{ needs.build.result }}" | |
| check_result "adk-py" "${{ needs.adk-py.result }}" | |
| check_result "langchain-py" "${{ needs.langchain-py.result }}" | |
| check_result "upload-wheel" "${{ needs.upload-wheel.result }}" | |
| if [ "$FAILED" -ne 0 ]; then | |
| echo "One or more required checks failed" | |
| exit 1 | |
| fi | |
| echo "All required checks passed" |