From a46755309237622e274981c2f126a0599a3eda49 Mon Sep 17 00:00:00 2001 From: marek-elisity Date: Tue, 17 Jun 2025 17:26:58 +0200 Subject: [PATCH 01/12] Build wheels for Alpine --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6e4065c..b49d8d8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -37,7 +37,7 @@ jobs: with: output-dir: wheelhouse env: - CIBW_BUILD: '{cp36,cp37,cp38,cp39,cp310,cp311,cp312,cp313}-{manylinux_x86_64,manylinux_aarch64,win32,win_amd64,macosx_x86_64} {cp39,cp310,cp311,cp312,cp313}-macosx_arm64' + CIBW_BUILD: '{cp36,cp37,cp38,cp39,cp310,cp311,cp312,cp313}-{manylinux_x86_64,manylinux_aarch64,win32,win_amd64,macosx_x86_64,musllinux_x86_64,musllinux_aarch64} {cp39,cp310,cp311,cp312,cp313}-macosx_arm64' CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 CIBW_ARCHS_LINUX: 'auto aarch64' CIBW_ARCHS_MACOS: 'auto arm64' From 6e3ba3b8c711f69f5d3f8a957d3e103a3638a166 Mon Sep 17 00:00:00 2001 From: marek-elisity Date: Fri, 27 Jun 2025 18:36:55 +0200 Subject: [PATCH 02/12] Update publish.yml From 4734cbc48958427c9032f13f7c9a472da7b3f988 Mon Sep 17 00:00:00 2001 From: marek-elisity Date: Fri, 27 Jun 2025 18:39:49 +0200 Subject: [PATCH 03/12] Update publish.yml --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b49d8d8..f97bd16 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, windows-2019, macOS-13] + os: [ubuntu-latest, windows-2019, macOS-13] steps: - name: Checkout uses: actions/checkout@v4 From ce3f67130caf3c4af2e026fdcdaa70acbc505f80 Mon Sep 17 00:00:00 2001 From: Marek Czaplicki Date: Fri, 27 Jun 2025 18:50:12 +0200 Subject: [PATCH 04/12] Update publish.yml --- .github/workflows/publish.yml | 96 +++++++++++++++++------------------ 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f97bd16..a49b71e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-2019, macOS-13] + os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-latest] steps: - name: Checkout uses: actions/checkout@v4 @@ -33,17 +33,17 @@ jobs: - name: Build wheels # uses: joerick/cibuildwheel@v1.9.0 - uses: pypa/cibuildwheel@v2.23.0 + uses: pypa/cibuildwheel@v3.0.0 with: output-dir: wheelhouse env: - CIBW_BUILD: '{cp36,cp37,cp38,cp39,cp310,cp311,cp312,cp313}-{manylinux_x86_64,manylinux_aarch64,win32,win_amd64,macosx_x86_64,musllinux_x86_64,musllinux_aarch64} {cp39,cp310,cp311,cp312,cp313}-macosx_arm64' - CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 - CIBW_ARCHS_LINUX: 'auto aarch64' - CIBW_ARCHS_MACOS: 'auto arm64' - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: 'pytest -s {project}/tests' - CIBW_TEST_SKIP: '*-macosx_arm64' # Until the day Apple silicon instances are available on GitHub Actions + CIBW_BUILD: '{cp311,cp312,cp313}-{manylinux_x86_64,manylinux_aarch64,win32,win_amd64,macosx_x86_64,musllinux_x86_64,musllinux_aarch64} {cp39,cp310,cp311,cp312,cp313}-macosx_arm64' +# CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 +# CIBW_ARCHS_LINUX: 'auto aarch64' +# CIBW_ARCHS_MACOS: 'auto arm64' +# CIBW_TEST_REQUIRES: pytest +# CIBW_TEST_COMMAND: 'pytest -s {project}/tests' +# CIBW_TEST_SKIP: '*-macosx_arm64' # Until the day Apple silicon instances are available on GitHub Actions - name: Upload artifact uses: actions/upload-artifact@v4 @@ -51,42 +51,42 @@ jobs: name: cibw-wheels-${{ strategy.job-index }} path: ./wheelhouse/*.whl - build_sdist: - name: Build a source distribution - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - - name: Build sdist - run: | - pip install py-cpuinfo - python setup.py build sdist - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: cibw-sdist-${{ strategy.job-index }} - path: dist/*.tar.gz - - publish: - needs: [build_wheels, build_sdist] - environment: ${{ github.event.inputs.repository }} - permissions: - id-token: write - runs-on: ubuntu-latest - steps: - - uses: actions/download-artifact@v4 - with: - pattern: cibw-* - path: dist - merge-multiple: true - - - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} +# build_sdist: +# name: Build a source distribution +# runs-on: ubuntu-20.04 +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# +# - name: Set up Python +# uses: actions/setup-python@v5 +# with: +# python-version: '3.9' +# +# - name: Build sdist +# run: | +# pip install py-cpuinfo +# python setup.py build sdist +# +# - name: Upload artifact +# uses: actions/upload-artifact@v4 +# with: +# name: cibw-sdist-${{ strategy.job-index }} +# path: dist/*.tar.gz +# +# publish: +# needs: [build_wheels, build_sdist] +# environment: ${{ github.event.inputs.repository }} +# permissions: +# id-token: write +# runs-on: ubuntu-latest +# steps: +# - uses: actions/download-artifact@v4 +# with: +# pattern: cibw-* +# path: dist +# merge-multiple: true +# +# - uses: pypa/gh-action-pypi-publish@release/v1 +# with: +# password: ${{ secrets.PYPI_API_TOKEN }} From eb69133384e54d3113b353b0d0ecb9c66bd399a8 Mon Sep 17 00:00:00 2001 From: Marek Czaplicki Date: Fri, 27 Jun 2025 18:55:53 +0200 Subject: [PATCH 05/12] Update publish.yml --- .github/workflows/build.yml | 85 ++++++++++++++++++++------------ .github/workflows/publish.yml | 92 ----------------------------------- 2 files changed, 54 insertions(+), 123 deletions(-) delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 092c60a..2629ec1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,49 +1,72 @@ -name: build +name: Build wheels on: push: - branches: - - master + branches: [main] pull_request: - types: - - opened - - synchronize - - reopened + branches: [main] + workflow_dispatch: jobs: - build: + build-wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - os: [windows-latest, macos-latest, ubuntu-latest] - python-version: ["3.13"] + os: [ubuntu-latest, windows-latest, macos-latest] - runs-on: ${{ matrix.os }} steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} - architecture: x64 + python-version: '3.11' + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel - # block below based on: - # https://medium.com/ai2-blog/python-caching-in-github-actions-e9452698e98d - - name: Cache Python environment - uses: actions/cache@v4 + - name: Build wheels + run: python -m cibuildwheel --output-dir wheelhouse + env: + CIBW_BUILD: "cp311-* cp312-* cp313-*" + CIBW_ARCHS_LINUX: "x86_64 aarch64" + CIBW_ARCHS_MACOS: "x86_64 arm64 universal2" + CIBW_ARCHS_WINDOWS: "AMD64" + + - name: Upload built wheels + uses: actions/upload-artifact@v4 with: - path: ${{ env.pythonLocation }} - key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('pip-freeze.txt') }} + name: python-wheels-${{ matrix.os }} + path: wheelhouse/*.whl - - name: Install dependencies - run: | - pip install --upgrade --upgrade-strategy eager setuptools wheel - pip install --upgrade --upgrade-strategy eager -r requirements.txt - pip freeze > pip-freeze.txt + build-musllinux: + name: Build musllinux wheels + runs-on: ubuntu-latest + container: + image: quay.io/pypa/musllinux_1_1_x86_64 + options: --privileged # Needed for QEMU for aarch64 - - name: Test with pytest + steps: + - uses: actions/checkout@v4 + + - name: Install Python and cibuildwheel run: | - python setup.py build_ext --inplace - pip install -e . - python -m pytest + apk add --no-cache python3 py3-pip bash + pip3 install cibuildwheel + + - name: Build musllinux wheels + run: python3 -m cibuildwheel --output-dir wheelhouse + env: + CIBW_PLATFORM: "linux" + CIBW_BUILD: "cp311-* cp312-* cp313-*" + CIBW_ARCHS: "x86_64 aarch64" + CIBW_MANYLINUX_X86_64_IMAGE: musllinux_1_1 + CIBW_MANYLINUX_AARCH64_IMAGE: musllinux_1_1 + + - name: Upload musllinux wheels + uses: actions/upload-artifact@v4 + with: + name: python-wheels-musllinux + path: wheelhouse/*.whl \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index a49b71e..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: publish - -on: - workflow_dispatch: - inputs: - repository: - description: 'The repository to upload the package to' - required: true - default: 'testpypi' - -jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-latest] - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - - name: Set up QEMU - if: runner.os == 'Linux' - # uses: docker/setup-qemu-action@v1.0.1 - uses: docker/setup-qemu-action@v3 - with: - platforms: arm64 - - - name: Build wheels - # uses: joerick/cibuildwheel@v1.9.0 - uses: pypa/cibuildwheel@v3.0.0 - with: - output-dir: wheelhouse - env: - CIBW_BUILD: '{cp311,cp312,cp313}-{manylinux_x86_64,manylinux_aarch64,win32,win_amd64,macosx_x86_64,musllinux_x86_64,musllinux_aarch64} {cp39,cp310,cp311,cp312,cp313}-macosx_arm64' -# CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 -# CIBW_ARCHS_LINUX: 'auto aarch64' -# CIBW_ARCHS_MACOS: 'auto arm64' -# CIBW_TEST_REQUIRES: pytest -# CIBW_TEST_COMMAND: 'pytest -s {project}/tests' -# CIBW_TEST_SKIP: '*-macosx_arm64' # Until the day Apple silicon instances are available on GitHub Actions - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: cibw-wheels-${{ strategy.job-index }} - path: ./wheelhouse/*.whl - -# build_sdist: -# name: Build a source distribution -# runs-on: ubuntu-20.04 -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# -# - name: Set up Python -# uses: actions/setup-python@v5 -# with: -# python-version: '3.9' -# -# - name: Build sdist -# run: | -# pip install py-cpuinfo -# python setup.py build sdist -# -# - name: Upload artifact -# uses: actions/upload-artifact@v4 -# with: -# name: cibw-sdist-${{ strategy.job-index }} -# path: dist/*.tar.gz -# -# publish: -# needs: [build_wheels, build_sdist] -# environment: ${{ github.event.inputs.repository }} -# permissions: -# id-token: write -# runs-on: ubuntu-latest -# steps: -# - uses: actions/download-artifact@v4 -# with: -# pattern: cibw-* -# path: dist -# merge-multiple: true -# -# - uses: pypa/gh-action-pypi-publish@release/v1 -# with: -# password: ${{ secrets.PYPI_API_TOKEN }} From 73d4589e56d642f7399695585eccebc833b32287 Mon Sep 17 00:00:00 2001 From: Marek Czaplicki Date: Mon, 14 Jul 2025 17:06:11 +0200 Subject: [PATCH 06/12] Build for all platforms & architectures --- .github/workflows/build.yml | 145 ++++++++++++++++++++++-------------- 1 file changed, 88 insertions(+), 57 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2629ec1..03dcb9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,64 +9,95 @@ on: jobs: build-wheels: - name: Build wheels on ${{ matrix.os }} + permissions: + contents: read # to fetch code (actions/checkout) + + name: Build wheels on ${{ matrix.os }} ${{ matrix.qemu }} ${{ matrix.musl }} runs-on: ${{ matrix.os }} + needs: pre-deploy strategy: - fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install cibuildwheel - run: python -m pip install cibuildwheel - - - name: Build wheels - run: python -m cibuildwheel --output-dir wheelhouse - env: - CIBW_BUILD: "cp311-* cp312-* cp313-*" - CIBW_ARCHS_LINUX: "x86_64 aarch64" - CIBW_ARCHS_MACOS: "x86_64 arm64 universal2" - CIBW_ARCHS_WINDOWS: "AMD64" - - - name: Upload built wheels - uses: actions/upload-artifact@v4 - with: - name: python-wheels-${{ matrix.os }} - path: wheelhouse/*.whl - - build-musllinux: - name: Build musllinux wheels - runs-on: ubuntu-latest - container: - image: quay.io/pypa/musllinux_1_1_x86_64 - options: --privileged # Needed for QEMU for aarch64 - + os: ["ubuntu-latest", "windows-latest", "macos-latest", "ubuntu-24.04-arm"] + qemu: [''] + musl: [""] + include: + # Split ubuntu/musl jobs for the sake of speed-up + - os: ubuntu-latest + qemu: ppc64le + musl: "" + - os: ubuntu-latest + qemu: ppc64le + musl: musllinux + - os: ubuntu-latest + qemu: s390x + musl: "" + - os: ubuntu-latest + qemu: s390x + musl: musllinux + - os: ubuntu-latest + qemu: armv7l + musl: "" + - os: ubuntu-latest + qemu: armv7l + musl: musllinux + - os: ubuntu-latest + musl: musllinux + - os: ubuntu-24.04-arm + musl: musllinux steps: - - uses: actions/checkout@v4 - - - name: Install Python and cibuildwheel - run: | - apk add --no-cache python3 py3-pip bash - pip3 install cibuildwheel - - - name: Build musllinux wheels - run: python3 -m cibuildwheel --output-dir wheelhouse - env: - CIBW_PLATFORM: "linux" - CIBW_BUILD: "cp311-* cp312-* cp313-*" - CIBW_ARCHS: "x86_64 aarch64" - CIBW_MANYLINUX_X86_64_IMAGE: musllinux_1_1 - CIBW_MANYLINUX_AARCH64_IMAGE: musllinux_1_1 - - - name: Upload musllinux wheels - uses: actions/upload-artifact@v4 - with: - name: python-wheels-musllinux - path: wheelhouse/*.whl \ No newline at end of file + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + - name: Set up QEMU + if: ${{ matrix.qemu }} + uses: docker/setup-qemu-action@v3 + with: + platforms: all + # This should be temporary + # xref https://github.com/docker/setup-qemu-action/issues/188 + # xref https://github.com/tonistiigi/binfmt/issues/215 + image: tonistiigi/binfmt:qemu-v8.1.5 + id: qemu + - name: Prepare emulation + run: | + if [[ -n "${{ matrix.qemu }}" ]]; then + # Build emulated architectures only if QEMU is set, + # use default "auto" otherwise + echo "CIBW_ARCHS_LINUX=${{ matrix.qemu }}" >> $GITHUB_ENV + fi + shell: bash + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Update pip, wheel, setuptools, build, twine + run: | + python -m pip install -U pip wheel setuptools build twine +# - name: Install cython +# run: >- +# python -m +# pip install -r requirements/cython.in -c requirements/cython.txt +# - name: Restore llhttp generated files +# uses: actions/download-artifact@v4 +# with: +# name: llhttp +# path: vendor/llhttp/build/ +# - name: Cythonize +# run: | +# make cythonize + - name: Build wheels + uses: pypa/cibuildwheel@v3.0.1 + env: + CIBW_SKIP: pp* ${{ matrix.musl == 'musllinux' && '*manylinux*' || '*musllinux*' }} + CIBW_ARCHS_MACOS: x86_64 arm64 universal2 + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: >- + dist-${{ matrix.os }}-${{ matrix.musl }}-${{ + matrix.qemu + && matrix.qemu + || 'native' + }} + path: ./wheelhouse/*.whl \ No newline at end of file From 14e2333cbc9efdd8c8ede93881ba0fed8a2e3c23 Mon Sep 17 00:00:00 2001 From: Marek Czaplicki Date: Mon, 14 Jul 2025 17:07:21 +0200 Subject: [PATCH 07/12] Build for all platforms & architectures --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 03dcb9a..9c13cc4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,6 @@ jobs: name: Build wheels on ${{ matrix.os }} ${{ matrix.qemu }} ${{ matrix.musl }} runs-on: ${{ matrix.os }} - needs: pre-deploy strategy: matrix: os: ["ubuntu-latest", "windows-latest", "macos-latest", "ubuntu-24.04-arm"] From fe0c10164fca9712273e668fe2da7f663bef1e38 Mon Sep 17 00:00:00 2001 From: Marek Czaplicki Date: Mon, 14 Jul 2025 17:11:00 +0200 Subject: [PATCH 08/12] Build for all platforms & architectures --- .github/workflows/build.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c13cc4..d40d297 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,7 @@ jobs: name: Build wheels on ${{ matrix.os }} ${{ matrix.qemu }} ${{ matrix.musl }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: ["ubuntu-latest", "windows-latest", "macos-latest", "ubuntu-24.04-arm"] qemu: [''] @@ -73,18 +74,18 @@ jobs: - name: Update pip, wheel, setuptools, build, twine run: | python -m pip install -U pip wheel setuptools build twine -# - name: Install cython -# run: >- -# python -m -# pip install -r requirements/cython.in -c requirements/cython.txt -# - name: Restore llhttp generated files -# uses: actions/download-artifact@v4 -# with: -# name: llhttp -# path: vendor/llhttp/build/ -# - name: Cythonize -# run: | -# make cythonize + - name: Install cython + run: >- + python -m + pip install -r requirements/cython.in -c requirements/cython.txt + - name: Restore llhttp generated files + uses: actions/download-artifact@v4 + with: + name: llhttp + path: vendor/llhttp/build/ + - name: Cythonize + run: | + make cythonize - name: Build wheels uses: pypa/cibuildwheel@v3.0.1 env: From 321bf6d7e12b725bcb961d9bae600f29aa852a63 Mon Sep 17 00:00:00 2001 From: Marek Czaplicki Date: Mon, 14 Jul 2025 17:19:12 +0200 Subject: [PATCH 09/12] Build for all platforms & architectures --- .github/workflows/build.yml | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d40d297..f3d2d43 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,25 +25,25 @@ jobs: - os: ubuntu-latest qemu: ppc64le musl: "" - - os: ubuntu-latest - qemu: ppc64le - musl: musllinux - - os: ubuntu-latest - qemu: s390x - musl: "" - - os: ubuntu-latest - qemu: s390x - musl: musllinux - - os: ubuntu-latest - qemu: armv7l - musl: "" - - os: ubuntu-latest - qemu: armv7l - musl: musllinux - - os: ubuntu-latest - musl: musllinux - - os: ubuntu-24.04-arm - musl: musllinux +# - os: ubuntu-latest +# qemu: ppc64le +# musl: musllinux +# - os: ubuntu-latest +# qemu: s390x +# musl: "" +# - os: ubuntu-latest +# qemu: s390x +# musl: musllinux +# - os: ubuntu-latest +# qemu: armv7l +# musl: "" +# - os: ubuntu-latest +# qemu: armv7l +# musl: musllinux +# - os: ubuntu-latest +# musl: musllinux +# - os: ubuntu-24.04-arm +# musl: musllinux steps: - name: Checkout uses: actions/checkout@v4 From cc0f586765e6257b4cf0739a3fbdfcfad3b94dc9 Mon Sep 17 00:00:00 2001 From: Marek Czaplicki Date: Mon, 14 Jul 2025 17:20:09 +0200 Subject: [PATCH 10/12] Build for all platforms & architectures --- .github/workflows/build.yml | 62 ++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3d2d43..084c7dc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,25 +25,25 @@ jobs: - os: ubuntu-latest qemu: ppc64le musl: "" -# - os: ubuntu-latest -# qemu: ppc64le -# musl: musllinux -# - os: ubuntu-latest -# qemu: s390x -# musl: "" -# - os: ubuntu-latest -# qemu: s390x -# musl: musllinux -# - os: ubuntu-latest -# qemu: armv7l -# musl: "" -# - os: ubuntu-latest -# qemu: armv7l -# musl: musllinux -# - os: ubuntu-latest -# musl: musllinux -# - os: ubuntu-24.04-arm -# musl: musllinux + - os: ubuntu-latest + qemu: ppc64le + musl: musllinux + - os: ubuntu-latest + qemu: s390x + musl: "" + - os: ubuntu-latest + qemu: s390x + musl: musllinux + - os: ubuntu-latest + qemu: armv7l + musl: "" + - os: ubuntu-latest + qemu: armv7l + musl: musllinux + - os: ubuntu-latest + musl: musllinux + - os: ubuntu-24.04-arm + musl: musllinux steps: - name: Checkout uses: actions/checkout@v4 @@ -74,18 +74,18 @@ jobs: - name: Update pip, wheel, setuptools, build, twine run: | python -m pip install -U pip wheel setuptools build twine - - name: Install cython - run: >- - python -m - pip install -r requirements/cython.in -c requirements/cython.txt - - name: Restore llhttp generated files - uses: actions/download-artifact@v4 - with: - name: llhttp - path: vendor/llhttp/build/ - - name: Cythonize - run: | - make cythonize +# - name: Install cython +# run: >- +# python -m +# pip install -r requirements/cython.in -c requirements/cython.txt +# - name: Restore llhttp generated files +# uses: actions/download-artifact@v4 +# with: +# name: llhttp +# path: vendor/llhttp/build/ +# - name: Cythonize +# run: | +# make cythonize - name: Build wheels uses: pypa/cibuildwheel@v3.0.1 env: From 4e154862ae8bb56aa6b5be6b393b5fe074d13f3d Mon Sep 17 00:00:00 2001 From: Marek Czaplicki Date: Mon, 14 Jul 2025 17:28:38 +0200 Subject: [PATCH 11/12] Build for all platforms & architectures --- .github/workflows/build.yml | 126 +++++++++++------------------------- 1 file changed, 37 insertions(+), 89 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 084c7dc..d25572d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,96 +8,44 @@ on: workflow_dispatch: jobs: - build-wheels: - permissions: - contents: read # to fetch code (actions/checkout) - - name: Build wheels on ${{ matrix.os }} ${{ matrix.qemu }} ${{ matrix.musl }} + build_wheels: + name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: - fail-fast: false matrix: - os: ["ubuntu-latest", "windows-latest", "macos-latest", "ubuntu-24.04-arm"] - qemu: [''] - musl: [""] - include: - # Split ubuntu/musl jobs for the sake of speed-up - - os: ubuntu-latest - qemu: ppc64le - musl: "" - - os: ubuntu-latest - qemu: ppc64le - musl: musllinux - - os: ubuntu-latest - qemu: s390x - musl: "" - - os: ubuntu-latest - qemu: s390x - musl: musllinux - - os: ubuntu-latest - qemu: armv7l - musl: "" - - os: ubuntu-latest - qemu: armv7l - musl: musllinux - - os: ubuntu-latest - musl: musllinux - - os: ubuntu-24.04-arm - musl: musllinux + os: [ubuntu-20.04, windows-2019, macOS-13] steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: true - - name: Set up QEMU - if: ${{ matrix.qemu }} - uses: docker/setup-qemu-action@v3 - with: - platforms: all - # This should be temporary - # xref https://github.com/docker/setup-qemu-action/issues/188 - # xref https://github.com/tonistiigi/binfmt/issues/215 - image: tonistiigi/binfmt:qemu-v8.1.5 - id: qemu - - name: Prepare emulation - run: | - if [[ -n "${{ matrix.qemu }}" ]]; then - # Build emulated architectures only if QEMU is set, - # use default "auto" otherwise - echo "CIBW_ARCHS_LINUX=${{ matrix.qemu }}" >> $GITHUB_ENV - fi - shell: bash - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: 3.x - - name: Update pip, wheel, setuptools, build, twine - run: | - python -m pip install -U pip wheel setuptools build twine -# - name: Install cython -# run: >- -# python -m -# pip install -r requirements/cython.in -c requirements/cython.txt -# - name: Restore llhttp generated files -# uses: actions/download-artifact@v4 -# with: -# name: llhttp -# path: vendor/llhttp/build/ -# - name: Cythonize -# run: | -# make cythonize - - name: Build wheels - uses: pypa/cibuildwheel@v3.0.1 - env: - CIBW_SKIP: pp* ${{ matrix.musl == 'musllinux' && '*manylinux*' || '*musllinux*' }} - CIBW_ARCHS_MACOS: x86_64 arm64 universal2 - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - name: >- - dist-${{ matrix.os }}-${{ matrix.musl }}-${{ - matrix.qemu - && matrix.qemu - || 'native' - }} - path: ./wheelhouse/*.whl \ No newline at end of file + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.9' + + - name: Set up QEMU + if: runner.os == 'Linux' + # uses: docker/setup-qemu-action@v1.0.1 + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + + - name: Build wheels + # uses: joerick/cibuildwheel@v1.9.0 + uses: pypa/cibuildwheel@v2.23.0 + with: + output-dir: wheelhouse + env: + CIBW_BUILD: '{cp36,cp37,cp38,cp39,cp310,cp311,cp312,cp313}-{manylinux_x86_64,manylinux_aarch64,win32,win_amd64,macosx_x86_64} {cp39,cp310,cp311,cp312,cp313}-macosx_arm64' + CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 + CIBW_ARCHS_LINUX: 'auto aarch64' + CIBW_ARCHS_MACOS: 'auto arm64' + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMAND: 'pytest -s {project}/tests' + CIBW_TEST_SKIP: '*-macosx_arm64' # Until the day Apple silicon instances are available on GitHub Actions + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ strategy.job-index }} + path: ./wheelhouse/*.whl \ No newline at end of file From 2484fd95a909f73da075c10c191608db6b4e6135 Mon Sep 17 00:00:00 2001 From: Marek Czaplicki Date: Mon, 14 Jul 2025 17:51:40 +0200 Subject: [PATCH 12/12] Build for all platforms & architectures --- .github/workflows/build.yml | 1 + src/cityhash.pyx | 8 ++++++-- src/cityhashcrc.pyx | 8 ++++++-- src/farmhash.pyx | 12 +++++++++--- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d25572d..0828616 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,7 @@ jobs: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-20.04, windows-2019, macOS-13] steps: diff --git a/src/cityhash.pyx b/src/cityhash.pyx index 566b8fd..ed0ece8 100644 --- a/src/cityhash.pyx +++ b/src/cityhash.pyx @@ -228,7 +228,9 @@ def CityHash128(data) -> int: PyBuffer_Release(&buf) else: raise _type_error("data", ["basestring", "buffer"], data) - return (long(result.first) << 64ULL) + long(result.second) + cdef unsigned PY_LONG_LONG high = result.first + cdef unsigned PY_LONG_LONG low = result.second + return (high << 64) + low def CityHash128WithSeed(data, seed: int = 0L) -> int: @@ -262,4 +264,6 @@ def CityHash128WithSeed(data, seed: int = 0L) -> int: PyBuffer_Release(&buf) else: raise _type_error("data", ["basestring", "buffer"], data) - return (long(result.first) << 64ULL) + long(result.second) + cdef unsigned PY_LONG_LONG high = result.first + cdef unsigned PY_LONG_LONG low = result.second + return (high << 64) + low diff --git a/src/cityhashcrc.pyx b/src/cityhashcrc.pyx index accd84e..610ece8 100644 --- a/src/cityhashcrc.pyx +++ b/src/cityhashcrc.pyx @@ -106,7 +106,9 @@ def CityHashCrc128(data) -> int: PyBuffer_Release(&buf) else: raise _type_error("data", ["basestring", "buffer"], data) - return (long(result.first) << 64ULL) + long(result.second) + cdef unsigned PY_LONG_LONG high = result.first + cdef unsigned PY_LONG_LONG low = result.second + return (high << 64) + low def CityHashCrc256Bytes(data) -> bytes: @@ -169,4 +171,6 @@ def CityHashCrc128WithSeed(data, seed: int = 0L) -> int: PyBuffer_Release(&buf) else: raise _type_error("data", ["basestring", "buffer"], data) - return (long(result.first) << 64ULL) + long(result.second) + cdef unsigned PY_LONG_LONG high = result.first + cdef unsigned PY_LONG_LONG low = result.second + return (high << 64) + low diff --git a/src/farmhash.pyx b/src/farmhash.pyx index d9bbffb..7123883 100644 --- a/src/farmhash.pyx +++ b/src/farmhash.pyx @@ -325,7 +325,9 @@ def FarmHash128(data) -> int: PyBuffer_Release(&buf) else: raise _type_error("data", ["basestring", "buffer"], data) - return (long(result.first) << 64ULL) + long(result.second) + cdef unsigned PY_LONG_LONG high = result.first + cdef unsigned PY_LONG_LONG low = result.second + return (high << 64) + low def Fingerprint128(data) -> int: @@ -354,7 +356,9 @@ def Fingerprint128(data) -> int: PyBuffer_Release(&buf) else: raise _type_error("data", ["basestring", "buffer"], data) - return (long(result.first) << 64ULL) + long(result.second) + cdef unsigned PY_LONG_LONG high = result.first + cdef unsigned PY_LONG_LONG low = result.second + return (high << 64) + low def FarmHash128WithSeed(data, seed: int = 0L) -> int: @@ -388,4 +392,6 @@ def FarmHash128WithSeed(data, seed: int = 0L) -> int: PyBuffer_Release(&buf) else: raise _type_error("data", ["basestring", "buffer"], data) - return (long(result.first) << 64ULL) + long(result.second) + cdef unsigned PY_LONG_LONG high = result.first + cdef unsigned PY_LONG_LONG low = result.second + return (high << 64) + low