Update pre-commit hooks #1400
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: | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
env: | |
CIBW_BUILD_VERBOSITY: 1 | |
# Skip aarch64 for now, as it is emulated on GitHub Actions and takes too long | |
CIBW_TEST_SKIP: "*linux*aarch64*" | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }} - ${{ matrix.p_ver }} | |
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: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
arch: [x86_64, aarch64] | |
# Just build for x86_64 for now (Mac arm64 is already covered by cibuildwheel) | |
# arch: [x86_64] | |
cibw_build: ["cp3{10,11,12}-*"] | |
p_ver: ["3.10-3.12"] | |
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@v4 | |
with: | |
# Fetch all history for all branches and tags | |
# (important for guessing the correct version with setuptools_scm) | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
# Use the most recent released python | |
python-version: '3.x' | |
- 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: Install MSVC amd64 | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
# TODO: fix this when releasing Python 3.13 wheels | |
# env: | |
# # Python 3.13 fails with: | |
# # from blosc2.schunk import SChunk | |
# # ../venv/lib/python3.13/site-packages/blosc2/schunk.py:1346: in <module> | |
# # @_inherit_doc_parameter(blosc2.Storage, "initial_mapping_size:", {r"r\+ w\+, or c": "r+ or c"}) | |
# # ../venv/lib/python3.13/site-packages/blosc2/helpers.py:15: in wrapper | |
# # match is not None | |
# # E AssertionError: Parameter initial_mapping_size: not found in the docstring of Storage | |
# # I don't see obvious way to fix this, so we skip it for now | |
# CIBW_BEFORE_TEST: | | |
# if [ "$RUNNER_OS" == "Windows" ]; then | |
# if [ "%PYTHON_VERSION%" == "3.13" ]; then | |
# echo "Skipping tests for Python 3.13 on Windows" | |
# exit 0 | |
# fi | |
# else | |
# if [ "${{ matrix.p_ver }}" == "3.13" ]; then | |
# echo "Skipping tests for Python 3.13 on Unix-like systems" | |
# exit 0 | |
# fi | |
# fi | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
arch: [auto] | |
exclude: | |
- os: [ubuntu-latest] | |
# We don't support 32-bit platforms in python-blosc2 | |
arch: x86 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Fetch all history for all branches and tags | |
# (important for guessing the correct version with setuptools_scm) | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
name: Setup Python ${{ matrix.python-version }} | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build sdist | |
run: pipx run build --sdist | |
- name: Upload sdist package | |
uses: actions/upload-artifact@v4 | |
with: | |
path: dist/*.tar.gz | |
- name: Build building extension from sdist package | |
run: | | |
cd ./dist | |
tar -xzf blosc2-*.tar.gz | |
cd ./blosc2-*/ | |
pip install pip --upgrade | |
pip install --break-system-packages -e .[test] | |
- name: Test sdist package with pytest | |
run: | | |
cd ./dist/blosc2-*/ | |
pytest | |
upload_pypi: | |
needs: [ build_wheels, build_sdist ] # 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 }} |