Skip to content

Commit 2ed553e

Browse files
committed
ci: add musl support to check-python-sdk
1 parent 644676a commit 2ed553e

2 files changed

Lines changed: 93 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,57 @@ jobs:
8585
pip install longbridge --no-index --find-links dist --force-reinstall
8686
python -c "import longbridge"
8787
88+
check-python-sdk-musl:
89+
needs:
90+
- check-format
91+
strategy:
92+
fail-fast: true
93+
matrix:
94+
target: [x86_64-unknown-linux-musl, aarch64-unknown-linux-musl]
95+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
96+
runs-on: ubuntu-22.04
97+
steps:
98+
- uses: actions/checkout@v4
99+
with:
100+
submodules: true
101+
102+
- name: Install Python
103+
uses: actions/setup-python@v5
104+
with:
105+
python-version: ${{ matrix.python-version }}
106+
107+
- name: Install Rust
108+
uses: dtolnay/rust-toolchain@stable
109+
with:
110+
toolchain: stable
111+
components: rustfmt, clippy
112+
targets: ${{ matrix.target }}
113+
114+
- name: Setup QEMU
115+
if: matrix.target == 'aarch64-unknown-linux-musl'
116+
uses: docker/setup-qemu-action@v3
117+
with:
118+
platforms: arm64
119+
120+
- name: Build wheels (musl)
121+
uses: PyO3/maturin-action@v1
122+
with:
123+
target: ${{ matrix.target }}
124+
manylinux: musllinux_1_2
125+
args: -i python${{ matrix.python-version }} --out dist -m python/Cargo.toml
126+
127+
- name: Install built wheel
128+
run: |
129+
docker run --rm \
130+
--platform ${{ matrix.target == 'aarch64-unknown-linux-musl' && 'linux/arm64' || 'linux/amd64' }} \
131+
-v $(pwd)/dist:/dist \
132+
python:${{ matrix.python-version }}-alpine \
133+
sh -c "pip install --upgrade pip && pip install longbridge --no-index --find-links /dist --force-reinstall && python -c 'import longbridge'"
134+
88135
build-python:
89136
needs:
90137
- check-python-sdk
138+
- check-python-sdk-musl
91139
runs-on: ${{ matrix.runs-on }}
92140
strategy:
93141
fail-fast: true

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,50 @@ jobs:
4444
name: wheels-${{ matrix.runs-on }}-${{ matrix.python-version }}
4545
path: dist
4646

47+
build-python-sdk-musl:
48+
runs-on: ubuntu-24.04
49+
strategy:
50+
fail-fast: true
51+
matrix:
52+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
53+
target: [x86_64-unknown-linux-musl, aarch64-unknown-linux-musl]
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v4
57+
with:
58+
submodules: true
59+
- uses: actions/setup-python@v5
60+
with:
61+
python-version: ${{ matrix.python-version }}
62+
- name: Install Rust toolchain
63+
uses: dtolnay/rust-toolchain@stable
64+
with:
65+
toolchain: stable
66+
targets: ${{ matrix.target }}
67+
- name: Setup QEMU
68+
if: matrix.target == 'aarch64-unknown-linux-musl'
69+
uses: docker/setup-qemu-action@v3
70+
with:
71+
platforms: arm64
72+
- name: Build wheels (musl)
73+
uses: PyO3/maturin-action@v1
74+
with:
75+
target: ${{ matrix.target }}
76+
manylinux: musllinux_1_2
77+
args: -i python${{ matrix.python-version }} --release --out dist -m python/Cargo.toml
78+
- name: Install built wheel
79+
run: |
80+
docker run --rm \
81+
--platform ${{ matrix.target == 'aarch64-unknown-linux-musl' && 'linux/arm64' || 'linux/amd64' }} \
82+
-v $(pwd)/dist:/dist \
83+
python:${{ matrix.python-version }}-alpine \
84+
sh -c "pip install --upgrade pip && pip install longbridge --no-index --find-links /dist --force-reinstall && python -c 'import longbridge'"
85+
- name: Upload wheels
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: wheels-musl-${{ matrix.target }}-${{ matrix.python-version }}
89+
path: dist
90+
4791
build-nodejs-sdk:
4892
strategy:
4993
fail-fast: true
@@ -506,6 +550,7 @@ jobs:
506550
build:
507551
needs:
508552
- build-python-sdk
553+
- build-python-sdk-musl
509554
- build-nodejs-sdk
510555
- build-java-jni
511556
- build-cpp-sdk-debug

0 commit comments

Comments
 (0)