Skip to content

Commit 0dff048

Browse files
committed
Test cross compiling with cargo-zigbuild
1 parent 75a6bd8 commit 0dff048

File tree

1 file changed

+52
-3
lines changed

1 file changed

+52
-3
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ jobs:
170170
run: |
171171
cd examples/rust_with_cffi/
172172
python --version
173-
pip install -U pip wheel setuptools
173+
pip install -U wheel setuptools
174174
python setup.py bdist_wheel --py-limited-api=cp39
175175
ls -la dist/
176176
env:
@@ -188,7 +188,7 @@ jobs:
188188
shell: bash
189189
run: |
190190
cd examples/
191-
pip install -U pip wheel setuptools
191+
pip install -U wheel setuptools
192192
python --version
193193
pip install rust_with_cffi/dist/rust_with_cffi*.whl
194194
python -c "from rust_with_cffi import rust; assert rust.rust_func() == 14"
@@ -268,7 +268,56 @@ jobs:
268268
python -m pip install wheel
269269
python setup.py bdist_wheel --plat-name manylinux2014_aarch64
270270
ls -la dist/
271-
- uses: uraimo/[email protected]
271+
- uses: uraimo/[email protected]
272+
name: Install built wheel
273+
with:
274+
arch: aarch64
275+
distro: ubuntu20.04
276+
dockerRunArgs: |
277+
--volume "${PWD}/examples/namespace_package:/io"
278+
install: |
279+
apt-get update
280+
apt-get install -y --no-install-recommends python3 python3-pip
281+
pip3 install -U pip
282+
run: |
283+
pip3 install namespace_package --no-index --find-links /io/dist/ --force-reinstall
284+
python3 -c "from namespace_package import rust; assert rust.rust_func() == 14"
285+
python3 -c "from namespace_package import python; assert python.python_func() == 15"
286+
287+
test-zigbuild:
288+
runs-on: ubuntu-latest
289+
steps:
290+
- uses: actions/checkout@master
291+
- name: Setup python
292+
uses: actions/setup-python@v2
293+
with:
294+
python-version: 3.8
295+
- uses: actions-rs/toolchain@v1
296+
with:
297+
profile: minimal
298+
toolchain: stable
299+
target: aarch64-unknown-linux-gnu
300+
override: true
301+
- name: Install cargo-zigbuild
302+
run: |
303+
cargo install cargo-zigbuild
304+
python3 -m pip install ziglang
305+
- name: Build package
306+
run: pip install -e .
307+
- name: Build wheel using cargo-zigbuild
308+
shell: bash
309+
env:
310+
CARGO: cargo-zigbuild
311+
CARGO_BUILD_TARGET: aarch64-unknown-linux-gnu
312+
PYO3_CROSS_LIB_DIR: /opt/python/cp38-cp38/lib
313+
run: |
314+
mkdir -p $PYO3_CROSS_LIB_DIR
315+
docker cp -L $(docker create --rm quay.io/pypa/manylinux2014_aarch64:latest):/opt/python/cp38-cp38 /opt/python
316+
cd examples/namespace_package
317+
python -m pip install wheel
318+
python setup.py bdist_wheel --plat-name manylinux2014_aarch64
319+
ls -la dist/
320+
- uses: uraimo/[email protected]
272321
name: Install built wheel
273322
with:
274323
arch: aarch64

0 commit comments

Comments
 (0)