|
| 1 | +name: Publish |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: Test |
| 6 | + branches: master |
| 7 | + types: completed |
| 8 | + |
| 9 | +jobs: |
| 10 | + publish: |
| 11 | + # `if` required because a workflow run is triggered regardless of |
| 12 | + # the result of the previous workflow (see the documentation page) |
| 13 | + if: ${{ github.event.workflow_run.conclusion == 'success' }} |
| 14 | + needs: [test] |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + os: ["ubuntu-20.04", "windows-2019", "macos-11"] |
| 19 | + cp: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"] |
| 20 | + |
| 21 | + |
| 22 | + name: ${{ matrix.os }} - ${{ matrix.cp }} |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + timeout-minutes: 60 |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v3 |
| 28 | + |
| 29 | + - name: Set up Python |
| 30 | + uses: actions/setup-python@v4 |
| 31 | + with: |
| 32 | + python-version: "3.10" |
| 33 | + |
| 34 | + - name: Install dependencies |
| 35 | + run: | |
| 36 | + python -m pip install --upgrade pip wheel setuptools |
| 37 | + python -m pip install --upgrade twine build |
| 38 | +
|
| 39 | + - name: Set up QEMU |
| 40 | + if: runner.os == 'Linux' |
| 41 | + uses: docker/setup-qemu-action@v2 |
| 42 | + with: |
| 43 | + platforms: all |
| 44 | + |
| 45 | + - name: Build wheels |
| 46 | + |
| 47 | + env: |
| 48 | + CIBW_ARCHS_LINUX: auto aarch64 |
| 49 | + CIBW_ARCHS_MACOS: x86_64 arm64 universal2 |
| 50 | + CIBW_BUILD: | |
| 51 | + ${{ matrix.cp }}-manylinux_x86_64 |
| 52 | + ${{ matrix.cp }}-manylinux_i686 |
| 53 | + ${{ matrix.cp }}-manylinux_aarch64 |
| 54 | + ${{ matrix.cp }}-win_amd64 |
| 55 | + ${{ matrix.cp }}-win32 |
| 56 | + ${{ matrix.cp }}-macosx_x86_64 |
| 57 | + ${{ matrix.cp }}-macosx_arm64 |
| 58 | + ${{ matrix.cp }}-macosx_universal2 |
| 59 | + # Disabled repair wheel since the fmob lib is not compatible |
| 60 | + CIBW_REPAIR_WHEEL_COMMAND: "" |
| 61 | + CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'mv {wheel} {dest_dir}/"$(basename {wheel} | sed "s/-linux_/-manylinux_2_17_/")"' |
| 62 | + CIBW_TEST_REQUIRES: pytest |
| 63 | + CIBW_TEST_COMMAND: pytest -v -s {package}/tests |
| 64 | + CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64 *-manylinux_i686 *-win32" |
| 65 | + |
| 66 | + - name: Publish to PyPI |
| 67 | + if: success() && github.event_name == 'push' && env.TWINE_PASSWORD != '' && github.ref == 'refs/heads/master' |
| 68 | + env: |
| 69 | + TWINE_USERNAME: __token__ |
| 70 | + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
| 71 | + run: | |
| 72 | + twine upload ./wheelhouse/*.whl --skip-existing |
| 73 | + python -m build --sdist |
| 74 | + twine upload ./dist/*.tar.gz --skip-existing |
0 commit comments