Skip to content

Commit 92dde44

Browse files
authored
Merge pull request #107 from maerteijn/feature/musl-wheels-improve-build-matrix
Build musl wheels, test wheels on all platforms
2 parents e05a3c5 + de88a7e commit 92dde44

4 files changed

Lines changed: 188 additions & 79 deletions

File tree

.github/workflows/debug_wheels.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Debug wheels
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
wheels:
8+
uses: ./.github/workflows/wheels.yml
9+
secrets: inherit
10+
11+
list-wheels:
12+
needs: [wheels]
13+
runs-on: ubuntu-24.04
14+
defaults:
15+
run:
16+
shell: bash
17+
working-directory: ${{ github.workspace }}
18+
steps:
19+
- name: "Download Wheels from GitHub Artifacts"
20+
uses: actions/download-artifact@v4
21+
with:
22+
pattern: wheels-*
23+
path: wheels
24+
merge-multiple: true
25+
- name: List all builded wheels
26+
run:
27+
ls -alh wheels/

.github/workflows/release.yml

Lines changed: 2 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@ concurrency:
55
group: ${{ github.workflow }}-${{ github.ref }}
66
cancel-in-progress: true
77

8-
env:
9-
PYTHON_VERSION: "3.11"
10-
DEPLOY_DIR: "deploy/pypi/zuban"
11-
DEFAULT_ARCH: "x64"
12-
13-
defaults:
14-
run:
15-
shell: bash
16-
working-directory: "deploy/pypi/zuban"
17-
188
permissions:
199
id-token: write
2010
contents: read
@@ -34,74 +24,8 @@ jobs:
3424

3525
build:
3626
needs: [tests]
37-
strategy:
38-
matrix:
39-
t:
40-
- os: ubuntu-24.04
41-
target: x86_64-unknown-linux-gnu
42-
test: true
43-
- os: ubuntu-24.04
44-
target: i686-unknown-linux-gnu
45-
test: false
46-
47-
- os: ubuntu-24.04
48-
target: aarch64-unknown-linux-gnu
49-
test: false
50-
# see https://github.com/astral-sh/ruff/issues/3791
51-
# and https://github.com/gnzlbg/jemallocator/issues/170#issuecomment-1503228963
52-
maturin_docker_options: -e JEMALLOC_SYS_WITH_LG_PAGE=16
53-
- os: ubuntu-24.04
54-
target: armv7-unknown-linux-gnueabihf
55-
test: false
56-
57-
- os: macos-latest
58-
target: x86_64
59-
test: false
60-
- os: macos-latest
61-
target: aarch64
62-
test: true
63-
64-
- os: windows-2022
65-
target: x86_64-pc-windows-msvc
66-
test: true
67-
- os: windows-2022
68-
target: i686-pc-windows-msvc
69-
arch: x86
70-
test: true
71-
runs-on: ${{ matrix.t.os }}
72-
steps:
73-
- uses: actions/checkout@v4
74-
with:
75-
submodules: recursive
76-
persist-credentials: false
77-
- if: ${{ matrix.t.test }}
78-
uses: actions/setup-python@v5
79-
with:
80-
python-version: ${{ env.PYTHON_VERSION }}
81-
architecture: ${{ matrix.t.arch || env.DEFAULT_ARCH }}
82-
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3
83-
with:
84-
# The target is needed, because there were issues when reusing
85-
# caches, probably related to cross compiling.
86-
key: "swatinem-${{ matrix.t.target }}"
87-
- name: "Pre-Build"
88-
run: ./pre-maturin-build.sh
89-
- name: "Build Wheel"
90-
uses: PyO3/maturin-action@v1
91-
with:
92-
target: ${{ matrix.t.target }}
93-
working-directory: ${{ env.DEPLOY_DIR }}
94-
docker-options: ${{ matrix.platform.maturin_docker_options }}
95-
manylinux: auto
96-
args: --release --locked --out dist --ignore-rust-version
97-
- name: "Test wheel"
98-
if: ${{ matrix.t.test }}
99-
run: ./test-maturin-build.sh
100-
- name: "Upload wheel as a GitHub Artifact"
101-
uses: actions/upload-artifact@v4
102-
with:
103-
name: wheels-${{ matrix.t.os }}-${{ matrix.t.target }}
104-
path: "${{ env.DEPLOY_DIR }}/dist"
27+
uses: ./.github/workflows/wheels.yml
28+
secrets: inherit
10529

10630
publish:
10731
needs: [build]

