openai-agents-python/.github/workflows/tests.yml
dependabot[bot] 86bd29878b
fix(deps-dev): bump websockets from 15.0.1 to 16.1.1 (#5484)
* fix(deps-dev): bump websockets from 15.0.1 to 16.1.1

Bumps [websockets](https://github.com/python-websockets/websockets) from 15.0.1 to 16.1.1.
- [Release notes](https://github.com/python-websockets/websockets/releases)
- [Commits](https://github.com/python-websockets/websockets/compare/15.0.1...16.1.1)

---
updated-dependencies:
- dependency-name: websockets
  dependency-version: 16.1.1
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: validate dependency updates against both MCP majors

* test: isolate logging and configure native fixture path grants

* test: isolate function-tool logging assertions from provider defaults

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Justin Beckwith <jbeckwith@openai.com>
2026-11-06 07:51:54 +00:00

496 lines
20 KiB
YAML

name: Tests
on:
push:
branches:
- main
pull_request:
# All PRs, including stacked PRs
merge_group:
types: [checks_requested]
permissions:
contents: read
env:
UV_FROZEN: "1"
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect code changes
id: changes
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
prune-cache: true
python-version: "3.14"
- name: Install dependencies
if: steps.changes.outputs.run == 'true'
run: make sync
- name: Verify formatting
if: steps.changes.outputs.run == 'true'
run: make format-check
- name: Run lint
if: steps.changes.outputs.run == 'true'
run: make lint
- name: Skip lint
if: steps.changes.outputs.run != 'true'
run: echo "Skipping lint for non-code changes."
typecheck:
runs-on: ubuntu-latest
timeout-minutes: 12
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect code changes
id: changes
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
prune-cache: true
python-version: "3.14"
- name: Restore mypy cache
if: steps.changes.outputs.run == 'true'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .mypy_cache
key: mypy-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('uv.lock', 'pyproject.toml', 'Makefile') }}-${{ github.sha }}
restore-keys: |
mypy-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('uv.lock', 'pyproject.toml', 'Makefile') }}-
- name: Install dependencies
if: steps.changes.outputs.run == 'true'
run: make sync
- name: Run typecheck
if: steps.changes.outputs.run == 'true'
run: make typecheck
- name: Skip typecheck
if: steps.changes.outputs.run != 'true'
run: echo "Skipping typecheck for non-code changes."
mypy-win32:
runs-on: ubuntu-latest
timeout-minutes: 12
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect code changes
id: changes
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
prune-cache: true
python-version: "3.14"
- name: Restore mypy cache
if: steps.changes.outputs.run == 'true'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .mypy_cache
key: mypy-win32-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('uv.lock', 'pyproject.toml', 'Makefile') }}-${{ github.sha }}
restore-keys: |
mypy-win32-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('uv.lock', 'pyproject.toml', 'Makefile') }}-
- name: Install dependencies
if: steps.changes.outputs.run == 'true'
run: make sync
- name: Run mypy for Windows
if: steps.changes.outputs.run == 'true'
run: uv run mypy --platform win32 src
- name: Skip Windows mypy
if: steps.changes.outputs.run != 'true'
run: echo "Skipping Windows mypy for non-code changes."
tests:
runs-on: ubuntu-latest
# Python 3.14 also runs coverage and installs Chromium with system dependencies.
timeout-minutes: ${{ matrix.python-version == '3.14' && 30 || 10 }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
env:
OPENAI_API_KEY: fake-for-tests
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect code changes
id: changes
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
prune-cache: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: steps.changes.outputs.run == 'true'
run: make sync
- name: Run tests with coverage
if: steps.changes.outputs.run == 'true' && matrix.python-version == '3.14'
run: make coverage
- name: Test realtime demo in Chromium
if: steps.changes.outputs.run == 'true' && matrix.python-version == '3.14'
run: |
uv run playwright install --with-deps chromium
uv run pytest -o pythonpath=. examples/realtime/app/test_frontend.py
- name: Run tests
if: steps.changes.outputs.run == 'true' && matrix.python-version != '3.14'
run: make tests
- name: Run async teardown stability tests
if: steps.changes.outputs.run == 'true' && (matrix.python-version == '3.10' || matrix.python-version == '3.14')
run: make tests-asyncio-stability
- name: Skip tests
if: steps.changes.outputs.run != 'true'
run: echo "Skipping tests for non-code changes."
containers:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
OPENAI_API_KEY: fake-for-tests
# GitHub-hosted runners are ephemeral, and each test explicitly removes its containers.
TESTCONTAINERS_RYUK_DISABLED: "true"
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect code changes
id: changes
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
prune-cache: true
python-version: "3.14"
- name: Run local container integration tests
if: steps.changes.outputs.run == 'true'
run: make integration-tests-containers
- name: Skip local container integration tests
if: steps.changes.outputs.run != 'true'
run: echo "Skipping local container integration tests for non-code changes."
native-macos-sandbox:
runs-on: macos-latest
timeout-minutes: 15
env:
OPENAI_API_KEY: fake-for-tests
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- name: Detect code changes
id: changes
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: false
python-version: "3.14"
- name: Install dependencies
if: steps.changes.outputs.run == 'true'
run: make sync
- name: Run native macOS sandbox tests
if: steps.changes.outputs.run == 'true'
run: uv run pytest -m requires_native_macos_sandbox
- name: Skip native macOS sandbox tests
if: steps.changes.outputs.run != 'true'
run: echo "Skipping native macOS sandbox tests for non-code changes."
mcp-v2-compat:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
OPENAI_API_KEY: fake-for-tests
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect code changes
id: changes
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
prune-cache: true
python-version: "3.14"
- name: Run MCP v2 unit tests without optional sandbox providers
if: steps.changes.outputs.run == 'true'
run: uv run --frozen --isolated --no-default-groups --group dev --with 'mcp==2.3.0' pytest tests/mcp tests/tracing/test_import_side_effects.py
- name: Skip MCP v2 compatibility tests
if: steps.changes.outputs.run != 'true'
run: echo "Skipping MCP v2 compatibility tests for non-code changes."
mcp-v1-compat:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
OPENAI_API_KEY: fake-for-tests
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect code changes
id: changes
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
prune-cache: true
python-version: "3.14"
- name: Run packaged MCP v1 compatibility tests
if: steps.changes.outputs.run == 'true'
run: make integration-tests-mcp-v1
- name: Skip MCP v1 compatibility tests
if: steps.changes.outputs.run != 'true'
run: echo "Skipping MCP v1 compatibility tests for non-code changes."
packaged-contract-310:
name: packaged-contract (3.10)
needs: prospective-release-contract
if: needs.prospective-release-contract.outputs.run == 'true'
runs-on: ubuntu-latest
env:
OPENAI_AGENTS_INTEGRATION_PYTHON: "3.10"
OPENAI_API_KEY: fake-for-tests
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect code changes
id: changes
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
prune-cache: true
python-version: "3.10"
- name: Download prospective release contract
if: steps.changes.outputs.run == 'true'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: prospective-release-contract
path: .tmp
- name: Run packaged and prospective compatibility contracts
if: steps.changes.outputs.run == 'true'
env:
OPENAI_AGENTS_PROSPECTIVE_RELEASE_CONTRACT: ${{ github.workspace }}/.tmp/prospective_released_api_contract.json
run: make integration-tests-prospective-contract
- name: Skip packaged compatibility contracts
if: steps.changes.outputs.run != 'true'
run: echo "Skipping packaged compatibility contracts for non-code changes."
packaged-contract-314:
name: packaged-contract (3.14)
needs: prospective-release-contract
if: needs.prospective-release-contract.outputs.run == 'true'
runs-on: ubuntu-latest
env:
OPENAI_AGENTS_INTEGRATION_PYTHON: "3.14"
OPENAI_API_KEY: fake-for-tests
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect code changes
id: changes
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
prune-cache: true
python-version: "3.14"
- name: Download prospective release contract
if: steps.changes.outputs.run == 'true'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: prospective-release-contract
path: .tmp
- name: Run packaged and prospective compatibility contracts
if: steps.changes.outputs.run == 'true'
env:
OPENAI_AGENTS_PROSPECTIVE_RELEASE_CONTRACT: ${{ github.workspace }}/.tmp/prospective_released_api_contract.json
run: make integration-tests-prospective-contract
- name: Skip packaged compatibility contracts
if: steps.changes.outputs.run != 'true'
run: echo "Skipping packaged compatibility contracts for non-code changes."
packaged-contract-windows:
needs: prospective-release-contract
if: needs.prospective-release-contract.outputs.run == 'true'
runs-on: windows-latest
timeout-minutes: 15
env:
OPENAI_AGENTS_INTEGRATION_PYTHON: "3.14"
OPENAI_API_KEY: fake-for-tests
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect code changes
id: changes
shell: bash
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
# Disable cache pruning on Windows to avoid intermittent post-job cleanup failures.
prune-cache: false
python-version: "3.14"
- name: Download prospective release contract
if: steps.changes.outputs.run == 'true'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: prospective-release-contract
path: .tmp
- name: Run Windows prospective contract smoke test
if: steps.changes.outputs.run == 'true'
env:
OPENAI_AGENTS_PROSPECTIVE_RELEASE_CONTRACT: ${{ github.workspace }}/.tmp/prospective_released_api_contract.json
run: make integration-tests-prospective-platform
- name: Skip Windows prospective contract smoke test
if: steps.changes.outputs.run != 'true'
run: echo "Skipping Windows prospective contract smoke test for non-code changes."
prospective-release-contract:
outputs:
run: ${{ steps.changes.outputs.run }}
runs-on: ubuntu-latest
timeout-minutes: 10
env:
OPENAI_API_KEY: fake-for-tests
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect code changes
id: changes
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
prune-cache: true
python-version: "3.14"
- name: Install all optional dependencies
if: steps.changes.outputs.run == 'true'
run: make sync
- name: Validate source and generate prospective release contract
if: steps.changes.outputs.run == 'true'
run: make prepare-prospective-released-api-contract
- name: Upload prospective release contract
if: steps.changes.outputs.run == 'true'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: prospective-release-contract
path: .tmp/prospective_released_api_contract.json
if-no-files-found: error
include-hidden-files: true
retention-days: 1
- name: Skip prospective release contract
if: steps.changes.outputs.run != 'true'
run: echo "Skipping prospective release contract for non-code changes."
tests-windows:
runs-on: windows-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# Keep Python 3.13 here because Daytona's locked obstore dependency has no Windows Python 3.14 wheel, so 3.14 builds it from source and exceeds this job's timeout.
python-version:
- "3.10"
- "3.13"
env:
OPENAI_API_KEY: fake-for-tests
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect code changes
id: changes
shell: bash
run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
prune-cache: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: steps.changes.outputs.run == 'true'
run: uv sync --all-extras --all-packages --group dev
- name: Run tests
if: steps.changes.outputs.run == 'true'
run: uv run pytest
- name: Skip tests
if: steps.changes.outputs.run != 'true'
run: echo "Skipping tests for non-code changes."
build-docs:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
OPENAI_API_KEY: fake-for-tests
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Detect docs changes
id: changes
run: ./.github/scripts/detect-changes.sh docs "${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}" "${{ github.sha }}"
- name: Setup uv
if: steps.changes.outputs.run == 'true'
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # setup-uv v9.0.0; uv 0.11.14
with:
version: "0.11.14"
enable-cache: true
prune-cache: true
python-version: "3.14"
- name: Install dependencies
if: steps.changes.outputs.run == 'true'
run: make sync
- name: Build docs
if: steps.changes.outputs.run == 'true'
run: make build-docs
- name: Skip docs build
if: steps.changes.outputs.run != 'true'
run: echo "Skipping docs build for non-docs changes."