From f44db1a50b9750987235acd0544febc2cf764040 Mon Sep 17 00:00:00 2001
From: PrimozGodec
Date: Fri, 15 Sep 2023 08:50:17 +0200
Subject: [PATCH] Build also macos arm wheels and update the building wokflow
---
.github/workflows/build_wheels.yml | 54 ++++++++++++++++++++-------
orangecontrib/associate/_fpgrowth.cpp | 2 +-
pyproject.toml | 14 +++++++
setup.py | 3 +-
4 files changed, 58 insertions(+), 15 deletions(-)
diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml
index 2c11632..e1660b2 100644
--- a/.github/workflows/build_wheels.yml
+++ b/.github/workflows/build_wheels.yml
@@ -8,28 +8,56 @@ on:
workflow_dispatch:
jobs:
+ generate-wheels-matrix:
+ # Create a matrix of all architectures & versions to build.
+ # This enables the next step to run cibuildwheel in parallel.
+ # From https://iscinumpy.dev/post/cibuildwheel-2-10-0/#only-210
+ name: Generate wheels matrix
+ runs-on: ubuntu-latest
+ outputs:
+ include: ${{ steps.set-matrix.outputs.include }}
+ steps:
+ - uses: actions/checkout@v3
+ - name: Install cibuildwheel
+ # Nb. keep cibuildwheel version pin consistent with job below
+ run: pipx install cibuildwheel==2.14.1
+ - id: set-matrix
+ run: |
+ MATRIX=$(
+ {
+ cibuildwheel --print-build-identifiers --platform linux \
+ | jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \
+ && cibuildwheel --print-build-identifiers --platform macos \
+ | jq -nRc '{"only": inputs, "os": "macos-latest"}' \
+ && cibuildwheel --print-build-identifiers --platform windows \
+ | jq -nRc '{"only": inputs, "os": "windows-latest"}'
+ } | jq -sc
+ )
+ echo "include=$MATRIX" >> $GITHUB_OUTPUT
+
build_wheels:
- name: Build wheels on ${{ matrix.os }}
+ name: Build ${{ matrix.only }}
+ needs: generate-wheels-matrix
runs-on: ${{ matrix.os }}
strategy:
+ fail-fast: false
matrix:
- os: [ubuntu-20.04, windows-2019, macOS-10.15]
+ include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
- # Used to host cibuildwheel
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v2
-
- - name: Install cibuildwheel
- run: python -m pip install cibuildwheel==1.9.0
+ - name: Set up QEMU
+ if: runner.os == 'Linux'
+ uses: docker/setup-qemu-action@v2
+ with:
+ platforms: all
- name: Build wheels
- run: python -m cibuildwheel --output-dir wheelhouse
- env:
- CIBW_SKIP: "cp27-* cp35-* pp*"
+ uses: pypa/cibuildwheel@v2.14.1
+ with:
+ only: ${{ matrix.only }}
- uses: actions/upload-artifact@v2
with:
@@ -61,6 +89,7 @@ jobs:
name: Upload Release Assets
needs: [build_wheels]
runs-on: ubuntu-20.04
+ if: startsWith(github.ref, 'refs/tags')
steps:
- name: Download bdist files
@@ -83,6 +112,7 @@ jobs:
name: PyPI Publish
needs: [build_wheels, build_sdist]
runs-on: ubuntu-20.04
+ if: startsWith(github.ref, 'refs/tags')
steps:
- name: Download bdist files
@@ -106,5 +136,3 @@ jobs:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: downloads/
- # repository_url: https://test.pypi.org/legacy/
- # verbose: true
diff --git a/orangecontrib/associate/_fpgrowth.cpp b/orangecontrib/associate/_fpgrowth.cpp
index c43d384..0c5c611 100644
--- a/orangecontrib/associate/_fpgrowth.cpp
+++ b/orangecontrib/associate/_fpgrowth.cpp
@@ -2643,7 +2643,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
}
#if CYTHON_USE_PYLONG_INTERNALS
- #include "longintrepr.h"
+ #include "Python.h"
#endif
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
diff --git a/pyproject.toml b/pyproject.toml
index d5807f1..4910d95 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,3 +4,17 @@ requires = [
'wheel',
]
build-backend = 'setuptools.build_meta'
+
+[tool.cibuildwheel]
+# todo: skipping cp311 since _fpgrowth not compatible, fix it and then enalbe cp311
+skip = ["cp36-*", "cp37-*", "cp38-*", "cp311-*", "pp*", "*-musllinux_*"]
+build-verbosity = 2
+
+[tool.cibuildwheel.linux]
+archs = ["x86_64", "aarch64"]
+
+[tool.cibuildwheel.windows]
+archs = ["AMD64"]
+
+[tool.cibuildwheel.macos]
+archs = ["x86_64", "arm64"]
\ No newline at end of file
diff --git a/setup.py b/setup.py
index b5b3ae2..6c09596 100644
--- a/setup.py
+++ b/setup.py
@@ -77,7 +77,8 @@ def do_setup(ext_modules):
'Intended Audience :: Developers',
],
zip_safe=False,
- include_package_data=True
+ include_package_data=True,
+ python_requires='>=3.9'
)