Skip to content

Bump actions/cache from 5 to 6 #2285

Bump actions/cache from 5 to 6

Bump actions/cache from 5 to 6 #2285

Workflow file for this run

name: Python wheels
on:
# Trigger the workflow only for tags and PRs to the main branch
push:
tags:
- '*'
pull_request:
branches:
- main
env:
CIBW_BUILD_VERBOSITY: 1
# Skip testing on aarch64 for now, as it is emulated on GitHub Actions and takes too long
# Now that github provides native arm64 runners, we can enable tests again
# CIBW_TEST_SKIP: "*linux*aarch64*"
# Skip PyPy wheels for now (numexpr needs some adjustments first)
# musllinux takes too long to build, and it's not worth it for now
CIBW_SKIP: "pp* *musllinux* *-win32"
# Use explicit generator/compiler env vars; CMAKE_ARGS with spaces is not split on Windows.
CIBW_ENVIRONMENT_WINDOWS: >-
CMAKE_GENERATOR=Ninja
CC=clang-cl
CXX=clang-cl
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }}
runs-on: ${{ matrix.runs-on || matrix.os }}
permissions:
contents: write
env:
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_ARCHS_MACOS: "x86_64 arm64"
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64 builds
- os: ubuntu-latest
arch: x86_64
cibw_pattern: "cp3{11,12,13,14}-manylinux*"
artifact_name: "linux-x86_64"
# Linux ARM64 builds (native runners)
- os: ubuntu-24.04-arm
arch: aarch64
cibw_pattern: "cp3{11,12,13,14}-manylinux*"
artifact_name: "linux-aarch64"
# Don't use native runners for now (looks like wait times are too long)
#runs-on: ["ubuntu-latest", "arm64"]
# Windows builds
- os: windows-latest
arch: x86_64
cibw_pattern: "cp3{11,12,13,14}-win64"
artifact_name: "windows-x86_64"
# macOS builds (universal2)
- os: macos-latest
arch: x86_64
cibw_pattern: "cp3{11,12,13,14}-macosx*"
artifact_name: "macos-universal2"
steps:
- name: Checkout repo
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
# Use the most recent released python
python-version: '3.x'
# For some reason, this is still needed, even when using new arm64 runners
# - name: Set up QEMU
# if: ${{ matrix.arch == 'aarch64' }}
# uses: docker/setup-qemu-action@v3
- name: Install Ninja
id: ninja
uses: turtlesec-no/get-ninja@main
- name: Add LLVM to PATH (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: echo "C:\\Program Files\\LLVM\\bin" >> $env:GITHUB_PATH
- name: Install MSVC amd64
uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: amd64
- name: Build wheels
uses: pypa/cibuildwheel@v4.1
- name: Make sdist
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
python -m pip install build
python -m build --sdist --outdir wheelhouse .
- name: Build building extension from sdist package
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cd ./wheelhouse
tar -xzf blosc2-*.tar.gz
cd ./blosc2-*/
python -m venv sdist_test_env
source sdist_test_env/bin/activate
pip install pip --upgrade
pip install --break-system-packages -e . --group test
- name: Test sdist package with pytest
if: ${{ matrix.os == 'ubuntu-latest' }}
timeout-minutes: 10
run: |
cd ./wheelhouse/blosc2-*/
source sdist_test_env/bin/activate
python -m pytest tests/test_open.py tests/test_vlmeta.py tests/ndarray/test_evaluate.py
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact_name }}
path: |
./wheelhouse/*.whl
./wheelhouse/*.tar.gz
build_wheels_wasm:
name: Build WASM/Pyodide wheels for ${{ matrix.p_ver }}
runs-on: ubuntu-latest
env:
CIBW_BUILD: ${{ matrix.cibw_build }}
# WASM/Pyodide has no SIMD/runtime CPU detection; disable optimised paths
CMAKE_ARGS: "-DWITH_ZLIB_OPTIM=OFF -DWITH_OPTIM=OFF -DWITH_RUNTIME_CPU_DETECTION=OFF"
CIBW_TEST_COMMAND: "pytest {project}/tests"
# Pin the Pyodide version explicitly per target for reproducible builds.
# Note: in-memory SChunk get_slice is broken on the Pyodide 0.29.x
# Emscripten toolchain (works on 314); see gh-664. The affected test is
# xfailed on WASM, so the cp313 pin just matches cibuildwheel's default.
CIBW_PYODIDE_VERSION: ${{ matrix.pyodide_version }}
strategy:
fail-fast: false
matrix:
include:
# Python 3.13 -> pyemscripten_2025_0
- p_ver: "3.13"
cibw_build: "cp313-*"
pyodide_version: "0.29.4"
artifact_name: "wasm-pyodide-cp313"
# Python 3.14 -> pyemscripten_2026_0
- p_ver: "3.14"
cibw_build: "cp314-*"
pyodide_version: "314.0.0"
artifact_name: "wasm-pyodide-cp314"
steps:
- name: Checkout repo
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake
- name: Install cibuildwheel
run: pip install "cibuildwheel==4.1.*"
- name: Build wheels
# Testing is performed automatically by cibuildwheel (via node).
# platform=pyodide can only be set via the CLI flag, not an env var.
run: cibuildwheel --platform pyodide
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact_name }}
path: ./wheelhouse/*.whl
upload_pypi:
needs: [ build_wheels, build_wheels_wasm ]
runs-on: ubuntu-latest
# Only upload wheels when tagging (typically a release)
if: startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v8
with:
path: ./wheelhouse
merge-multiple: true # Merge all the wheels artifacts into one directory
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.blosc_pypi_secret }}
packages-dir: wheelhouse/