|
| 1 | +name: build-wheels-push |
| 2 | + |
| 3 | +# on: [push] |
| 4 | + |
| 5 | +on: |
| 6 | + release: |
| 7 | + types: |
| 8 | + - published |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + build_wheels: |
| 16 | + name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 17 | + runs-on: ${{ matrix.buildplat[0] }} |
| 18 | + environment: pypi |
| 19 | + strategy: |
| 20 | + # Ensure that a wheel builder finishes even if another fails |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + # From NumPy |
| 24 | + # Github Actions doesn't support pairing matrix values together, let's improvise |
| 25 | + # https://github.com/github/feedback/discussions/7835#discussioncomment-1769026 |
| 26 | + buildplat: |
| 27 | + - [ubuntu-20.04, manylinux_x86_64] |
| 28 | + - [ubuntu-20.04, musllinux_x86_64] # No OpenBlas, no test |
| 29 | + - [macos-12, macosx_x86_64] |
| 30 | + - [macos-14, macosx_arm64] |
| 31 | + - [windows-2019, win_amd64] |
| 32 | + python: ["cp38", "cp39","cp310", "cp311","cp312"] |
| 33 | + |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + - name: Build wheels |
| 37 | + |
| 38 | + env: |
| 39 | + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} |
| 40 | + - uses: actions/upload-artifact@v3 |
| 41 | + with: |
| 42 | + path: ./wheelhouse/*.whl |
| 43 | + |
| 44 | + build_sdist: |
| 45 | + name: Build source distribution |
| 46 | + runs-on: ubuntu-latest |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v4 |
| 49 | + |
| 50 | + - name: Build sdist |
| 51 | + shell: bash -l {0} |
| 52 | + run: pipx run build --sdist |
| 53 | + |
| 54 | + - uses: actions/upload-artifact@v3 |
| 55 | + with: |
| 56 | + path: dist/*.tar.gz |
| 57 | + |
| 58 | + # upload_testpypi: |
| 59 | + # name: >- |
| 60 | + # Publish highspy to TestPyPI |
| 61 | + # runs-on: ubuntu-latest |
| 62 | + # needs: [build_wheels, build_sdist] |
| 63 | + |
| 64 | + # # upload to PyPI on every tag starting with 'v' |
| 65 | + # # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 66 | + |
| 67 | + # environment: |
| 68 | + # name: testpypi |
| 69 | + # url: https://testpypi.org/p/highspy |
| 70 | + |
| 71 | + # permissions: |
| 72 | + # id-token: write # IMPORTANT: mandatory for trusted publishing |
| 73 | + # steps: |
| 74 | + # - uses: actions/download-artifact@v3 |
| 75 | + # with: |
| 76 | + # # unpacks default artifact into dist/ |
| 77 | + # # if `name: artifact` is omitted, the action will create extra parent dir |
| 78 | + # name: artifact |
| 79 | + # path: dist |
| 80 | + |
| 81 | + # - name: Download all |
| 82 | + # uses: pypa/gh-action-pypi-publish@release/v1 |
| 83 | + # with: |
| 84 | + # repository-url: https://test.pypi.org/legacy/ |
| 85 | + |
| 86 | + upload_pypi: |
| 87 | + name: >- |
| 88 | + Publish highspy to PyPI |
| 89 | + runs-on: ubuntu-latest |
| 90 | + needs: [build_wheels, build_sdist] |
| 91 | + |
| 92 | + # upload to PyPI on every tag starting with 'v' |
| 93 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 94 | + |
| 95 | + environment: |
| 96 | + name: pypi |
| 97 | + url: https://pypi.org/p/highspy |
| 98 | + |
| 99 | + permissions: |
| 100 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 101 | + |
| 102 | + steps: |
| 103 | + - uses: actions/download-artifact@v3 |
| 104 | + with: |
| 105 | + # unpacks default artifact into dist/ |
| 106 | + # if `name: artifact` is omitted, the action will create extra parent dir |
| 107 | + name: artifact |
| 108 | + path: dist |
| 109 | + |
| 110 | + - name: Download all |
| 111 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments