-
Notifications
You must be signed in to change notification settings - Fork 913
133 lines (121 loc) · 5 KB
/
test.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
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
workflow_dispatch:
schedule:
- cron: "0 4 * * *"
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
FORCE_COLOR: "3"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
name: Regular tests / ${{ matrix.platform }} / Python ${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-13, macos-latest, windows-latest]
python-version:
["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.9", "pypy-3.10"]
# TODO: disable nightly NumPy tests for now, re-enable later
# nightly: [[True, "nightly-"], [False, ""]]
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: yezz123/setup-uv@v4
# On PyPy, we skip SciPy because we don't have wheels
# available, see noxfile.py for more details.
- name: Run tests
run: uvx nox -s tests
# In this job, we test against the NumPy nightly wheels hosted on
# https://anaconda.org/scientific-python-nightly-wheels/numpy
# on the latest Python version available across platforms, instead of
# testing all Python versions and implementations on all platforms.
# We do not test on PyPy.
#
# However, "nox -s nightly-tests" can be used locally anywhere, on
# any Python version and implementation on any platform and we leave
# it to the user to decide what Python version to test against, which
# might or might not have a corresponding NumPy nightly wheel present.
nightlies:
name: Nightly tests / ${{ matrix.platform }} / Python ${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-13, macos-latest, windows-latest]
python-version: ["3.x"]
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: yezz123/setup-uv@v4
- name: Run tests against nightly wheels for NumPy and SciPy
run: uvx nox -s nightly-tests
# In this job, we test with the free-threaded (no-GIL) Python 3.13t
# interpreter on all platforms. This is a special job and uses the
# "free-threading" session in noxfile.py. This job is available only
# for Python 3.13t at the time of writing and uses the nightly wheels
# for NumPy and SciPy, since free-threaded builds for either of them
# are not available on PyPI yet.
free-threaded-testing:
name: "Free-threading tests / ${{ matrix.platform }} / Python ${{ matrix.python-version }} / Plugin ${{ matrix.plugin }}"
runs-on: ${{ matrix.platform }}
# Temporarily disable this environment variable to see if this fixes the message as follows:
# "Fatal Python error: config_read_gil: Disabling the GIL is not supported by this build"
# env:
# PYTHON_GIL: "0"
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-13, macos-latest, windows-latest]
python-version: ["3.13t"]
plugin: ["none", "pytest-run-parallel", "pytest-freethreaded"]
steps:
- uses: actions/[email protected]
- uses: Quansight-Labs/setup-python@b9ab292c751a42bcd2bb465b7fa202ea2c3f5796 # v5.3.1
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: yezz123/setup-uv@ab6be5a42627f19dc36e57b548592a5e52cece4a # v4.1
with:
uv-venv: "venv"
# 1. Test suite with free-threading enabled, but no free-threading-specific plugins
- name: Run free-threaded tests on ${{ matrix.platform}}
if: ${{ matrix.plugin == 'none' }}
run: uvx nox -s free-threading
# 2. Test suite with free-threading enabled, plus free-threading-specific plugins
- name: Install dependencies for free-threaded tests with ${{ matrix.plugin }} on ${{ matrix.platform}}
if: ${{ matrix.plugin != 'none' }}
env:
UV_INDEX_URL: "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"
UV_PRERELEASE: "allow"
UV_INDEX_STRATEGY: "first-index"
UV_NO_CACHE: "true"
run: |
python -VV
uv pip install --upgrade --only-binary :all: numpy scipy
- name: Run free-threaded tests with ${{ matrix.plugin }} on ${{ matrix.platform}}
if: ${{ matrix.plugin != 'none' }}
run: |
python -VV
uv pip install -e .
uv pip install pytest ${{ matrix.plugin }}
if [ "${{ matrix.plugin }}" == "pytest-run-parallel" ]; then
PYTHON_GIL="0" pytest --parallel-threads 5
elif [ "${{ matrix.plugin }}" == "pytest-freethreaded" ]; then
PYTHON_GIL="0" pytest --threads 5
fi