-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
192 lines (181 loc) · 6.96 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Test
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
paths-ignore:
- "**/*.md"
- "scripts/**"
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:
typeshed-structure:
name: Check typeshed structure
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/check_typeshed_structure.py
pytype:
name: Run pytype against the stubs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
# Max supported Python version as of pytype 2024.9.13
python-version: "3.12"
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- name: Install external dependencies for 3rd-party stubs
run: |
mapfile -t DEPENDENCIES < <( python tests/get_external_stub_requirements.py )
if [ -n "$DEPENDENCIES" ]; then
echo "Installing packages:"
for DEP in "${DEPENDENCIES[@]}"; do echo " ${DEP}"; done
uv pip install "${DEPENDENCIES[@]}" --system
fi
- run: uv pip freeze
- run: ./tests/pytype_test.py --print-stderr
mypy:
name: Run mypy against the stubs
runs-on: ubuntu-latest
strategy:
matrix:
platform: ["linux", "win32", "darwin"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=${{ matrix.python-version }}
# Run this as a separate job, as the other versions in the matrix are
# (and should be) run *using* the Python version we're testing the stubs for,
# but we can't install all our non-types dependencies on py313 yet
mypy-313:
name: Run mypy against the 3.13 stubs
runs-on: ubuntu-latest
strategy:
matrix:
platform: ["linux", "win32", "darwin"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
allow-prereleases: true
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=3.13
regression-tests:
name: Run mypy on the test cases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
# Use py311 for now, as py312 seems to be around 30s slower in CI
# TODO: figure out why that is (#11590)
python-version: "3.11"
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install -r requirements-tests.txt --system
- run: python ./tests/regr_test.py --all --verbosity QUIET
pyright:
name: Test typeshed with pyright
runs-on: ubuntu-latest
strategy:
matrix:
python-platform: ["Linux", "Windows", "Darwin"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install typeshed test-suite requirements
# Install these so we can run `get_external_stub_requirements.py`
run: uv pip install -r requirements-tests.txt --system
- name: Create an isolated venv for testing
run: uv venv .venv
- name: Install 3rd-party stub dependencies
run: |
mapfile -t DEPENDENCIES < <( python tests/get_external_stub_requirements.py )
if [ -n "$DEPENDENCIES" ]; then
echo "Installing packages:"
for DEP in "${DEPENDENCIES[@]}"; do echo " ${DEP}"; done
# TODO: We need to specify the platform here, but the platforms
# strings supported by uv are different from the ones supported by
# pyright.
uv pip install --python-version ${{ matrix.python-version }} "${DEPENDENCIES[@]}"
fi
- name: Activate the isolated venv for the rest of the job
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: List 3rd-party stub dependencies installed
run: uv pip freeze
- name: Run pyright with basic settings on all the stubs
uses: jakebailey/pyright-action@v2
with:
version: PATH
python-platform: ${{ matrix.python-platform }}
python-version: ${{ matrix.python-version }}
annotate: ${{ matrix.python-version == '3.12' && matrix.python-platform == 'Linux' }} # Having each job create the same comment is too noisy.
- name: Run pyright with stricter settings on some of the stubs
uses: jakebailey/pyright-action@v2
with:
version: PATH
python-platform: ${{ matrix.python-platform }}
python-version: ${{ matrix.python-version }}
annotate: ${{ matrix.python-version == '3.12' && matrix.python-platform == 'Linux' }} # Having each job create the same comment is too noisy.
project: ./pyrightconfig.stricter.json
- name: Run pyright on the test cases
uses: jakebailey/pyright-action@v2
with:
version: PATH
python-platform: ${{ matrix.python-platform }}
python-version: ${{ matrix.python-version }}
annotate: ${{ matrix.python-version == '3.12' && matrix.python-platform == 'Linux' }} # Having each job create the same comment is too noisy.
project: ./pyrightconfig.testcases.json
stub-uploader:
name: Run the stub_uploader tests
runs-on: ubuntu-latest
steps:
- name: Checkout typeshed
uses: actions/checkout@v4
with:
path: typeshed
- name: Checkout stub_uploader
uses: actions/checkout@v4
with:
repository: typeshed-internal/stub_uploader
path: stub_uploader
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Run tests
run: |
cd stub_uploader
uv pip install -r requirements.txt --system
python -m pytest tests