fix: update settings for publish #169
This file contains hidden or 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: Build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: | |
| - master | |
| permissions: | |
| contents: read | |
| env: | |
| PYICU_VERSION: "2.15.2" | |
| LIBICU_VERSION: "77" | |
| jobs: | |
| linux: | |
| name: Linux wheels (${{ matrix.cpy }}-${{ matrix.platform }}_${{ matrix.arch }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: | |
| - "x86_64" | |
| - "aarch64" | |
| - "i686" | |
| - "ppc64le" | |
| cpy: | |
| - "cp310" | |
| - "cp311" | |
| - "cp312" | |
| - "cp313" | |
| - "cp314" | |
| - "cp314t" | |
| platform: | |
| - "manylinux" | |
| - "musllinux" | |
| env: | |
| _LIBICU_DIR: "/host/tmp/.build" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Hatch | |
| run: pip install --upgrade hatch | |
| - name: Cache pyicu | |
| id: cache-pyicu | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/pyicu | |
| key: ${{ runner.os }}-pyicu-${{ env.PYICU_VERSION }} | |
| - name: Fetch pyicu source | |
| if: steps.cache-pyicu.outputs.cache-hit != 'true' | |
| run: hatch run pyicu:clone | |
| - name: Copy src and tests | |
| run: | | |
| hatch run pyicu:src | |
| hatch run pyicu:tests | |
| - name: Cache libicu | |
| id: cache-libicu | |
| uses: actions/cache@v4 | |
| with: | |
| path: "/tmp/.build" | |
| key: libicu-${{ matrix.platform }}-${{ matrix.arch }}-${{ env.LIBICU_VERSION }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: all | |
| # See https://github.com/pypa/cibuildwheel/discussions/2256 | |
| image: tonistiigi/binfmt:qemu-v8.1.5 | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.2.0 | |
| env: | |
| CIBW_BUILD: ${{ matrix.cpy }}-${{ matrix.platform }}_${{ matrix.arch }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cibw-linux-${{ matrix.cpy }}-${{ matrix.platform }}_${{ matrix.arch }} | |
| path: ./wheelhouse/*.whl | |
| macos: | |
| name: macOS wheels (${{ matrix.cpy }}-macosx_${{ matrix.macos }}_${{ matrix.arch }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: | |
| - "x86_64" | |
| - "arm64" | |
| cpy: | |
| - "cp310" | |
| - "cp311" | |
| - "cp312" | |
| - "cp313" | |
| - "cp314" | |
| - "cp314t" | |
| include: | |
| - arch: "x86_64" | |
| macos: 15 | |
| brew: "/usr/local/opt" | |
| runner: "macos-15-intel" | |
| - arch: "arm64" | |
| macos: 15 | |
| brew: "/opt/homebrew/opt" | |
| runner: "macos-15" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Hatch | |
| run: pip install --upgrade hatch | |
| - name: Cache pyicu | |
| id: cache-pyicu | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/pyicu | |
| key: ${{ runner.os }}-pyicu-${{ env.PYICU_VERSION }} | |
| - name: Fetch pyicu source | |
| if: steps.cache-pyicu.outputs.cache-hit != 'true' | |
| run: hatch run pyicu:clone | |
| - name: Copy src and tests | |
| run: | | |
| hatch run pyicu:src | |
| hatch run pyicu:tests | |
| - name: Install build dependencies | |
| run: | | |
| brew update | |
| brew install icu4c@${{ env.LIBICU_VERSION }} | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.2.0 | |
| env: | |
| CIBW_BUILD: ${{ matrix.cpy }}-macosx_${{ matrix.arch }} | |
| CIBW_ARCHS_MACOS: ${{matrix.arch}} | |
| CIBW_ENVIRONMENT: >- | |
| MACOSX_DEPLOYMENT_TARGET="${{ matrix.macos }}.0" | |
| _LIBICU_DIR="${{ matrix.brew }}/icu4c@${{ env.LIBICU_VERSION }}" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cibw-macos-${{ matrix.macos }}-${{ matrix.cpy }}-macosx_${{ matrix.arch }} | |
| path: ./wheelhouse/*.whl | |
| windows: | |
| name: Windows wheels (${{ matrix.cpy }}-${{ matrix.cibw_build_suffix }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: | |
| - "AMD64" | |
| - "ARM64" | |
| - "x86" | |
| cpy: | |
| - "cp310" | |
| - "cp311" | |
| - "cp312" | |
| - "cp313" | |
| - "cp314" | |
| - "cp314t" | |
| include: | |
| - arch: "AMD64" | |
| runner: "windows-latest" | |
| cibw_build_suffix: "win_amd64" | |
| icu_plat: "Win64-MSVC2022" | |
| icu_lib_suffix: "64" | |
| - arch: "ARM64" | |
| runner: "windows-11-arm" | |
| cibw_build_suffix: "win_arm64" | |
| icu_plat: "WinARM64-MSVC2022" | |
| icu_lib_suffix: "ARM64" | |
| - arch: "x86" | |
| runner: "windows-latest" | |
| cibw_build_suffix: "win32" | |
| icu_plat: "Win32-MSVC2022" | |
| icu_lib_suffix: "" | |
| env: | |
| _LIBICU_DIR: "C:\\icu" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Hatch | |
| run: pip install --upgrade hatch | |
| - name: Cache pyicu | |
| id: cache-pyicu | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/pyicu | |
| key: ${{ runner.os }}-pyicu-${{ env.PYICU_VERSION }} | |
| - name: Fetch pyicu source | |
| if: steps.cache-pyicu.outputs.cache-hit != 'true' | |
| run: hatch run pyicu:clone | |
| - name: Copy src and tests | |
| run: | | |
| hatch run pyicu:src | |
| hatch run pyicu:tests | |
| # NOTE: only required for v2.15.2 | |
| - name: Patch pyicu for MSVC | |
| shell: python | |
| run: | | |
| import pathlib | |
| f = pathlib.Path("pyicu/arg.h") | |
| t = f.read_text() | |
| if "#ifndef _MSC_VER" not in t: | |
| t = t.replace("#define _IS_POD(T)", "#ifndef _MSC_VER\n#define _IS_POD(T)") | |
| t = t.replace("#undef _IS_POD", "#undef _IS_POD\n#endif") | |
| f.write_text(t) | |
| - name: Cache libicu | |
| id: cache-libicu | |
| uses: actions/cache@v4 | |
| with: | |
| path: C:\icu | |
| key: libicu-windows-${{ matrix.arch }}-${{ env.LIBICU_VERSION }} | |
| - name: Install libicu | |
| if: steps.cache-libicu.outputs.cache-hit != 'true' | |
| run: powershell -File scripts/install-libicu.ps1 | |
| env: | |
| ICU_PLAT: ${{ matrix.icu_plat }} | |
| ICU_LIB_SUFFIX: ${{ matrix.icu_lib_suffix }} | |
| - name: Copy ICU DLLs to package | |
| run: Copy-Item -Path "$env:_LIBICU_DIR\bin\icu*.dll" -Destination "src\icu\" -Force | |
| shell: pwsh | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.2.0 | |
| env: | |
| CIBW_BUILD: ${{ matrix.cpy }}-${{ matrix.cibw_build_suffix }} | |
| CIBW_ARCHS_WINDOWS: ${{ matrix.arch }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cibw-windows-${{ matrix.cpy }}-${{ matrix.cibw_build_suffix }} | |
| path: ./wheelhouse/*.whl | |
| publish: | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| name: Publish wheels | |
| runs-on: ubuntu-latest | |
| needs: | |
| - linux | |
| - macos | |
| - windows | |
| environment: | |
| name: release | |
| url: https://pypi.org/project/pyicu-wheels | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: cibw-* | |
| path: dist | |
| merge-multiple: true | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true | |
| print-hash: true | |
| verbose: true |