Update README.md #218
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
env: | |
CIBW_SKIP: '*-win32 *-manylinux*_i686 *-musllinux_*' | |
CIBW_TEST_REQUIRES: blosc2 pillow | |
CIBW_TEST_SKIP: "*macosx*arm64*" | |
CIBW_TEST_COMMAND: 'BTUNE_TRACE=1 python {project}/examples/btune_config.py; | |
BTUNE_TRADEOFF="(0.3, 0.1, 0.6)" BTUNE_PERF_MODE=DECOMP BTUNE_TRACE=1 python {project}/examples/lossy.py {project}/examples/lossy_example.tif' | |
CIBW_BUILD_VERBOSITY: 1 | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }} - ${{ matrix.p_ver }} | |
runs-on: ${{ matrix.os }} | |
env: | |
CIBW_BUILD: ${{ matrix.cibw_build }} | |
CIBW_ARCHS_LINUX: ${{ matrix.arch }} | |
CIBW_ARCHS_MACOS: "x86_64 arm64" | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
arch: [x86_64, aarch64] | |
#cibw_build: ["cp3{9,10,11,12}-*"] | |
#p_ver: ["3.9-3.12"] | |
cibw_build: ["cp310-*"] | |
p_ver: ["3.10"] | |
exclude: | |
- os: windows-latest | |
arch: aarch64 | |
# cibuild is already in charge to build aarch64 (see CIBW_ARCHS_MACOS) | |
- os: macos-latest | |
arch: aarch64 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- 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 dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements-build.txt | |
- name: Build wheels (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install cibuildwheel | |
python -m cibuildwheel --output-dir wheelhouse | |
env: | |
CIBW_BEFORE_BUILD: bash prebuild.sh | |
CIBW_TEST_COMMAND: > | |
cmd /V /C "set BTUNE_TRACE=1; python {project}/examples/btune_config.py" && | |
cmd /V /C "set BTUNE_TRACE=1; set BTUNE_TRADEOFF="(0.3, 0.1, 0.6)"; set BTUNE_PERF_MODE=DECOMP; | |
python {project}/examples/lossy.py {project}/examples/lossy_example.tif" | |
- name: Build wheels (Linux / Mac OSX) | |
if: runner.os != 'Windows' | |
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_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_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 }} |