diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a27e3a0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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/gh-action-pypi-publish@v1.4.2 + with: + skip_existing: true + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/Makefile b/Makefile index a2dfb1b..6a08e3e 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -30,9 +32,13 @@ 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 \ @@ -40,11 +46,11 @@ wheel_manylinux32 wheel_manylinux64: dist/$(PACKAGENAME)-$(VERSION).tar.gz -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; \