Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 5 additions & 77 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,85 +29,13 @@ env:

jobs:
stubtest-stdlib:
name: "stubtest: stdlib"
if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
exclude:
# https://github.com/python/typeshed/issues/15694
- os: "windows-latest"
python-version: "3.10"
fail-fast: false

steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements-tests.txt
allow-prereleases: true
check-latest: true
- name: Install dependencies
run: pip install -r requirements-tests.txt
- name: Run stubtest
run: python tests/stubtest_stdlib.py
uses: $/.github/workflows/stubtest_stdlib.yml

stubtest-third-party:
name: "stubtest: third party"
if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
shard-index: [0, 1, 2, 3]
fail-fast: false
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: "3.13"
cache: pip
cache-dependency-path: |
requirements-tests.txt
stubs/**/METADATA.toml
- name: Install dependencies
run: pip install -r requirements-tests.txt
- name: Install required system packages
shell: bash
run: |
PACKAGES=$(python tests/get_stubtest_system_requirements.py)

if [ "${{ runner.os }}" = "Linux" ]; then
if [ -n "$PACKAGES" ]; then
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
fi
else
if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
brew install -q $PACKAGES
fi

if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then
printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
choco install -y $PACKAGES
fi
fi
- name: Run stubtest
shell: bash
run: |
if [ "${{ runner.os }}" = "Linux" ]; then
PYTHON_EXECUTABLE="xvfb-run python"
else
PYTHON_EXECUTABLE="python"
fi

$PYTHON_EXECUTABLE tests/stubtest_third_party.py --ci-platforms-only --num-shards 4 --shard-index ${{ matrix.shard-index }}
uses: $/.github/workflows/stubtest_third_party.yml
with:
all-stubs: true
sharded: true

stub-uploader:
name: stub_uploader tests
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/stubtest_stdlib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- ".github/workflows/stubtest_stdlib.yml"
- "tests/**"
# When requirements.txt changes, we run `daily.yml`, which includes stdlib stubtest
workflow_call:

permissions:
contents: read
Expand All @@ -21,12 +22,13 @@ env:
TERM: xterm-256color # needed for FORCE_COLOR to work on mypy on Ubuntu, see https://github.com/python/mypy/issues/13817

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
group: stubtest-stdlib-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
stubtest-stdlib:
name: "stubtest: stdlib"
if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down
23 changes: 20 additions & 3 deletions .github/workflows/stubtest_third_party.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ on:
- ".github/workflows/stubtest_third_party.yml"
- "tests/**"
# When requirements.txt changes, we run `daily.yml`, which includes third-party stubtest
workflow_call:
inputs:
all-stubs:
description: "Run on all stubs, not only changed"
required: false
default: false
type: boolean
sharded:
description: "Split the run across 4 shards"
required: false
default: false
type: boolean

permissions:
contents: read
Expand All @@ -22,17 +34,19 @@ env:
TERM: xterm-256color # needed for FORCE_COLOR to work on mypy on Ubuntu, see https://github.com/python/mypy/issues/13817

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
group: stubtest-third-party-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
stubtest-third-party:
name: "stubtest: third party"
if: ${{ github.repository == 'python/typeshed' || github.event_name != 'schedule' }}

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
shard-index: ${{ inputs.sharded && fromJSON('[0, 1, 2, 3]') || fromJSON('[0]') }}
fail-fast: false

steps:
Expand All @@ -49,6 +63,7 @@ jobs:
- name: Install dependencies
run: pip install -r requirements-tests.txt
- name: Determine changed stubs
if: ${{ ! inputs.all-stubs }}
shell: bash
run: |
# This only runs stubtest on changed stubs, because it is much faster.
Expand All @@ -64,7 +79,7 @@ jobs:
- name: Install required system packages
shell: bash
run: |
if [ -n "$STUBS" ]; then
if [ -n "$STUBS" -o "${{ inputs.all-stubs }}" = "true" ]; then
PACKAGES=$(python tests/get_stubtest_system_requirements.py $STUBS)
if [ "${{ runner.os }}" = "Linux" ]; then
if [ -n "$PACKAGES" ]; then
Expand All @@ -88,14 +103,16 @@ jobs:
run: |
if [ -n "$STUBS" ]; then
echo "Testing $STUBS..."
fi

if [ -n "$STUBS" -o "${{ inputs.all-stubs }}" = "true" ]; then
if [ "${{ runner.os }}" = "Linux" ]; then
PYTHON_EXECUTABLE="xvfb-run python"
else
PYTHON_EXECUTABLE="python"
fi

$PYTHON_EXECUTABLE tests/stubtest_third_party.py --ci-platforms-only $STUBS
$PYTHON_EXECUTABLE tests/stubtest_third_party.py --ci-platforms-only --num-shards ${{ inputs.sharded && 4 || 1 }} --shard-index ${{ matrix.shard-index }} $STUBS
else
echo "Nothing to test"
fi
Loading