diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml new file mode 100644 index 0000000..e3293eb --- /dev/null +++ b/.github/workflows/wheels.yml @@ -0,0 +1,59 @@ +name: Python wheels + +on: + push: + tags: + - "*" + +jobs: + wheel: + runs-on: ubuntu-20.04 + env: + TAGS: cp311-cp311 cp312-cp312 + + strategy: + matrix: + target: + # https://quay.io/organization/pypa + - [ manylinux_2_28, x86_64 ] + - [ manylinux_2_28, aarch64 ] + + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Build Python wheels + env: + POLICY: ${{ matrix.target[0] }} + PLATFORM: ${{ matrix.target[1] }} + run: make manylinux POLICY="$POLICY" PLATFORM="$PLATFORM" TAGS="$TAGS" + + # https://github.com/actions/upload-artifact + - uses: actions/upload-artifact@v4 + with: + name: wheels-${{ join(matrix.target, '-') }} + path: wheelhouse/*.whl + if-no-files-found: error + retention-days: 2 + + merge-artifacts: + name: Download and create one artifact from all jobs + needs: wheel + runs-on: ubuntu-20.04 + steps: + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: wheelhouse + pattern: wheels-* + merge-multiple: true + + - run: ls -l wheelhouse + + - uses: actions/upload-artifact@v4 + with: + name: wheels + path: wheelhouse/*.whl + if-no-files-found: error diff --git a/.gitignore b/.gitignore index f630ca5..8f94123 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ build dist +dist-* fuse_python.egg-info __pycache__ *.pyc diff --git a/Makefile b/Makefile index cfb565a..1e9feb2 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,25 @@ all: source manylinux +POLICY := manylinux_2_28 +PLATFORM := x86_64 +TAGS := cp312-cp312 + source: python3 setup.py sdist manylinux: - docker run --rm -it -e PLAT=manylinux_2_28 -v $(PWD):/io -w /io quay.io/pypa/manylinux_2_28_x86_64 bash -c "yum install -y fuse-devel && /opt/python/cp312-cp312/bin/python setup.py bdist_wheel && auditwheel repair dist/*.whl" + docker run --rm -v $(PWD):/io -w /io quay.io/pypa/$(POLICY)_$(PLATFORM) \ + make build-wheels \ + POLICY=$(POLICY) PLATFORM=$(PLATFORM) TAGS="$(TAGS)" + +build-wheels: + yum install -y fuse-devel + $(foreach tag,$(TAGS),$(MAKE) build-wheel TAG=$(tag) PATH="/opt/python/$(tag)/bin:$(PATH)";) + +build-wheel: + python -m build --wheel --outdir dist-$(POLICY)-$(PLATFORM)-$(TAG) + auditwheel repair dist-$(POLICY)-$(PLATFORM)-$(TAG)/*.whl clean: python3 setup.py clean --all - rm -fr build dist fuse_python.egg-info wheelhouse + rm -fr build dist dist-* fuse_python.egg-info wheelhouse