|
5 | 5 | release: |
6 | 6 | types: [published] |
7 | 7 |
|
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
8 | 11 | jobs: |
9 | | - wheels: |
10 | | - name: ${{ matrix.os }} |
| 12 | + build_wheels: |
| 13 | + name: wheels-${{ matrix.os }} |
11 | 14 | runs-on: ${{ matrix.os }} |
12 | 15 | strategy: |
13 | 16 | fail-fast: false |
14 | 17 | matrix: |
15 | | - os: [ubuntu-latest, macos-13, macos-14, windows-latest] |
| 18 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 19 | + |
16 | 20 | steps: |
17 | 21 | - uses: actions/checkout@v4 |
18 | | - - uses: pypa/cibuildwheel@v2.18 |
| 22 | + |
| 23 | + - name: Build wheels |
| 24 | + uses: pypa/cibuildwheel@v3.4.1 |
19 | 25 | env: |
20 | | - CIBW_BUILD: "cp310-* cp311-* cp312-*" |
21 | | - CIBW_TEST_REQUIRES: pytest |
22 | | - CIBW_TEST_COMMAND: "python -c \"import bioimage_cpp\" && pytest {project}/tests" |
| 26 | + CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*" |
| 27 | + CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_*" |
| 28 | + CIBW_ARCHS_MACOS: "native" |
| 29 | + CIBW_TEST_REQUIRES: "pytest pooch scipy" |
| 30 | + CIBW_TEST_COMMAND: "python -c \"import bioimage_cpp; print(bioimage_cpp.__file__)\" && pytest -q {project}/tests" |
| 31 | + |
| 32 | + - name: Upload wheels |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + with: |
| 35 | + name: cibw-wheels-${{ matrix.os }} |
| 36 | + path: wheelhouse/*.whl |
| 37 | + |
| 38 | + build_sdist: |
| 39 | + name: sdist |
| 40 | + runs-on: ubuntu-latest |
| 41 | + |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v4 |
| 44 | + - uses: actions/setup-python@v5 |
| 45 | + with: |
| 46 | + python-version: "3.11" |
| 47 | + |
| 48 | + - name: Install build tooling |
| 49 | + run: python -m pip install build twine |
| 50 | + |
| 51 | + - name: Build sdist |
| 52 | + run: python -m build --sdist |
| 53 | + |
| 54 | + - name: Check sdist metadata |
| 55 | + run: python -m twine check dist/* |
| 56 | + |
| 57 | + - name: Upload sdist |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: cibw-sdist |
| 61 | + path: dist/*.tar.gz |
| 62 | + |
| 63 | + publish-testpypi: |
| 64 | + name: publish-to-testpypi |
| 65 | + needs: [build_wheels, build_sdist] |
| 66 | + runs-on: ubuntu-latest |
| 67 | + if: github.event_name == 'workflow_dispatch' |
| 68 | + |
| 69 | + environment: |
| 70 | + name: testpypi |
| 71 | + url: https://test.pypi.org/p/bioimage-cpp |
| 72 | + |
| 73 | + permissions: |
| 74 | + id-token: write |
| 75 | + |
| 76 | + steps: |
| 77 | + - name: Download distributions |
| 78 | + uses: actions/download-artifact@v4 |
| 79 | + with: |
| 80 | + pattern: cibw-* |
| 81 | + path: dist |
| 82 | + merge-multiple: true |
| 83 | + |
| 84 | + - name: List distributions |
| 85 | + run: ls -lh dist |
| 86 | + |
| 87 | + - name: Publish to TestPyPI |
| 88 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 89 | + with: |
| 90 | + repository-url: https://test.pypi.org/legacy/ |
| 91 | + |
| 92 | + publish-pypi: |
| 93 | + name: publish-to-pypi |
| 94 | + needs: [build_wheels, build_sdist] |
| 95 | + runs-on: ubuntu-latest |
| 96 | + if: github.event_name == 'release' && github.event.action == 'published' |
| 97 | + |
| 98 | + environment: |
| 99 | + name: pypi |
| 100 | + url: https://pypi.org/p/bioimage-cpp |
| 101 | + |
| 102 | + permissions: |
| 103 | + id-token: write |
| 104 | + |
| 105 | + steps: |
| 106 | + - name: Download distributions |
| 107 | + uses: actions/download-artifact@v4 |
| 108 | + with: |
| 109 | + pattern: cibw-* |
| 110 | + path: dist |
| 111 | + merge-multiple: true |
| 112 | + |
| 113 | + - name: List distributions |
| 114 | + run: ls -lh dist |
| 115 | + |
| 116 | + - name: Publish to PyPI |
| 117 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments