Skip to content

Commit 2f57b6b

Browse files
committed
Use cibuildwheel to build release wheels
1 parent 4f22ad3 commit 2f57b6b

File tree

7 files changed

+65
-107
lines changed

7 files changed

+65
-107
lines changed

.github/workflows/build-manylinux-wheels.sh

-25
This file was deleted.

.github/workflows/release.yml

+50-63
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
mkdir -p dist/
3838
echo "${VERSION}" > dist/VERSION
3939
40-
- uses: actions/upload-artifact@v1
40+
- uses: actions/upload-artifact@v2
4141
with:
4242
name: dist
4343
path: dist/
@@ -47,111 +47,98 @@ jobs:
4747
runs-on: ubuntu-latest
4848

4949
steps:
50-
- uses: actions/checkout@v1
50+
- uses: actions/checkout@v2
5151
with:
5252
fetch-depth: 50
5353
submodules: true
5454

55-
- name: Set up Python 3.7
56-
uses: actions/setup-python@v1
57-
with:
58-
python-version: 3.7
55+
- name: Set up Python
56+
uses: actions/setup-python@v2
5957

6058
- name: Build source distribution
6159
run: |
62-
pip install -U setuptools wheel pip
60+
python -m pip install -U setuptools wheel pip
6361
python setup.py sdist
6462
65-
- uses: actions/upload-artifact@v1
63+
- uses: actions/upload-artifact@v2
6664
with:
6765
name: dist
68-
path: dist/
66+
path: dist/*.tar.*
6967

7068
build-wheels:
7169
needs: validate-release-request
7270
runs-on: ${{ matrix.os }}
7371
strategy:
7472
matrix:
75-
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
76-
os: [ubuntu-20.04, macos-latest, windows-latest]
73+
os: [ubuntu-latest, macos-latest, windows-latest]
74+
cibw_arch: ["auto64", "aarch64", "universal2"]
75+
cibw_python:
76+
- "cp36-*"
77+
- "cp37-*"
78+
- "cp38-*"
79+
- "cp39-*"
80+
- "cp310-*"
7781
exclude:
78-
# Python 3.5 is unable to properly
79-
# find the recent VS tooling
80-
# https://bugs.python.org/issue30389
82+
- os: ubuntu-latest
83+
cibw_arch: universal2
84+
- os: macos-latest
85+
cibw_arch: aarch64
86+
- os: macos-latest
87+
cibw_python: "cp36-*"
88+
cibw_arch: universal2
89+
- os: macos-latest
90+
cibw_python: "cp37-*"
91+
cibw_arch: universal2
92+
- os: windows-latest
93+
cibw_arch: universal2
8194
- os: windows-latest
82-
python-version: 3.5
95+
cibw_arch: aarch64
8396

8497
defaults:
8598
run:
8699
shell: bash
87100

101+
env:
102+
PIP_DISABLE_PIP_VERSION_CHECK: 1
103+
88104
steps:
89-
- uses: actions/checkout@v1
105+
- uses: actions/checkout@v2
90106
with:
91107
fetch-depth: 50
92108
submodules: true
93109

94-
- uses: actions/download-artifact@v1
95-
with:
96-
name: dist
97-
path: dist/
98-
99-
- name: Extract Release Version
100-
id: relver
101-
run: |
102-
set -e
103-
echo ::set-output name=version::$(cat dist/VERSION)
104-
rm dist/*
105-
106-
- name: Set up Python ${{ matrix.python-version }}
107-
uses: actions/setup-python@v1
108-
with:
109-
python-version: ${{ matrix.python-version }}
110-
111-
- name: Install Python Deps
112-
run: |
113-
python -m pip install --upgrade setuptools pip wheel
114-
115-
- name: Build Wheels (linux)
116-
if: startsWith(matrix.os, 'ubuntu')
117-
uses: docker://quay.io/pypa/manylinux1_x86_64
118-
env:
119-
PYTHON_VERSION: ${{ matrix.python-version }}
110+
- name: Set up QEMU
111+
if: matrix.os == 'ubuntu-latest' && matrix.cibw_arch == 'aarch64'
112+
uses: docker/setup-qemu-action@v1
120113
with:
121-
entrypoint: /github/workspace/.github/workflows/build-manylinux-wheels.sh
122-
123-
- name: Build Wheels (non-linux)
124-
if: "!startsWith(matrix.os, 'ubuntu')"
125-
run: |
126-
make clean
127-
python setup.py bdist_wheel
114+
platforms: arm64
128115

129-
- name: Test Wheels
130-
if: |
131-
!startsWith(matrix.os, 'windows')
132-
&& !contains(github.event.pull_request.labels.*.name, 'skip wheel tests')
116+
- uses: pypa/[email protected]
133117
env:
134-
OS: ${{ matrix.os }}
135-
PKG_VERSION: ${{ steps.relver.outputs.version }}
136-
run: |
137-
"${GITHUB_WORKSPACE}/.github/workflows/test-wheels.sh"
138-
139-
- uses: actions/upload-artifact@v1
118+
CIBW_BUILD_VERBOSITY: 1
119+
CIBW_BUILD: ${{ matrix.cibw_python }}
120+
CIBW_ARCHS: ${{ matrix.cibw_arch }}
121+
CIBW_TEST_EXTRAS: "test"
122+
CIBW_TEST_COMMAND: "python {project}/tests/__init__.py"
123+
CIBW_TEST_COMMAND_WINDOWS: "python {project}\\tests\\__init__.py"
124+
CIBW_TEST_SKIP: "*universal2:arm64"
125+
126+
- uses: actions/upload-artifact@v2
140127
with:
141128
name: dist
142-
path: dist/
129+
path: wheelhouse/*.whl
143130

144131
publish:
145132
needs: [build-sdist, build-wheels]
146133
runs-on: ubuntu-latest
147134

148135
steps:
149-
- uses: actions/checkout@v1
136+
- uses: actions/checkout@v2
150137
with:
151138
fetch-depth: 5
152139
submodules: false
153140

154-
- uses: actions/download-artifact@v1
141+
- uses: actions/download-artifact@v2
155142
with:
156143
name: dist
157144
path: dist/
@@ -181,7 +168,7 @@ jobs:
181168
release_name: v${{ steps.relver.outputs.version }}
182169
target: ${{ github.event.pull_request.base.ref }}
183170
body: ${{ github.event.pull_request.body }}
184-
draft: true
171+
draft: false
185172

186173
- run: |
187174
ls -al dist/

.github/workflows/test-wheels.sh

-7
This file was deleted.

.github/workflows/tests.yml

+10-8
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,31 @@ jobs:
1313
build:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
16-
max-parallel: 4
1716
matrix:
18-
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
19-
os: [windows-latest, ubuntu-18.04, macos-latest]
17+
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, 3.10.0-rc.1]
18+
os: [windows-latest, ubuntu-latest, macos-latest]
2019
exclude:
2120
# Python 3.5 is unable to properly
2221
# find the recent VS tooling
2322
# https://bugs.python.org/issue30389
2423
- os: windows-latest
2524
python-version: 3.5
2625

26+
env:
27+
PIP_DISABLE_PIP_VERSION_CHECK: 1
28+
2729
steps:
28-
- uses: actions/checkout@v1
30+
- uses: actions/checkout@v2
2931
with:
3032
fetch-depth: 50
3133
submodules: true
3234

3335
- name: Check if release PR.
3436
uses: edgedb/action-release/validate-pr@master
35-
continue-on-error: true
3637
id: release
3738
with:
3839
github_token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
40+
missing_version_ok: yes
3941
version_file: httptools/_version.py
4042
version_line_pattern: |
4143
__version__\s*=\s*(?:['"])([[:PEP440:]])(?:['"])
@@ -49,6 +51,6 @@ jobs:
4951
- name: Test
5052
if: steps.release.outputs.version == 0
5153
run: |
52-
pip install -U pip setuptools wheel
53-
pip install -e .[test]
54-
python setup.py test
54+
python -m pip install -U pip setuptools wheel
55+
python -m pip install -e .[test]
56+
python -m unittest -v tests.suite

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ def parse_url(url: bytes):
9494
1. Clone this repository with
9595
`git clone --recursive [email protected]:MagicStack/httptools.git`
9696

97-
2. Create a virtual environment with Python 3.5:
98-
`python3.5 -m venv envname`
97+
2. Create a virtual environment with Python 3:
98+
`python3 -m venv envname`
9999

100100
3. Activate the environment with `source envname/bin/activate`
101101

102-
4. Install Cython with `pip install cython`
102+
4. Install development requirements with `pip install -e .[test]`
103103

104104
5. Run `make` and `make test`.
105105

pytest.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[pytest]
2-
addopts = --capture=no --assert=plain --strict --tb native
2+
addopts = --capture=no --assert=plain --strict-markers --tb=native --import-mode=importlib
33
testpaths = tests

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def build_extensions(self):
185185
'Development Status :: 5 - Production/Stable',
186186
],
187187
platforms=['macOS', 'POSIX', 'Windows'],
188+
python_requires='>=3.5.0',
188189
zip_safe=False,
189190
author='Yury Selivanov',
190191
author_email='[email protected]',

0 commit comments

Comments
 (0)