Skip to content

Commit 1e8cc1c

Browse files
ddelangeelprans
andauthored
Build linux/macos arm64/aarch64 wheels on native runners (MagicStack#1308)
+ Various CI speedups - Switch to official PyPA build frontend for sdist ref https://pypi.org/project/build/ - Cancel running jobs when a new commit is pushed to a PR ref https://stackoverflow.com/questions/66335225#comment133398800_72408109 - Switch from setup-python to setup-uv ref https://github.com/astral-sh/setup-uv + Pin runner images to avoid CI rot ref https://github.com/MagicStack/asyncpg/actions/runs/22286259051/job/64465189709?pr=1308 failed with: ====================================================================== ERROR: test_tls_version (test_connect.TestSSLConnection) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/runner/work/asyncpg/asyncpg/asyncpg/_testbase/__init__.py", line 92, in wrapper self.loop.run_until_complete(coro) File "/Applications/Xcode_16.4.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/Users/runner/work/asyncpg/asyncpg/tests/test_connect.py", line 2024, in test_tls_version await self.connect( File "/Users/runner/work/asyncpg/asyncpg/asyncpg/connection.py", line 2443, in connect return await connect_utils._connect( File "/Users/runner/work/asyncpg/asyncpg/asyncpg/connect_utils.py", line 1209, in _connect addrs, params, config = _parse_connect_arguments(**kwargs) File "/Users/runner/work/asyncpg/asyncpg/asyncpg/connect_utils.py", line 893, in _parse_connect_arguments addrs, params = _parse_connect_dsn_and_args( File "/Users/runner/work/asyncpg/asyncpg/asyncpg/connect_utils.py", line 798, in _parse_connect_dsn_and_args ssl.minimum_version = _parse_tls_version( File "/Applications/Xcode_16.4.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/ssl.py", line 586, in minimum_version super(SSLContext, SSLContext).minimum_version.__set__(self, value) ValueError: Unsupported protocol version 0x304 + Build Windows ARM64 wheels on native runner --------- Co-authored-by: Elvis Pranskevichus <[email protected]>
1 parent b21325d commit 1e8cc1c

4 files changed

Lines changed: 57 additions & 52 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
validate-release-request:
14-
runs-on: ubuntu-latest
14+
runs-on: ubuntu-24.04
1515
steps:
1616
- name: Validate release PR
1717
uses: edgedb/action-release/validate-pr@master
@@ -44,7 +44,7 @@ jobs:
4444

4545
build-sdist:
4646
needs: validate-release-request
47-
runs-on: ubuntu-latest
47+
runs-on: ubuntu-24.04
4848

4949
env:
5050
PIP_DISABLE_PIP_VERSION_CHECK: 1
@@ -63,8 +63,8 @@ jobs:
6363

6464
- name: Build source distribution
6565
run: |
66-
pip install -U setuptools wheel pip
67-
python setup.py sdist
66+
pip install -U setuptools wheel build
67+
python -m build --sdist
6868
6969
- uses: actions/upload-artifact@v4
7070
with:
@@ -73,7 +73,7 @@ jobs:
7373

7474
build-wheels-matrix:
7575
needs: validate-release-request
76-
runs-on: ubuntu-latest
76+
runs-on: ubuntu-24.04
7777
outputs:
7878
include: ${{ steps.set-matrix.outputs.include }}
7979
steps:
@@ -84,18 +84,26 @@ jobs:
8484
with:
8585
python-version: "3.x"
8686
- name: Install cibuildwheel
87-
run: pip install cibuildwheel==3.3.0
87+
run: pip install cibuildwheel==3.3.1
8888
- name: Build cibuildwheel matrix
8989
id: set-matrix
90+
env:
91+
# skipping pypy for now
92+
CIBW_SKIP: >
93+
pp*
9094
run: |
95+
set -euo pipefail
9196
MATRIX_INCLUDE=$(
9297
{
93-
cibuildwheel --print-build-identifiers --platform linux --archs x86_64,aarch64 | grep cp | jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \
94-
&& cibuildwheel --print-build-identifiers --platform macos --archs x86_64,arm64 | grep cp | jq -nRc '{"only": inputs, "os": "macos-latest"}' \
95-
&& cibuildwheel --print-build-identifiers --platform windows --archs x86,AMD64 | grep cp | jq -nRc '{"only": inputs, "os": "windows-latest"}'
98+
cibuildwheel --print-build-identifiers --platform linux --archs x86_64 | jq -nRc '{"only": inputs, "os": "ubuntu-24.04"}' \
99+
&& cibuildwheel --print-build-identifiers --platform linux --archs aarch64 | jq -nRc '{"only": inputs, "os": "ubuntu-24.04-arm"}' \
100+
&& cibuildwheel --print-build-identifiers --platform macos --archs x86_64 | jq -nRc '{"only": inputs, "os": "macos-15-intel"}' \
101+
&& cibuildwheel --print-build-identifiers --platform macos --archs arm64 | jq -nRc '{"only": inputs, "os": "macos-15"}' \
102+
&& cibuildwheel --print-build-identifiers --platform windows --archs x86,AMD64 | jq -nRc '{"only": inputs, "os": "windows-2025"}' \
103+
&& cibuildwheel --print-build-identifiers --platform windows --archs ARM64 | jq -nRc '{"only": inputs, "os": "windows-11-arm"}'
96104
} | jq -sc
97105
)
98-
echo "include=$MATRIX_INCLUDE" >> $GITHUB_OUTPUT
106+
echo "include=$MATRIX_INCLUDE" >> "$GITHUB_OUTPUT"
99107
100108
build-wheels:
101109
needs: build-wheels-matrix
@@ -125,7 +133,7 @@ jobs:
125133
if: runner.os == 'Linux'
126134
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
127135

128-
- uses: pypa/cibuildwheel@63fd63b352a9a8bdcc24791c9dbee952ee9a8abc # v3.3.0
136+
- uses: pypa/cibuildwheel@298ed2fb2c105540f5ed055e8a6ad78d82dd3a7e # v3.3.1
129137
with:
130138
only: ${{ matrix.only }}
131139
env:
@@ -137,7 +145,7 @@ jobs:
137145
path: wheelhouse/*.whl
138146

139147
merge-artifacts:
140-
runs-on: ubuntu-latest
148+
runs-on: ubuntu-24.04
141149
needs: [build-sdist, build-wheels]
142150
steps:
143151
- name: Merge Artifacts
@@ -148,7 +156,7 @@ jobs:
148156

149157
publish-docs:
150158
needs: [build-sdist, build-wheels]
151-
runs-on: ubuntu-latest
159+
runs-on: ubuntu-24.04
152160

153161
env:
154162
PIP_DISABLE_PIP_VERSION_CHECK: 1
@@ -197,7 +205,7 @@ jobs:
197205

198206
publish:
199207
needs: [build-sdist, build-wheels, publish-docs]
200-
runs-on: ubuntu-latest
208+
runs-on: ubuntu-24.04
201209

202210
environment:
203211
name: pypi
@@ -224,7 +232,7 @@ jobs:
224232
id: relver
225233
run: |
226234
set -e
227-
echo "version=$(cat dist/VERSION)" >> $GITHUB_OUTPUT
235+
echo "version=$(cat dist/VERSION)" >> "$GITHUB_OUTPUT"
228236
rm dist/VERSION
229237
230238
- name: Merge and tag the PR

‎.github/workflows/tests.yml‎

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
branches:
1010
- master
1111

12+
concurrency: # https://stackoverflow.com/questions/66335225#comment133398800_72408109
13+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
14+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15+
1216
jobs:
1317
test-platforms:
1418
# NOTE: this matrix is for testing various combinations of Python and OS
@@ -18,17 +22,20 @@ jobs:
1822
strategy:
1923
matrix:
2024
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "3.15", "3.15t"]
21-
os: [ubuntu-latest, macos-latest, windows-latest]
25+
os: [ubuntu-24.04, macos-15, windows-2025]
2226
loop: [asyncio, uvloop]
2327
exclude:
2428
# uvloop does not support windows
2529
- loop: uvloop
26-
os: windows-latest
30+
os: windows-2025
2731
# The test dependency group excludes uvloop on Python 3.15.
2832
- loop: uvloop
2933
python-version: "3.15"
3034
- loop: uvloop
3135
python-version: "3.15t"
36+
# github does not provide 3.9 cpython for arm64 runners
37+
- python-version: "3.9"
38+
os: macos-15
3239

3340
runs-on: ${{ matrix.os }}
3441

@@ -38,9 +45,6 @@ jobs:
3845
run:
3946
shell: bash
4047

41-
env:
42-
PIP_DISABLE_PIP_VERSION_CHECK: 1
43-
4448
steps:
4549
- uses: actions/checkout@v5
4650
with:
@@ -58,53 +62,44 @@ jobs:
5862
version_line_pattern: |
5963
__version__(?:\s*:\s*typing\.Final)?\s*=\s*(?:['"])([[:PEP440:]])(?:['"])
6064
61-
- name: Setup PostgreSQL
62-
if: "!steps.release.outputs.is_release && matrix.os == 'macos-latest'"
65+
- name: Set up PostgreSQL
66+
if: "!steps.release.outputs.is_release && startsWith(matrix.os, 'macos')"
6367
run: |
6468
POSTGRES_FORMULA="postgresql@18"
6569
brew install "$POSTGRES_FORMULA"
66-
echo "$(brew --prefix "$POSTGRES_FORMULA")/bin" >> $GITHUB_PATH
70+
echo "$(brew --prefix "$POSTGRES_FORMULA")/bin" >> "$GITHUB_PATH"
71+
72+
- name: Set up Kerberos
73+
if: "!steps.release.outputs.is_release && startsWith(matrix.os, 'ubuntu')"
74+
run: .github/workflows/install-krb5.sh
6775

6876
- name: Set up Python ${{ matrix.python-version }}
69-
uses: actions/setup-python@v6
77+
uses: astral-sh/setup-uv@v7
7078
if: "!steps.release.outputs.is_release"
7179
with:
7280
python-version: ${{ matrix.python-version }}
73-
# Track the latest 3.15 build, including prereleases before GA.
74-
allow-prereleases: ${{ startsWith(matrix.python-version, '3.15') }}
75-
check-latest: ${{ startsWith(matrix.python-version, '3.15') }}
81+
activate-environment: true
7682

7783
- name: Install Python Deps
7884
if: "!steps.release.outputs.is_release"
7985
run: |
80-
[ "$RUNNER_OS" = "Linux" ] && .github/workflows/install-krb5.sh
81-
python -m pip install -U pip setuptools wheel
82-
python -m pip install --group test
83-
python -m pip install -e .
86+
uv pip install -e . --group test
8487
8588
- name: Test
8689
if: "!steps.release.outputs.is_release"
8790
env:
88-
LOOP_IMPL: ${{ matrix.loop }}
89-
run: |
90-
if [ "${LOOP_IMPL}" = "uvloop" ]; then
91-
env USE_UVLOOP=1 python -m unittest -v tests.suite
92-
else
93-
python -m unittest -v tests.suite
94-
fi
91+
USE_UVLOOP: ${{ matrix.loop == 'uvloop' && '1' || '' }}
92+
run: python -m unittest -v tests.suite
9593

9694
test-postgres:
9795
strategy:
9896
matrix:
9997
postgres-version: ["9.5", "9.6", "10", "11", "12", "13", "14", "15", "16", "17", "18"]
10098

101-
runs-on: ubuntu-latest
99+
runs-on: ubuntu-24.04
102100

103101
permissions: {}
104102

105-
env:
106-
PIP_DISABLE_PIP_VERSION_CHECK: 1
107-
108103
steps:
109104
- uses: actions/checkout@v5
110105
with:
@@ -133,19 +128,21 @@ jobs:
133128
echo PGINSTALLATION="/usr/lib/postgresql/${PGVERSION}/bin" \
134129
>> "${GITHUB_ENV}"
135130
136-
- name: Set up Python ${{ matrix.python-version }}
137-
uses: actions/setup-python@v6
131+
- name: Set up Kerberos
132+
if: "!steps.release.outputs.is_release"
133+
run: .github/workflows/install-krb5.sh
134+
135+
- name: Set up Python
136+
uses: astral-sh/setup-uv@v7
138137
if: "!steps.release.outputs.is_release"
139138
with:
140-
python-version: "3.x"
139+
python-version: "3.14"
140+
activate-environment: true
141141

142142
- name: Install Python Deps
143143
if: "!steps.release.outputs.is_release"
144144
run: |
145-
[ "$RUNNER_OS" = "Linux" ] && .github/workflows/install-krb5.sh
146-
python -m pip install -U pip setuptools wheel
147-
python -m pip install --group test
148-
python -m pip install -e .
145+
uv pip install -e . --group test
149146
150147
- name: Test
151148
if: "!steps.release.outputs.is_release"
@@ -159,7 +156,7 @@ jobs:
159156
regression-tests:
160157
name: "Regression Tests"
161158
needs: [test-platforms, test-postgres]
162-
runs-on: ubuntu-latest
159+
runs-on: ubuntu-24.04
163160
permissions: {}
164161

165162
steps:

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ docs = [
6363
requires = [
6464
"setuptools>=77.0.3",
6565
"packaging>=24.0",
66-
"Cython(>=3.2.1,<4.0.0)"
66+
"Cython>=3.2.1,<4.0.0"
6767
]
6868
build-backend = "setuptools.build_meta"
6969

‎setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from setuptools.command import build_ext as setuptools_build_ext
2828

2929

30-
CYTHON_DEPENDENCY = 'Cython(>=3.2.1,<4.0.0)'
30+
CYTHON_DEPENDENCY = 'Cython>=3.2.1,<4.0.0'
3131

3232
CFLAGS = ['-O2']
3333
LDFLAGS = []

0 commit comments

Comments
 (0)