Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for python linux-arm64 build via qemu #720

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
-e TWINE_USERNAME=__token__ \
-e TWINE_PASSWORD=${{ secrets.PYPI_TOKEN }} \
ubuntu:18.04 /bin/bash /opt/OpenCC/release-pypi-linux.sh

- name: Build package and upload from docker (Linux ARM)
if: runner.os == 'Linux'
run: bash release-pypi-linux-arm.sh
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

- name: Build package and upload (macOS)
if: runner.os == 'macOS'
Expand Down
9 changes: 9 additions & 0 deletions build-wheel-linux-arm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apt update && apt install -y build-essential cmake

# Build and package
pip install -y --no-cache-dir setuptools wheel cmake
python setup.py build_ext bdist_wheel \
--plat-name manylinux_2_17_aarch64

# Cleanup
rm -rf build python/opencc/clib OpenCC.egg-info
10 changes: 10 additions & 0 deletions release-pypi-linux-arm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sudo apt-get install qemu binfmt-support qemu-user-static # Install the qemu packages
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

for VERSION in 3.7.14 3.8.14 3.9.14 3.10.7; do
docker run --rm -t --platform linux/arm64/v8 -v $PWD:/opencc python:$VERSION sh -c "cd opencc && sh build-wheel-linux-arm.sh"
done

# Upload to PyPI
python -m pip install twine
python -m twine upload dist/*