Skip to content

Commit 98098af

Browse files
committed
automatically exclude unsupported versions
1 parent f756754 commit 98098af

File tree

2 files changed

+46
-4
lines changed

2 files changed

+46
-4
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,24 +218,52 @@ jobs:
218218
os: [ubuntu-20.04, macos-13, windows-latest]
219219
# some versions of python can't be tested on GHA with osx because of SIP:
220220
exclude:
221+
- os: windows-latest
222+
python-version: 3.6.15
223+
- os: windows-latest
224+
python-version: 3.7.17
225+
- os: windows-latest
226+
python-version: 3.8.18
227+
- os: windows-latest
228+
python-version: 3.9.20
229+
- os: windows-latest
230+
python-version: 3.10.15
221231
- os: macos-13
222232
python-version: 3.11.10
233+
- os: windows-latest
234+
python-version: 3.11.10
223235
- os: macos-13
224236
python-version: 3.12.0
237+
- os: windows-latest
238+
python-version: 3.12.0
225239
- os: macos-13
226240
python-version: 3.12.1
241+
- os: windows-latest
242+
python-version: 3.12.1
227243
- os: macos-13
228244
python-version: 3.12.2
245+
- os: windows-latest
246+
python-version: 3.12.2
229247
- os: macos-13
230248
python-version: 3.12.3
249+
- os: windows-latest
250+
python-version: 3.12.3
231251
- os: macos-13
232252
python-version: 3.12.4
253+
- os: windows-latest
254+
python-version: 3.12.4
233255
- os: macos-13
234256
python-version: 3.12.5
257+
- os: windows-latest
258+
python-version: 3.12.5
235259
- os: macos-13
236260
python-version: 3.12.6
261+
- os: windows-latest
262+
python-version: 3.12.6
237263
- os: macos-13
238264
python-version: 3.12.7
265+
- os: windows-latest
266+
python-version: 3.12.7
239267

240268
steps:
241269
- uses: actions/checkout@v2

ci/update_python_test_versions.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ def parse_version(v):
1414

1515
def get_github_python_versions():
1616
versions_json = requests.get(_VERSIONS_URL).json()
17-
raw_versions = [v["version"] for v in versions_json]
1817

18+
# windows platform support isn't great for older versions of python
19+
# get a map of version: platform/arch so we can exclude here
20+
platforms = {}
21+
for v in versions_json:
22+
platforms[v["version"]] = set((f["platform"], f["arch"]) for f in v["files"])
23+
24+
raw_versions = [v["version"] for v in versions_json]
1925
minor_versions = defaultdict(list)
2026

2127
for version_str in raw_versions:
@@ -46,11 +52,13 @@ def get_github_python_versions():
4652

4753
versions.extend(f"{major}.{minor}.{patch}" for patch in patches)
4854

49-
return versions
55+
return versions, platforms
5056

5157

5258
def update_python_test_versions():
53-
versions = sorted(get_github_python_versions(), key=parse_version)
59+
versions, platforms = get_github_python_versions()
60+
versions = sorted(versions, key=parse_version)
61+
5462
build_yml_path = (
5563
pathlib.Path(__file__).parent.parent / ".github" / "workflows" / "build.yml"
5664
)
@@ -82,9 +90,15 @@ def update_python_test_versions():
8290
# since it currently fails in GHA on SIP errors
8391
exclusions = []
8492
for v in versions:
85-
if v.startswith("3.11.10") or v.startswith("3.12"):
93+
# if we don't have a python version for osx/windows skip
94+
if ("darwin", "x64") not in platforms[v] or v.startswith("3.12"):
8695
exclusions.append(" - os: macos-13\n")
8796
exclusions.append(f" python-version: {v}\n")
97+
98+
if ("win32", "x64") not in platforms[v] or v.startswith("3.12"):
99+
exclusions.append(" - os: windows-latest\n")
100+
exclusions.append(f" python-version: {v}\n")
101+
88102
first_exclude_line = lines.index(" exclude:\n", first_line)
89103
last_exclude_line = lines.index("\n", first_exclude_line)
90104
lines = lines[: first_exclude_line + 1] + exclusions + lines[last_exclude_line:]

0 commit comments

Comments
 (0)