-
Notifications
You must be signed in to change notification settings - Fork 265
244 lines (232 loc) · 8.54 KB
/
tests.yml
File metadata and controls
244 lines (232 loc) · 8.54 KB
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
name: tests
on: [push, pull_request, workflow_dispatch]
env:
PYTHONHASHSEED: 1042466059
ZOPE_INTERFACE_STRICT_IRO: 1
PYTHONUNBUFFERED: 1
PYTHONDONTWRITEBYTECODE: 1
PYTHONDEVMODE: 1
PYTHONFAULTHANDLER: 1
PIP_UPGRADE_STRATEGY: eager
PIP_NO_WARN_SCRIPT_LOCATION: 1
# Uploading built wheels for releases.
# TWINE_PASSWORD is encrypted and stored directly in the
# repo settings.
TWINE_USERNAME: __token__
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
- "3.14t"
# Recall the macOS and windows builds upload built wheels so all supported versions
# need to run on mac.
os:
- ubuntu-latest
- macos-latest
- windows-latest
- windows-11-arm
exclude:
# 3.10 not available for windows arm
- os: windows-11-arm
python-version: "3.10"
# 3.14t not available for windows arm
- os: windows-11-arm
python-version: "3.14t"
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: setup.py
allow-prereleases: true
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U twine
- name: Install greenlet (non-Mac)
if: ${{ ! startsWith(runner.os, 'Mac') }}
run: |
# setuptools doesn't want you running 'python setup.py' anymore,
# but pip hides all the intersting compiler output by default, and the
# only way to get anything useful out is to ask *everything* to be verbose,
# which is much more junk than we need to wade through, making it hard to
# see what we want. What's the point of having warnings at all if we can't
# see them, though?
python -m pip wheel -v --wheel-dir ./dist .
python -m pip install -U -e ".[test,docs]"
env:
# Ensure we test with assertions enabled.
# As opposed to the manylinux builds, which we distribute and
# thus only use O3 (because Ofast enables fast-math, which has
# process-wide effects), we test with Ofast here, because we
# expect that some people will compile it themselves with that setting.
CPPFLAGS: "-Ofast -UNDEBUG -Wall"
CFLAGS: "-Ofast -UNDEBUG -Wall"
- name: Install greenlet (Mac)
if: startsWith(runner.os, 'Mac')
run: |
python -m pip wheel -v --wheel-dir ./dist .
python -m pip install -U -e ".[test,docs]"
ls -l dist
# Something in the build system isn't detecting that we're building for both,
# so we're getting tagged with just x86_64. Force the universal2 tag.
# (I've verified that the .so files are in fact universal, with both architectures.)
# The macosx_11_0 tag is conservative: At this writing,
# on GHA, Python 3.7/3.8/3.9/3.10 all produce that tag, while
# 3.11/3.12 produce the less restrictive macosx_10_9 tag. (Locally on JAM's mac,
# the official CPython builds produce 10_9 for everything from 3.9 onward.)
wheel tags --remove --platform-tag macosx_11_0_universal2 dist/*whl
env:
# Unlike the above, we are actually distributing these
# wheels, so they need to be built for production use.
CPPFLAGS: "-O3 -flto -ffunction-sections"
CFLAGS: "-O3 -flto -ffunction-sections"
# Build for both architectures
ARCHFLAGS: "-arch x86_64 -arch arm64"
- name: Check greenlet build
if: ${{ ! startsWith(runner.os, 'Windows') }}
run: |
ls -l dist
twine check dist/*
- name: Store greenlet wheel
uses: actions/upload-artifact@v6
with:
name: greenlet-${{ matrix.os }}-${{ matrix.python-version }}.whl
path: dist/*whl
- name: Test
run: |
python -VV
python -c 'import greenlet._greenlet as G; assert G.GREENLET_USE_STANDARD_THREADING'
python -m unittest discover -v greenlet.tests
- name: Doctest
env:
# XXX: On 3.14t, when the thread-local bytecode cache is
# enabled, sphinx crashes on module cleanup: there is a
# reference to pdb.set_trace in ``glob``, and when the
# shutdown sequence tries to clear that value, it segfaults
# dec-reffing it after taking it out of the module dict. The
# object appears to be corrupt, but it is utterly unclear how
# we could have done this. It is 100% reliable on bath Mac and
# Linux. It can be traced down to a very simple doctest
# snippet in greenlet_gc.rst, but running that same snippet
# standalone in a unit test doesn't produce the error.
#
# So this is a temporary workaround.
PYTHON_TLBC: "0"
run: |
sphinx-build -b doctest -d docs/_build/doctrees2 docs docs/_build/doctest2
- name: Lint
if: matrix.python-version == '3.14' && startsWith(runner.os, 'Linux')
# We only need to do this on one version.
# We do this here rather than a separate job to avoid the compilation overhead.
run: |
pip install -U pylint
python -m pylint --rcfile=.pylintrc greenlet
- name: Publish package to PyPI (mac)
# We cannot 'uses: pypa/gh-action-pypi-publish@v1.4.1' because
# that's apparently a container action, and those don't run on
# the Mac.
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && (startsWith(runner.os, 'Mac') || startsWith(runner.os, 'Windows')) }}
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: |
twine upload --skip-existing dist/*
CodeQL:
runs-on: ubuntu-latest
permissions:
# required for all workflows
security-events: write
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
cache: 'pip'
cache-dependency-path: setup.py
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools wheel
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: python, cpp
- name: Install greenlet
run: |
python setup.py build
# - name: Autobuild
# uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
riscv64:
runs-on: ubuntu-latest
name: RiscV 64
steps:
- name: checkout
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build and test greenlet
env:
DOCKER_IMAGE: riscv64/ubuntu:latest
run: bash ./ubuntu-test
manylinux:
runs-on: ubuntu-latest
# We use a regular Python matrix entry to share as much code as possible.
strategy:
matrix:
python-version:
- "3.14"
image:
- manylinux_2_28_x86_64
- manylinux_2_28_aarch64
- manylinux_2_28_ppc64le
- manylinux_2_28_s390x
- musllinux_1_2_x86_64
- musllinux_1_2_aarch64
name: ${{ matrix.image }}
steps:
- name: checkout
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build and test greenlet
env:
DOCKER_IMAGE: quay.io/pypa/${{ matrix.image }}
run: bash ./make-manylinux
- name: Store greenlet wheels
uses: actions/upload-artifact@v6
with:
path: wheelhouse/*whl
name: ${{ matrix.image }}_wheels.zip
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.13.0
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
user: __token__
password: ${{ secrets.TWINE_PASSWORD }}
skip_existing: true
packages_dir: wheelhouse/