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 linux aarch64 wheel build support #13

Merged
merged 1 commit into from
Oct 20, 2021
Merged
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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build & Publish wheel

on: push

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Dependency
run: |
pip install cython
- name: Building wheel
run: |
make wheel_manylinux
- name: Copy wheels in dist
run: cp wheelhouse*/fastrlock*.whl dist/
- name: Push build artifacts to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/[email protected]
with:
skip_existing: true
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ VERSION=$(shell python -c 'import re; f=open("fastrlock/__init__.py"); print(re.
PYTHON_WITH_CYTHON=$(shell $(PYTHON) -c 'import Cython.Compiler' >/dev/null 2>/dev/null && echo " --with-cython" || true)
PY3_WITH_CYTHON=$(shell $(PYTHON3) -c 'import Cython.Compiler' >/dev/null 2>/dev/null && echo " --with-cython" || true)

MANYLINUX_IMAGE_X86_64=quay.io/pypa/manylinux2010_x86_64
MANYLINUX_IMAGE_686=quay.io/pypa/manylinux2010_i686
MANYLINUX_IMAGES= \
manylinux2010_x86_64 \
manylinux2010_i686 \
manylinux2014_aarch64

.PHONY: all version inplace sdist build clean wheel_manylinux wheel_manylinux32 wheel_manylinux64 wheel
.PHONY: all version inplace sdist build clean wheel_manylinux wheel

all: inplace

Expand All @@ -30,21 +32,25 @@ build:
wheel:
$(PYTHON) setup.py $(SETUPFLAGS) bdist_wheel $(PYTHON_WITH_CYTHON)

wheel_manylinux: sdist wheel_manylinux64 wheel_manylinux32
qemu-user-static:
docker run --rm --privileged hypriot/qemu-register

wheel_manylinux32 wheel_manylinux64: dist/$(PACKAGENAME)-$(VERSION).tar.gz
wheel_manylinux: sdist $(addprefix wheel_,$(MANYLINUX_IMAGES))
$(addprefix wheel_,$(filter-out %_x86_64, $(filter-out %_i686, $(MANYLINUX_IMAGES)))): qemu-user-static

wheel_%: dist/$(PACKAGENAME)-$(VERSION).tar.gz
echo "Building wheels for $(PACKAGENAME) $(VERSION)"
mkdir -p wheelhouse$(subst wheel_manylinux,,$@)
time docker run --rm -t \
-v $(shell pwd):/io \
-e CFLAGS="-O3 -g1 -mtune=generic -pipe -fPIC" \
-e LDFLAGS="$(LDFLAGS) -fPIC" \
-e WHEELHOUSE=wheelhouse$(subst wheel_manylinux,,$@) \
$(if $(patsubst %32,,$@),$(MANYLINUX_IMAGE_X86_64),$(MANYLINUX_IMAGE_686)) \
quay.io/pypa/$(subst wheel_,,$@) \
bash -c '\
rm -fr $(PACKAGENAME)-$(VERSION)/; \
tar zxf /io/$< && cd $(PACKAGENAME)-$(VERSION)/ || exit 1; \
for PYBIN in /opt/python/*/bin; do \
for PYBIN in /opt/python/cp*/bin; do \
PYVER="$$($$PYBIN/python -V)"; \
PROFDIR="prof-$${PYVER// /_}"; \
echo $$PYVER; \
Expand Down