Skip to content

Commit 5d3ad4e

Browse files
committed
Switch to ABI3 compatible wheels
1 parent d5d820a commit 5d3ad4e

File tree

13 files changed

+253
-185
lines changed

13 files changed

+253
-185
lines changed

.github/workflows/build.yml

Lines changed: 90 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,31 @@ on:
1212
- published
1313

1414
jobs:
15+
build_test_wheel:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.11"
23+
24+
- name: build
25+
env:
26+
SYSTEMRDL_REQUIRE_BINARY_BUILD: ~
27+
run: |
28+
python -m pip install build
29+
python -m build
30+
31+
- uses: actions/upload-artifact@v4
32+
with:
33+
name: test_wheel
34+
path: dist/*.whl
35+
36+
#-------------------------------------------------------------------------------
1537
test:
38+
needs:
39+
- build_test_wheel
1640
strategy:
1741
matrix:
1842
python-version:
@@ -40,20 +64,25 @@ jobs:
4064
runs-on: ${{ matrix.os }}
4165

4266
steps:
43-
- uses: actions/checkout@v3
67+
- uses: actions/checkout@v4
4468

4569
- name: Set up Python ${{ matrix.python-version }}
4670
uses: actions/setup-python@v4
4771
with:
4872
python-version: ${{ matrix.python-version }}
4973

50-
- name: Install dependencies
74+
- uses: actions/download-artifact@v4
75+
with:
76+
name: test_wheel
77+
path: dist
78+
79+
- name: Install test dependencies
5180
run: |
52-
python -m pip install -U pytest pytest-cov coveralls>=3.0.0 parameterized
81+
python -m pip install -r test/requirements.txt
5382
5483
- name: Install
5584
run: |
56-
python -m pip install .
85+
python -m pip install dist/*.whl
5786
5887
- name: Test
5988
run: |
@@ -67,12 +96,12 @@ jobs:
6796
pytest
6897
6998
- name: Coveralls
70-
if: ${{ matrix.python-version != 3.5 }} # coveralls no longer works well on 3.5
7199
env:
72100
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73101
COVERALLS_PARALLEL: true
74102
run: |
75103
cd test
104+
python -m pip install -U coveralls>=3.0.0
76105
coveralls --service=github
77106
78107
finish_coveralls:
@@ -94,46 +123,61 @@ jobs:
94123
95124
#-------------------------------------------------------------------------------
96125
lint:
126+
needs:
127+
- build_test_wheel
97128
runs-on: ubuntu-latest
98129
steps:
99-
- uses: actions/checkout@v3
130+
- uses: actions/checkout@v4
100131
- name: Set up Python
101132
uses: actions/setup-python@v4
102133
with:
103-
python-version: "3.10"
134+
python-version: "3.11"
104135

105-
- name: Install dependencies
136+
- uses: actions/download-artifact@v4
137+
with:
138+
name: test_wheel
139+
path: dist
140+
141+
- name: Install test dependencies
106142
run: |
107-
python -m pip install -U pylint
143+
python -m pip install -r test/requirements.txt
108144
109145
- name: Install
110146
run: |
111-
python setup.py install
147+
python -m pip install dist/*.whl
112148
113149
- name: Run Lint
114150
run: |
115-
pylint --rcfile test/pylint.rc systemrdl
151+
pylint --rcfile test/pylint.rc src/systemrdl
116152
117153
#-------------------------------------------------------------------------------
118154
mypy:
155+
needs:
156+
- build_test_wheel
119157
runs-on: ubuntu-latest
120158
steps:
121-
- uses: actions/checkout@v3
159+
- uses: actions/checkout@v4
122160
- name: Set up Python
123161
uses: actions/setup-python@v4
124162
with:
125-
python-version: "3.10"
163+
python-version: "3.11"
126164

127-
- name: Install dependencies
165+
- uses: actions/download-artifact@v4
166+
with:
167+
name: test_wheel
168+
path: dist
169+
170+
- name: Install test dependencies
128171
run: |
129-
python -m pip install -U types-Markdown
172+
python -m pip install -r test/requirements.txt
130173
131-
# Exclude version due to: https://github.com/python/mypy/issues/16770
132-
python -m pip install -U "mypy != 1.8.0"
174+
- name: Install
175+
run: |
176+
python -m pip install dist/*.whl
133177
134178
- name: Type Check
135179
run: |
136-
mypy --config-file test/mypy.ini systemrdl
180+
mypy --config-file test/mypy.ini src/systemrdl
137181
138182
#-------------------------------------------------------------------------------
139183
build_wheels:
@@ -149,47 +193,40 @@ jobs:
149193
os:
150194
- windows-latest
151195
- macos-latest
196+
- ubuntu-latest
152197
include:
153198
# Only build CPython 3.x targets
154199
- cibw_build: "cp3*"
155-
cibw_skip: ""
156-
name_suffix: ""
157-
158-
# Parallelize Linux builds because there are many!
159-
- os: ubuntu-latest
160-
name_suffix: "manylinux_x86_64"
161-
cibw_build: "cp3*-manylinux_x86_64"
162-
cibw_skip: ""
163-
- os: ubuntu-latest
164-
name_suffix: "manylinux_i686"
165-
cibw_build: "cp3*-manylinux_i686"
166-
cibw_skip: ""
167-
- os: ubuntu-latest
168-
name_suffix: "musllinux_x86_64"
169-
cibw_build: "cp3*-musllinux_x86_64"
170-
cibw_skip: ""
171-
- os: ubuntu-latest
172-
name_suffix: "others"
173-
cibw_build: "cp3*"
174-
cibw_skip: "cp3*-{manylinux_x86_64,manylinux_i686,musllinux_x86_64}"
175-
176200

177201
steps:
178-
- uses: actions/checkout@v3
202+
- uses: actions/checkout@v4
179203

180204
- name: Build wheels
181-
uses: pypa/cibuildwheel@v2.16.5
205+
uses: pypa/cibuildwheel@v2.22.0
182206
env:
183-
CIBW_BUILD: ${{ matrix.cibw_build }}
184-
CIBW_SKIP: ${{ matrix.cibw_skip }}
207+
# Only build CPython ABI3 targets
208+
CIBW_BUILD: "cp3*-abi3-*"
185209
# Ensure full C++17 availability on macOS builds
186210
MACOSX_DEPLOYMENT_TARGET: "10.13"
187211
# Signal setup.py to fail if binary build fails
188212
SYSTEMRDL_REQUIRE_BINARY_BUILD: ~
189213

214+
- name: Set up Python
215+
uses: actions/setup-python@v4
216+
with:
217+
python-version: "3.11"
218+
219+
- name: Install dependencies
220+
run: |
221+
python -m pip install abi3audit
222+
223+
- name: ABI3 audit
224+
run: |
225+
abi3audit --debug --verbose --summary --strict wheelhouse/*.whl
226+
190227
- uses: actions/upload-artifact@v4
191228
with:
192-
name: whl-${{ matrix.os }}${{ matrix.name_suffix }}
229+
name: release-dist-whl-${{ matrix.os }}-${{ strategy.job-index }}
193230
path: ./wheelhouse/*.whl
194231

195232
#-------------------------------------------------------------------------------
@@ -201,19 +238,23 @@ jobs:
201238
name: Build source distribution
202239
runs-on: ubuntu-latest
203240
steps:
204-
- uses: actions/checkout@v3
241+
- uses: actions/checkout@v4
205242

206243
- uses: actions/setup-python@v4
207244
name: Install Python
208245
with:
209-
python-version: "3.10"
246+
python-version: "3.11"
247+
248+
- name: Install dependencies
249+
run: |
250+
python -m pip install build
210251
211252
- name: Build sdist
212-
run: python setup.py sdist
253+
run: python -m build --sdist
213254

214255
- uses: actions/upload-artifact@v4
215-
name: sdist
216256
with:
257+
name: release-dist-sdist
217258
path: dist/*.tar.gz
218259

219260
#-------------------------------------------------------------------------------
@@ -229,6 +270,7 @@ jobs:
229270
steps:
230271
- uses: actions/download-artifact@v4
231272
with:
273+
pattern: release-dist-*
232274
path: dist
233275

234276
- uses: pypa/gh-action-pypi-publish@release/v1

MANIFEST.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
include LICENSE
2-
include LICENSE-3RD-PARTY
3-
include systemrdl/preprocessor/ppp_runner.pl
4-
include systemrdl/py.typed
5-
recursive-include systemrdl/parser/ext *
61
recursive-exclude test *
2+
recursive-exclude docs *
3+
recursive-exclude examples *
4+
recursive-exclude .github *

setup.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file is only required for Python3.6 build compatibility with pyproject.toml
2+
[metadata]
3+
name = systemrdl-compiler
4+
version = attr: systemrdl.__about__.__version__
5+
6+
[options]
7+
package_dir=
8+
=src

setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,20 @@ def run_setup(with_binary):
3030
sources=get_files("src/systemrdl/parser/ext", "*.cpp"),
3131
depends=get_files("src/systemrdl/parser/ext", "*.h"),
3232

33-
extra_compile_args=extra_compile_args.get(target, [])
33+
extra_compile_args=extra_compile_args.get(target, []),
34+
define_macros=[("Py_LIMITED_API", "0x03060000")],
35+
py_limited_api=True,
3436
)
3537
ext_modules = [parser_ext]
38+
options = {"bdist_wheel": {"py_limited_api": "cp36"}}
3639
else:
3740
ext_modules = []
41+
options = {}
3842

3943
setuptools.setup(
4044
ext_modules=ext_modules,
4145
cmdclass={"build_ext": ve_build_ext},
46+
options=options,
4247
)
4348

4449

@@ -89,6 +94,9 @@ def build_extension(self, ext):
8994
# Force using fallback python parser under some conditions
9095
using_fallback = is_jython or is_pypy or is_old_python
9196

97+
if 'SYSTEMRDL_SKIP_BINARY_BUILD' in os.environ:
98+
using_fallback = True
99+
92100
if not using_fallback:
93101
try:
94102
run_setup(with_binary=True)

0 commit comments

Comments
 (0)