.github/workflows/wheels.yml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
name: Build wheels
2+
3+
env:
4+
DEPLOY_DIR: "deploy/pypi/zuban"
5+
DEFAULT_ARCH: "x64"
6+
7+
defaults:
8+
run:
9+
shell: bash
10+
working-directory: "deploy/pypi/zuban"
11+
12+
on:
13+
workflow_call:
14+
inputs:
15+
python_version:
16+
default: "3.11"
17+
required: false
18+
type: string
19+
20+
jobs:
21+
build:
22+
strategy:
23+
matrix:
24+
t:
25+
- os: ubuntu-24.04
26+
arch: x64
27+
target: x86_64-unknown-linux-gnu
28+
test: native
29+
30+
- os: ubuntu-24.04-arm
31+
arch: arm64
32+
target: aarch64-unknown-linux-gnu
33+
test: native
34+
# see https://github.com/astral-sh/ruff/issues/3791
35+
# and https://github.com/gnzlbg/jemallocator/issues/170#issuecomment-1503228963
36+
maturin_docker_options: -e JEMALLOC_SYS_WITH_LG_PAGE=16
37+
38+
# The macos-15-intel runner still supports x64, see https://github.com/actions/runner-images/issues/13045
39+
- os: macos-15-intel
40+
arch: x64
41+
target: x86_64
42+
test: native
43+
- os: macos-latest
44+
arch: arm64
45+
target: aarch64
46+
test: native
47+
48+
- os: windows-2022
49+
arch: x64
50+
target: x86_64-pc-windows-msvc
51+
- os: windows-2022
52+
arch: x86
53+
target: i686-pc-windows-msvc
54+
test: native
55+
56+
# manylinux armv7 / x86 (i686)
57+
- os: ubuntu-24.04
58+
arch: armv7
59+
target: armv7-unknown-linux-gnueabihf
60+
test: run-on-arch
61+
distro: ubuntu24.04
62+
install_cmd: apt-get update && apt-get install -y python3 python3-pip python3-venv
63+
- os: ubuntu-24.04
64+
arch: x86
65+
target: i686-unknown-linux-gnu
66+
test: container
67+
image: i386/python:${{ inputs.python_version }}-slim-trixie
68+
install_cmd: apt-get install -y bash
69+
70+
# musllinux armv7 / aarch64 (arm64) / x64 / x86 (i686)
71+
- os: ubuntu-24.04
72+
arch: armv7
73+
target: armv7-unknown-linux-musleabihf
74+
manylinux: musllinux_1_2
75+
test: run-on-arch
76+
distro: alpine_latest
77+
install_cmd: apk add python3 py3-pip bash
78+
- os: ubuntu-24.04-arm
79+
target: aarch64-unknown-linux-musl
80+
# see https://github.com/astral-sh/ruff/issues/3791
81+
# and https://github.com/gnzlbg/jemallocator/issues/170#issuecomment-1503228963
82+
maturin_docker_options: -e JEMALLOC_SYS_WITH_LG_PAGE=16
83+
manylinux: musllinux_1_2
84+
test: container
85+
image: python:${{ inputs.python_version }}-alpine
86+
install_cmd: apk add bash
87+
- os: ubuntu-24.04
88+
target: x86_64-unknown-linux-musl
89+
manylinux: musllinux_1_2
90+
test: container
91+
image: python:${{ inputs.python_version }}-alpine
92+
install_cmd: apk add bash
93+
- os: ubuntu-24.04
94+
target: i686-unknown-linux-musl
95+
manylinux: musllinux_1_2
96+
test: container
97+
image: i386/python:${{ inputs.python_version }}-alpine
98+
install_cmd: apk add bash
99+
runs-on: ${{ matrix.t.os }}
100+
steps:
101+
- uses: actions/checkout@v4
102+
with:
103+
submodules: recursive
104+
persist-credentials: false
105+
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3
106+
with:
107+
# The target is needed, because there were issues when reusing
108+
# caches, probably related to cross compiling.
109+
key: "swatinem-${{ matrix.t.target }}"
110+
- name: "Pre-Build"
111+
run: ./pre-maturin-build.sh
112+
- name: "Build Wheel"
113+
uses: PyO3/maturin-action@v1
114+
with:
115+
target: ${{ matrix.t.target }}
116+
working-directory: ${{ env.DEPLOY_DIR }}
117+
docker-options: ${{ matrix.t.maturin_docker_options }}
118+
manylinux: ${{ matrix.t.manylinux || 'auto' }}
119+
args: --release --locked --out dist --ignore-rust-version
120+
- uses: actions/setup-python@v5
121+
if: matrix.t.test == 'native'
122+
with:
123+
python-version: ${{ inputs.python_version }}
124+
architecture: ${{ matrix.t.arch || env.DEFAULT_ARCH }}
125+
- name: "Test wheel (native)"
126+
if: matrix.t.test == 'native'
127+
run: ./test-maturin-build.sh
128+
- name: "Test wheel (run-on-arch)"
129+
if: matrix.t.test == 'run-on-arch'
130+
uses: uraimo/run-on-arch-action@v3
131+
with:
132+
arch: ${{ matrix.t.arch }}
133+
distro: ${{ matrix.t.distro }}
134+
githubToken: ${{ github.token }}
135+
install: |
136+
${{ matrix.t.install_cmd }}
137+
run: |
138+
cd ${{ env.DEPLOY_DIR }}
139+
python3 -m venv venv
140+
. ./venv/bin/activate
141+
./test-maturin-build.sh
142+
- name: "Test wheel (container)"
143+
if: matrix.t.test == 'container'
144+
uses: addnab/docker-run-action@v3
145+
with:
146+
image: ${{ matrix.t.image }}
147+
options: -v ${{ github.workspace }}:/workspace -w /workspace
148+
run: |
149+
${{ matrix.t.install_cmd }}
150+
cd ${{ env.DEPLOY_DIR }}
151+
python3 -m venv venv
152+
. ./venv/bin/activate
153+
./test-maturin-build.sh
154+
- name: "Upload wheel as a GitHub Artifact"
155+
uses: actions/upload-artifact@v4
156+
with:
157+
name: wheels-${{ matrix.t.os }}-${{ matrix.t.target }}
158+
path: "${{ env.DEPLOY_DIR }}/dist"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
22
set -eu -o pipefail -x
33

4-
pip install dist/zuban-*.whl --force-reinstall
4+
pip install zuban --no-index --find-links dist/ --force-reinstall
55
zuban --help

0 commit comments

Comments
 (0)