Skip to content

Commit

Permalink
build wheels for windows separately from macOs and linux
Browse files Browse the repository at this point in the history
  • Loading branch information
joamatab committed Nov 14, 2022
1 parent f8ae2b4 commit 76f16a4
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 79 deletions.
147 changes: 68 additions & 79 deletions .github/workflows/pypi-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,111 +5,100 @@ on:
workflow_dispatch:

jobs:
make_wheels:
name: Make MacOs and Widows wheels
build_wheels:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 12
matrix:
python-version: ["3.10"]
os: [macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm
submodules: true # Optional, use if you have submodules
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.9
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
activate-environment: anaconda-client-env
- name: Build SDist
run: |
mamba install zlib cmake numpy -y
pipx install numpy
pipx run build
- uses: actions/upload-artifact@v3
with:
path: dist/*
- uses: actions/checkout@v3
- name: Build wheels # check https://cibuildwheel.readthedocs.io/en/stable/setup/#github-actions
uses: pypa/[email protected]
# to supply options, put them in 'env', like:
# env:
# CIBW_SOME_OPTION: value
# env:
# CIBW_BUILD: ${{ matrix.cibuild }}
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

make_linux_wheels:
name: Make Linux wheels
runs-on: ${{ matrix.os }}
build_windows_wheels:
runs-on: windows-latest
strategy:
fail-fast: false
max-parallel: 12
matrix:
python-version: ["3.10"]
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm
submodules: true # Optional, use if you have submodules
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.9
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
activate-environment: anaconda-client-env
- name: Build SDist
run: |
mamba install zlib cmake numpy -y
python -m pip install numpy
python setup.py bdist_wheel --universal
- uses: actions/upload-artifact@v3
with:
path: dist/*
- uses: actions/checkout@v3
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install build dependencies
run: |
python -m pip install --upgrade pip wheel oldest-supported-numpy
python -m pip install conan ninja
conan install zlib/1.2.13@ -s compiler.version=16 -g cmake_paths
- name: Build Python ${{ matrix.python-version }} wheel
run: |
python setup.py bdist_wheel
env:
CMAKE_GENERATOR: "Ninja"
CMAKE_TOOLCHAIN_FILE: "conan_paths.cmake"
- uses: actions/upload-artifact@v3
with:
name: packages
path: "dist/*.whl"

make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm
submodules: true # Optional, use if you have submodules

- name: Build SDist
run: pipx run build --sdist
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm
submodules: true # Optional, use if you have submodules

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
- name: Build SDist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

upload_to_test_pypy:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [make_sdist, make_wheels, make_linux_wheels]
needs: [make_sdist, build_wheels, build_windows_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/[email protected]
continue-on-error: true # might fail if we don't bump the version
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- uses: pypa/[email protected]
continue-on-error: true # might fail if we don't bump the version
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

upload_to_pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [make_sdist, make_wheels, make_linux_wheels]
needs: [make_sdist, build_wheels, build_windows_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ requires = [
"Cython",
"numpy",
]

[tool.cibuildwheel]
manylinux-x86_64-image = "manylinux_2_28"
musllinux-x86_64-image = "musllinux_1_1"
skip = ["*-win32", "*-manylinux_i686", "*musllinux*"]

0 comments on commit 76f16a4

Please sign in to comment.