Skip to content

Commit

Permalink
Add linux aarch64 wheel build support and wheel build for Github Acti…
Browse files Browse the repository at this point in the history
…ons (GH-13)
  • Loading branch information
odidev authored Oct 20, 2021
1 parent 48ad548 commit e1068f0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 7 deletions.
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

0 comments on commit e1068f0

Please sign in to comment.