Skip to content

Support windows wheels #124

Support windows wheels

Support windows wheels #124

Workflow file for this run

name: Python wheels
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
#cibw_build: [ "cp3{9,10,11,12}-*" ]
#p_ver: [ "3.9-3.12" ]
cibw_build: [ "cp39-*" ]
p_ver: [ "3.9" ]
# arch: [x86_64, aarch64]
arch: [x86_64, arm64]
exclude:
- os: macos-latest
arch: aarch64
- os: ubuntu-latest
arch: arm64
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Set up QEMU
if: ${{ matrix.arch == 'aarch64' }}
uses: docker/setup-qemu-action@v2
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Install MSVC amd64
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# This step is run when tagging (typically a release)
# Build all wheels
#- name: Sets env vars for tagging
# run: |
# echo "CIBW_BUILD=cp38-* cp39-* cp310-* cp311-*" >> $GITHUB_ENV
# if: startsWith(github.ref, 'refs/tags') == true
#
# # This step is run when not tagging (typically a PR)
# # Build just one wheel
# - name: Sets env vars when not tagging
# run: |
# echo "CIBW_BUILD=cp38-*" >> $GITHUB_ENV
# if: startsWith(github.ref, 'refs/tags') != true
- name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }} - ${{ matrix.p_ver }}
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BEFORE_BUILD: CMAKE_OSX_ARCHITECTURES=x86_64 bash prebuild.sh
CIBW_SKIP: '*-manylinux*_i686 *-musllinux_* ${{ env.CIBW_SKIP}}'
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_TEST_REQUIRES: pytest blosc2
# Test against the test suite in python-blosc2
CIBW_TEST_COMMAND: BTUNE_MODELS_DIR={project}/examples/models BTUNE_BALANCE=.1 BLOSC_TRACE=1 BTUNE_TRACE=1 python -m pytest -s {project}/python-blosc2/tests
CIBW_BUILD_VERBOSITY: 1
CIBW_ARCHS_MACOS: "x86_64"
- name: Build wheels (Mac OSX arm64)
if: runner.os != 'Windows' && runner.os != 'Linux'
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BEFORE_BUILD: CMAKE_OSX_ARCHITECTURES=arm64 bash prebuild.sh
CIBW_SKIP: '*-manylinux*_i686 *-musllinux_* ${{ env.CIBW_SKIP}}'
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_TEST_REQUIRES: pytest blosc2
# Test against the test suite in python-blosc2
CIBW_TEST_COMMAND: BTUNE_MODELS_DIR={project}/examples/models BTUNE_BALANCE=.1 BLOSC_TRACE=1 BTUNE_TRACE=1 python -m pytest -s {project}/python-blosc2/tests
CIBW_BUILD_VERBOSITY: 1
CIBW_ARCHS_MACOS: "arm64"
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
upload_pypi:
needs: [ build_wheels ] # last but not least
runs-on: ubuntu-latest
# Only upload wheels when tagging (typically a release)
if: startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.blosc_pypi_secret }}