Skip to content

Commit

Permalink
Merge pull request #256 from PrimozGodec/fix-ci-buil-wheels
Browse files Browse the repository at this point in the history
[CI] Wheels - Update wheels building
  • Loading branch information
PrimozGodec committed Jul 31, 2023
2 parents 4de27c4 + dfbd087 commit 1dd5cf1
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 19 deletions.
63 changes: 44 additions & 19 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,57 @@ 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-latest, windows-latest, macOS-latest]

include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

# 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
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
name: bdist_files
Expand All @@ -41,18 +68,18 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4

- name: Build sdist (pep517)
run: |
python -m pip install pep517
python -m pep517.build -s .
- name: Upload sdist
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: sdist_files
path: dist/*.tar.gz
Expand Down Expand Up @@ -108,5 +135,3 @@ jobs:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: downloads/
# repository_url: https://test.pypi.org/legacy/
# verbose: true
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
[build-system]
requires = ["setuptools", "wheel", "cython", "oldest-supported-numpy"]
build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
# Restrict the set of builds to mirror the wheels available in Orange3.
skip = ["cp36-*", "cp37-*", "pp*", "*-musllinux_*"]
build-verbosity = 2
test-requires = ["pyqt5", "pytest"]

[tool.cibuildwheel.linux]
archs = ["x86_64", "aarch64"]

[tool.cibuildwheel.windows]
archs = ["AMD64"]

[tool.cibuildwheel.macos]
archs = ["x86_64", "arm64"]
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def include_documentation(local_dir, install_dir):
ext_modules=cythonize(EXTENSIONS),
package_data=PACKAGE_DATA,
data_files=DATA_FILES,
python_requires=">=3.8",
setup_requires=SETUP_REQUIRES,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
Expand Down

0 comments on commit 1dd5cf1

Please sign in to comment.