Skip to content

Commit 234c8b3

Browse files
committed
cicd/lib-build-and-push: build pypy and native in single blow
1 parent 0fe7832 commit 234c8b3

File tree

3 files changed

+25
-26
lines changed

3 files changed

+25
-26
lines changed

.github/workflows/build-pre-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ on:
1010

1111
target:
1212
type: string
13-
description: "target os to build for: linux,macos,windows"
14-
default: "linux,macos,windows"
13+
description: "target os to build for: linux,macos-x86,macos-arm,windows,linux-aarch64"
14+
default: "linux,macos-x86,macos-arm,windows,linux-aarch64"
1515

1616
jobs:
1717
build-and-publish:

.github/workflows/lib-build-and-push.yml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919
description: "target os to build for: linux,macos,windows"
2020
type: string
2121
required: false
22-
default: "linux,macos,windows"
22+
default: "linux,macos-x86,macos-arm,windows,linux-aarch64"
2323

2424
jobs:
2525
prepare-matrix:
@@ -33,19 +33,27 @@ jobs:
3333
run: |
3434
echo -n "[" > /tmp/matrix.json
3535
was_added=""
36-
for os in $(echo "${{ inputs.target }}" | tr -d " " | tr "," "\n")
36+
for target in $(echo "${{ inputs.target }}" | tr -d " " | tr "," "\n")
3737
do
38-
if [[ "${os}" == "linux" ]]; then
38+
if [[ "${target}" == "linux" ]]; then
3939
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
40-
echo -n '{"os":"ubuntu-20.04","platform":"x86_64"},{"os":"ubuntu-20.04","platform":"PyPy"},{"os":"ubuntu-24.04","platform":"aarch64"}' >> /tmp/matrix.json
40+
echo -n '{"os":"ubuntu-20.04", "target": "linux"}' >> /tmp/matrix.json
4141
was_added=1
42-
elif [[ "${os}" == "windows" ]]; then
42+
elif [[ "${target}" == "linux-aarch64" ]]; then
4343
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
44-
echo -n '{"os":"windows-2022","platform":"win64"},{"os":"windows-2022","platform":"PyPy"}' >> /tmp/matrix.json
44+
echo -n '{"os":"ubuntu-20.04", "target": "linux-aarch64"}' >> /tmp/matrix.json
4545
was_added=1
46-
elif [[ "${os}" == "macos" ]]; then
46+
elif [[ "${target}" == "windows" ]]; then
4747
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
48-
echo -n '{"os":"macos-14","platform":"all"},{"os":"macos-13","platform":"all"},{"os":"macos-14","platform":"PyPy"}' >> /tmp/matrix.json
48+
echo -n '{"os":"windows-2022", "target": "windows"}' >> /tmp/matrix.json
49+
was_added=1
50+
elif [[ "${target}" == "macos-x86" ]]; then
51+
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
52+
echo -n '{"os":"macos-13", "target": "macos-x86"}' >> /tmp/matrix.json
53+
was_added=1
54+
elif [[ "${target}" == "macos-arm" ]]; then
55+
[ -n "$was_added" ] && echo -n "," >> /tmp/matrix.json
56+
echo -n '{"os":"macos-14", "target": "macos-arm"}' >> /tmp/matrix.json
4957
was_added=1
5058
fi
5159
done
@@ -54,7 +62,7 @@ jobs:
5462
echo "matrix=$(cat /tmp/matrix.json)" >> $GITHUB_OUTPUT
5563
5664
build-wheels:
57-
name: Build wheels ${{ matrix.os }} (${{ matrix.platform }})
65+
name: Build wheels for ${{ matrix.target }} on ${{ matrix.os }}
5866
runs-on: ${{ matrix.os }}
5967
needs: prepare-matrix
6068
strategy:
@@ -86,7 +94,7 @@ jobs:
8694
choco install openssl --version=3.4.1 -f -y --no-progress
8795
8896
- name: Set up QEMU
89-
if: runner.os == 'Linux' && matrix.platform == 'aarch64'
97+
if: matrix.target == 'linux-aarch64'
9098
uses: docker/setup-qemu-action@v3
9199
with:
92100
platforms: all
@@ -119,28 +127,19 @@ jobs:
119127
echo "Enforcing target deployment for 14.0"
120128
fi
121129
122-
- name: Set build target
123-
shell: bash
124-
run: |
125-
if [[ "${{ matrix.platform }}" == "PyPy" ]]; then
126-
echo "CIBW_BUILD=pp*" >> $GITHUB_ENV;
127-
else
128-
echo "CIBW_BUILD=cp*" >> $GITHUB_ENV;
129-
fi
130-
131130
- name: Build wheels
132-
if: runner.os != 'Linux' || matrix.platform != 'aarch64'
131+
if: matrix.target != 'linix-aarch64'
133132
run: |
134133
python3 -m cibuildwheel --output-dir wheelhouse
135134
136135
- name: Build wheels
137-
if: runner.os == 'Linux' && matrix.platform == 'aarch64'
136+
if: matrix.target == 'linux-aarch64'
138137
run: |
139-
python -m cibuildwheel --archs aarch64 --output-dir wheelhouse
138+
CIBW_BUILD='cp3*' python -m cibuildwheel --archs aarch64 --output-dir wheelhouse
140139
141140
- uses: actions/upload-artifact@v4
142141
with:
143-
name: wheels-${{ runner.os }}-${{ matrix.platform }}
142+
name: wheels-${{ matrix.target }}-${{ matrix.os }}
144143
path: ./wheelhouse/*.whl
145144

146145
build-sdist:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ test-command = [
109109

110110
[tool.cibuildwheel.macos]
111111
build-frontend = "build"
112-
build = ["cp3*"]
112+
build = ["cp3*", "pp3*"]
113113
test-command = [
114114
"pytest {project}/tests/unit -k 'not (test_multi_timer_validation or test_empty_connections or test_timer_cancellation)'"
115115
]

0 commit comments

Comments
 (0)