diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 645bf782..c378a6d3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,13 @@ jobs: matrix: python-version: ["3.12", "3.13", "3.14", "3.14t"] # macos-15-large is an intel runner, macos-14 is an arm64 runner - platform: [ubuntu-latest, ubuntu-22.04-arm, windows-latest, macos-15-large, macos-14] + platform: [ubuntu-latest, ubuntu-22.04-arm, windows-latest, windows-11-arm, macos-15-large, macos-14] + exclude: + # Free-threaded win_arm64 is skipped because CPython's _Py_ThreadId() + # tries calling __getReg() that CLANGARM64 clang does not provide. + # https://github.com/python/cpython/issues/157212 + - python-version: "3.14t" + platform: windows-11-arm defaults: run: @@ -33,9 +39,30 @@ jobs: python-version: ${{ matrix.python-version }} cache: 'pip' + - name: Set up MSYS2 + if: runner.os == 'Windows' + id: msys2 + uses: msys2/setup-msys2@v2 + with: + msystem: ${{ runner.arch == 'ARM64' && 'CLANGARM64' || 'CLANG64' }} + pacboy: clang:p + + # Prepended to PATH so clang wins over the x86_64 MinGW gcc in the runner image + - name: Select the MSYS2 clang toolchain + if: runner.os == 'Windows' + env: + MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }} + MSYS2_PREFIX: ${{ runner.arch == 'ARM64' && 'clangarm64' || 'clang64' }} + run: | + echo "$MSYS2_LOCATION/$MSYS2_PREFIX/bin" >> $GITHUB_PATH + echo "CC=clang" >> $GITHUB_ENV + - name: Install numcodecs + # zfpy does not have a win_arm64 wheel if: ${{ !endsWith(matrix.python-version, 't') }} - run: python -m pip install -v ".[test,test_extras,msgpack,google_crc32c,crc32c,pcodec,zfpy]" + env: + ZFPY_EXTRA: ${{ matrix.platform != 'windows-11-arm' && ',zfpy' || '' }} + run: python -m pip install -v ".[test,test_extras,msgpack,google_crc32c,crc32c,pcodec$ZFPY_EXTRA]" - name: Install numcodecs (free-threaded) # pcodec, zfpy and google_crc32c do not ship free-threaded wheels yet diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index d8fa6ab1..b51fd4f2 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -20,13 +20,16 @@ jobs: fail-fast: false matrix: # macos-15-large is an intel runner, macos-14 is an arm64 runner - os: [ubuntu-latest, ubuntu-22.04-arm, windows-latest, macos-15-large, macos-14] + os: [ubuntu-latest, ubuntu-22.04-arm, windows-latest, windows-11-arm, macos-15-large, macos-14] env: # on free-threaded builds also check that no extension re-enables the GIL CIBW_TEST_COMMAND: python -c "import sys, sysconfig, numcodecs; assert not (sysconfig.get_config_var('Py_GIL_DISABLED') and sys._is_gil_enabled())" CIBW_BUILD: "cp312-* cp313-* cp314-* cp314t-*" CIBW_ENABLE: cpython-freethreading - CIBW_SKIP: "*-musllinux_* *win32 *_i686 *_s390x" + # Free-threaded win_arm64 is skipped because CPython's _Py_ThreadId() + # tries calling __getReg() that CLANGARM64 clang does not provide. + # https://github.com/python/cpython/issues/157212 + CIBW_SKIP: "*-musllinux_* *win32 *_i686 *_s390x cp314t-win_arm64" # note: cibuildwheel config-settings are set in pyproject.toml steps: @@ -35,6 +38,25 @@ jobs: submodules: true fetch-depth: 0 # required for version resolution for nightly wheels + - name: Set up MSYS2 + if: runner.os == 'Windows' + id: msys2 + uses: msys2/setup-msys2@v2 + with: + msystem: ${{ runner.arch == 'ARM64' && 'CLANGARM64' || 'CLANG64' }} + pacboy: clang:p + + # Prepended to PATH so clang wins over the x86_64 MinGW gcc in the runner image + - name: Select the MSYS2 clang toolchain + if: runner.os == 'Windows' + shell: bash + env: + MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }} + MSYS2_PREFIX: ${{ runner.arch == 'ARM64' && 'clangarm64' || 'clang64' }} + run: | + echo "$MSYS2_LOCATION/$MSYS2_PREFIX/bin" >> $GITHUB_PATH + echo "CC=clang" >> $GITHUB_ENV + - uses: pypa/cibuildwheel@v3.4.1 - uses: actions/upload-artifact@v7 diff --git a/pyproject.toml b/pyproject.toml index 185ecc3a..29ca222f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -158,10 +158,19 @@ filterwarnings = [ # AVX2 disabled for portable wheels (not all x86_64 CPUs have it) config-settings = "setup-args=-Davx2=disabled" +[tool.cibuildwheel.windows] +# Vendor any MSYS2 clang runtime DLLs the extensions end up linking against +before-build = "pip install delvewheel" +repair-wheel-command = "delvewheel repair -w {dest_dir} {wheel}" + [[tool.cibuildwheel.overrides]] select = "*-macosx_arm64" config-settings = {setup-args = ["-Davx2=disabled", "-Dsse2=disabled"]} +[[tool.cibuildwheel.overrides]] +select = "*-win_arm64" +config-settings = {setup-args = ["-Davx2=disabled", "-Dsse2=disabled"]} + [tool.ruff] line-length = 100 extend-exclude = ["c-blosc"]