|
| 1 | +name: Build wheel |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + release: |
| 6 | + types: |
| 7 | + - published |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + build_wheels: |
| 14 | + name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 15 | + runs-on: ${{ matrix.buildplat[0] }} |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + # From wheel.yml of numpy (https://github.com/numpy/numpy/blob/main/.github/workflows/wheels.yml): |
| 19 | + # Github Actions doesn't support pairing matrix values together, let's improvise |
| 20 | + # https://github.com/github/feedback/discussions/7835#discussioncomment-1769026 |
| 21 | + buildplat: |
| 22 | + - [ubuntu-22.04, manylinux_x86_64] |
| 23 | + - [ubuntu-22.04, musllinux_x86_64] |
| 24 | + - [ubuntu-22.04, manylinux_aarch64] |
| 25 | + - [ubuntu-22.04, musllinux_aarch64] |
| 26 | + - [macos-12, macosx_x86_64] |
| 27 | + - [macos-12, macosx_arm64] |
| 28 | + - [windows-2022, win_amd64] |
| 29 | + - [windows-2022, win32] |
| 30 | + python: ["cp38", "cp39", "cp310", "cp311", "cp312", "pp39"] |
| 31 | + exclude: |
| 32 | + - buildplat: [windows-2022, win32] |
| 33 | + python: "pp39" |
| 34 | + - buildplat: [ ubuntu-22.04, musllinux_x86_64 ] |
| 35 | + python: "pp39" |
| 36 | + - buildplat: [ ubuntu-22.04, musllinux_aarch64 ] |
| 37 | + python: "pp39" |
| 38 | + - buildplat: [macos-12, macosx_arm64] |
| 39 | + python: "pp39" |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + submodules: recursive |
| 46 | + |
| 47 | + - name: Set up QEMU |
| 48 | + if: ${{ contains(matrix.buildplat[1], 'linux_aarch64') }} |
| 49 | + uses: docker/setup-qemu-action@v3 |
| 50 | + with: |
| 51 | + platforms: all |
| 52 | + |
| 53 | + - name: Setup MSVC (32-bit) |
| 54 | + if: ${{ matrix.buildplat[1] == 'win32' }} |
| 55 | + uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1 |
| 56 | + with: |
| 57 | + architecture: 'x86' |
| 58 | + |
| 59 | + - name: Build wheels for manylinux x86_64 |
| 60 | + if: ${{ matrix.buildplat[1] == 'manylinux_x86_64' }} |
| 61 | + uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5 |
| 62 | + env: |
| 63 | + CIBW_PRERELEASE_PYTHONS: True |
| 64 | + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 65 | + CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_28_x86_64 |
| 66 | + CIBW_ARCHS: 'all' |
| 67 | + |
| 68 | + - name: Build wheels for manylinux aarch64 |
| 69 | + if: ${{ matrix.buildplat[1] == 'manylinux_aarch64' }} |
| 70 | + uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5 |
| 71 | + env: |
| 72 | + CIBW_PRERELEASE_PYTHONS: True |
| 73 | + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 74 | + CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/manylinux_2_28_aarch64 |
| 75 | + CIBW_ARCHS: 'all' |
| 76 | + |
| 77 | + - name: Build wheels for musllinux x86_64 |
| 78 | + if: ${{ matrix.buildplat[1] == 'musllinux_x86_64' }} |
| 79 | + uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5 |
| 80 | + env: |
| 81 | + CIBW_PRERELEASE_PYTHONS: True |
| 82 | + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 83 | + CIBW_MUSLLINUX_X86_64_IMAGE: quay.io/pypa/musllinux_1_2_x86_64 |
| 84 | + CIBW_ARCHS: 'all' |
| 85 | + |
| 86 | + - name: Build wheels for musllinux aarch64 |
| 87 | + if: ${{ matrix.buildplat[1] == 'musllinux_aarch64' }} |
| 88 | + uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5 |
| 89 | + env: |
| 90 | + CIBW_PRERELEASE_PYTHONS: True |
| 91 | + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 92 | + CIBW_MUSLLINUX_AARCH64_IMAGE: quay.io/pypa/musllinux_1_2_aarch64 |
| 93 | + CIBW_ARCHS: 'all' |
| 94 | + |
| 95 | + - name: Build wheels |
| 96 | + if: ${{ !contains(matrix.buildplat[1], 'linux') }} |
| 97 | + uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5 |
| 98 | + env: |
| 99 | + CIBW_PRERELEASE_PYTHONS: True |
| 100 | + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 101 | + CIBW_ARCHS: 'all' |
| 102 | + |
| 103 | + - uses: actions/upload-artifact@v3 |
| 104 | + with: |
| 105 | + path: ./wheelhouse/*.whl |
| 106 | + |
| 107 | + build_sdist: |
| 108 | + name: Build source distribution |
| 109 | + runs-on: ubuntu-latest |
| 110 | + steps: |
| 111 | + - name: Checkout |
| 112 | + uses: actions/checkout@v4 |
| 113 | + with: |
| 114 | + submodules: recursive |
| 115 | + |
| 116 | + - name: Build sdist |
| 117 | + run: pipx run build --sdist |
| 118 | + |
| 119 | + - uses: actions/upload-artifact@v3 |
| 120 | + with: |
| 121 | + path: dist/*.tar.gz |
| 122 | + |
| 123 | + upload_pypi: |
| 124 | + needs: [build_wheels, build_sdist] |
| 125 | + runs-on: ubuntu-latest |
| 126 | + environment: |
| 127 | + name: pypi |
| 128 | + url: https://pypi.org/p/lcsvec |
| 129 | + permissions: |
| 130 | + id-token: write |
| 131 | + steps: |
| 132 | + - uses: actions/download-artifact@v3 |
| 133 | + with: |
| 134 | + # unpacks default artifact into dist/ |
| 135 | + # if `name: artifact` is omitted, the action will create extra parent dir |
| 136 | + name: artifact |
| 137 | + path: dist |
| 138 | + |
| 139 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 140 | + #with: |
| 141 | + # To test: repository-url: https://test.pypi.org/legacy/ |
0 commit comments