Third-party tests #582
This file contains 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
# This workflow is a daily cron job, | |
# running the tests of various third-party libraries that use us. | |
# This helps us spot regressions early, | |
# and helps flag when third-party libraries are making incorrect assumptions | |
# that might cause them to break when we cut a new release. | |
name: Third-party tests | |
on: | |
schedule: | |
- cron: "30 2 * * *" # 02:30 UTC | |
pull_request: | |
paths: | |
- ".github/workflows/third_party.yml" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
FORCE_COLOR: 1 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
pydantic: | |
name: pydantic tests | |
if: >- | |
# if 'schedule' was the trigger, | |
# don't run it on contributors' forks | |
${{ | |
github.event_name != 'schedule' | |
|| ( | |
github.repository == 'python/typing_extensions' | |
&& github.event_name == 'schedule' | |
) | |
}} | |
strategy: | |
fail-fast: false | |
matrix: | |
# PyPy is deliberately omitted here, | |
# since pydantic's tests intermittently segfault on PyPy, | |
# and it's nothing to do with typing_extensions | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout pydantic | |
uses: actions/checkout@v4 | |
with: | |
repository: pydantic/pydantic | |
- name: Checkout typing_extensions | |
uses: actions/checkout@v4 | |
with: | |
path: typing-extensions-latest | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
run: uv python install ${{ matrix.python-version }} | |
- name: Add local version of typing_extensions as a dependency | |
run: uv add --editable ./typing-extensions-latest | |
- name: Install pydantic test dependencies | |
run: uv sync --group dev | |
- name: List installed dependencies | |
run: uv pip list | |
- name: Run pydantic tests | |
run: uv run pytest | |
typing_inspect: | |
name: typing_inspect tests | |
if: >- | |
# if 'schedule' was the trigger, | |
# don't run it on contributors' forks | |
${{ | |
github.event_name != 'schedule' | |
|| ( | |
github.repository == 'python/typing_extensions' | |
&& github.event_name == 'schedule' | |
) | |
}} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout typing_inspect | |
uses: actions/checkout@v4 | |
with: | |
repository: ilevkivskyi/typing_inspect | |
path: typing_inspect | |
- name: Checkout typing_extensions | |
uses: actions/checkout@v4 | |
with: | |
path: typing-extensions-latest | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install uv | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Install typing_inspect test dependencies | |
run: | | |
set -x | |
cd typing_inspect | |
uv pip install --system -r test-requirements.txt --exclude-newer $(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD) | |
- name: Install typing_extensions latest | |
run: uv pip install --system "typing-extensions @ ./typing-extensions-latest" | |
- name: List all installed dependencies | |
run: uv pip freeze | |
- name: Run typing_inspect tests | |
run: | | |
cd typing_inspect | |
pytest | |
pyanalyze: | |
name: pyanalyze tests | |
if: >- | |
# if 'schedule' was the trigger, | |
# don't run it on contributors' forks | |
${{ | |
github.event_name != 'schedule' | |
|| ( | |
github.repository == 'python/typing_extensions' | |
&& github.event_name == 'schedule' | |
) | |
}} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Check out pyanalyze | |
uses: actions/checkout@v4 | |
with: | |
repository: quora/pyanalyze | |
path: pyanalyze | |
- name: Checkout typing_extensions | |
uses: actions/checkout@v4 | |
with: | |
path: typing-extensions-latest | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Install uv | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Install pyanalyze test requirements | |
run: | | |
set -x | |
cd pyanalyze | |
uv pip install --system 'pyanalyze[tests] @ .' --exclude-newer $(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD) | |
- name: Install typing_extensions latest | |
run: uv pip install --system "typing-extensions @ ./typing-extensions-latest" | |
- name: List all installed dependencies | |
run: uv pip freeze | |
- name: Run pyanalyze tests | |
run: | | |
cd pyanalyze | |
pytest pyanalyze/ | |
typeguard: | |
name: typeguard tests | |
if: >- | |
# if 'schedule' was the trigger, | |
# don't run it on contributors' forks | |
${{ | |
github.event_name != 'schedule' | |
|| ( | |
github.repository == 'python/typing_extensions' | |
&& github.event_name == 'schedule' | |
) | |
}} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Check out typeguard | |
uses: actions/checkout@v4 | |
with: | |
repository: agronholm/typeguard | |
path: typeguard | |
- name: Checkout typing_extensions | |
uses: actions/checkout@v4 | |
with: | |
path: typing-extensions-latest | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Install uv | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Install typeguard test requirements | |
run: | | |
set -x | |
cd typeguard | |
uv pip install --system "typeguard[test] @ ." --exclude-newer $(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD) | |
- name: Install typing_extensions latest | |
run: uv pip install --system "typing-extensions @ ./typing-extensions-latest" | |
- name: List all installed dependencies | |
run: uv pip freeze | |
- name: Run typeguard tests | |
run: | | |
cd typeguard | |
export PYTHON_COLORS=0 # A test fails if tracebacks are colorized | |
pytest | |
typed-argument-parser: | |
name: typed-argument-parser tests | |
if: >- | |
# if 'schedule' was the trigger, | |
# don't run it on contributors' forks | |
${{ | |
github.event_name != 'schedule' | |
|| ( | |
github.repository == 'python/typing_extensions' | |
&& github.event_name == 'schedule' | |
) | |
}} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Check out typed-argument-parser | |
uses: actions/checkout@v4 | |
with: | |
repository: swansonk14/typed-argument-parser | |
path: typed-argument-parser | |
- name: Checkout typing_extensions | |
uses: actions/checkout@v4 | |
with: | |
path: typing-extensions-latest | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install uv | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Configure git for typed-argument-parser tests | |
# typed-argument parser does this in their CI, | |
# and the tests fail unless we do this | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Your Name" | |
- name: Install typed-argument-parser test requirements | |
run: | | |
set -x | |
cd typed-argument-parser | |
uv pip install --system "typed-argument-parser @ ." --exclude-newer $(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD) | |
uv pip install --system pytest --exclude-newer $(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD) | |
- name: Install typing_extensions latest | |
run: uv pip install --system "typing-extensions @ ./typing-extensions-latest" | |
- name: List all installed dependencies | |
run: uv pip freeze | |
- name: Run typed-argument-parser tests | |
run: | | |
cd typed-argument-parser | |
pytest | |
mypy: | |
name: stubtest & mypyc tests | |
if: >- | |
# if 'schedule' was the trigger, | |
# don't run it on contributors' forks | |
${{ | |
github.event_name != 'schedule' | |
|| ( | |
github.repository == 'python/typing_extensions' | |
&& github.event_name == 'schedule' | |
) | |
}} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout mypy for stubtest and mypyc tests | |
uses: actions/checkout@v4 | |
with: | |
repository: python/mypy | |
path: mypy | |
- name: Checkout typing_extensions | |
uses: actions/checkout@v4 | |
with: | |
path: typing-extensions-latest | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Install uv | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Install mypy test requirements | |
run: | | |
set -x | |
cd mypy | |
uv pip install --system -r test-requirements.txt --exclude-newer $(git show -s --date=format:'%Y-%m-%dT%H:%M:%SZ' --format=%cd HEAD) | |
uv pip install --system -e . | |
- name: Install typing_extensions latest | |
run: uv pip install --system "typing-extensions @ ./typing-extensions-latest" | |
- name: List all installed dependencies | |
run: uv pip freeze | |
- name: Run stubtest & mypyc tests | |
run: | | |
cd mypy | |
pytest -n 2 ./mypy/test/teststubtest.py ./mypyc/test/test_run.py ./mypyc/test/test_external.py | |
cattrs: | |
name: cattrs tests | |
if: >- | |
# if 'schedule' was the trigger, | |
# don't run it on contributors' forks | |
${{ | |
github.event_name != 'schedule' | |
|| ( | |
github.repository == 'python/typing_extensions' | |
&& github.event_name == 'schedule' | |
) | |
}} | |
strategy: | |
fail-fast: false | |
matrix: | |
# skip 3.13 because msgspec doesn't support 3.13 yet | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout cattrs | |
uses: actions/checkout@v4 | |
with: | |
repository: python-attrs/cattrs | |
- name: Checkout typing_extensions | |
uses: actions/checkout@v4 | |
with: | |
path: typing-extensions-latest | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install pdm for cattrs | |
run: pip install pdm | |
- name: Add latest typing-extensions as a dependency | |
run: | | |
pdm remove typing-extensions | |
pdm add --dev ./typing-extensions-latest | |
- name: Install cattrs test dependencies | |
run: pdm install --dev -G :all | |
- name: List all installed dependencies | |
run: pdm list -vv | |
- name: Run cattrs tests | |
run: pdm run pytest tests | |
create-issue-on-failure: | |
name: Create an issue if daily tests failed | |
runs-on: ubuntu-latest | |
needs: | |
- pydantic | |
- typing_inspect | |
- pyanalyze | |
- typeguard | |
- typed-argument-parser | |
- mypy | |
- cattrs | |
if: >- | |
${{ | |
github.repository == 'python/typing_extensions' | |
&& always() | |
&& github.event_name == 'schedule' | |
&& ( | |
needs.pydantic.result == 'failure' | |
|| needs.typing_inspect.result == 'failure' | |
|| needs.pyanalyze.result == 'failure' | |
|| needs.typeguard.result == 'failure' | |
|| needs.typed-argument-parser.result == 'failure' | |
|| needs.mypy.result == 'failure' | |
|| needs.cattrs.result == 'failure' | |
) | |
}} | |
permissions: | |
issues: write | |
steps: | |
- uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
await github.rest.issues.create({ | |
owner: "python", | |
repo: "typing_extensions", | |
title: `Third-party tests failed on ${new Date().toDateString()}`, | |
body: "Full history of runs listed here: https://github.com/python/typing_extensions/actions/workflows/third_party.yml", | |
}) |