|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + pull-requests: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + release-please: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + release_created: ${{ steps.release.outputs.release_created }} |
| 17 | + tag_name: ${{ steps.release.outputs.tag_name }} |
| 18 | + steps: |
| 19 | + - uses: googleapis/release-please-action@v4 |
| 20 | + id: release |
| 21 | + with: |
| 22 | + release-type: python |
| 23 | + package-name: explodethosebits |
| 24 | + |
| 25 | + build_wheels: |
| 26 | + name: Build wheels on ${{ matrix.os }} |
| 27 | + needs: release-please |
| 28 | + if: ${{ needs.release-please.outputs.release_created }} |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + strategy: |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + os: [ubuntu-latest, windows-latest] |
| 34 | + python-version: ['3.9', '3.10', '3.11', '3.12'] |
| 35 | + |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + fetch-depth: 0 |
| 40 | + |
| 41 | + - name: Set up Python ${{ matrix.python-version }} |
| 42 | + uses: actions/setup-python@v5 |
| 43 | + with: |
| 44 | + python-version: ${{ matrix.python-version }} |
| 45 | + |
| 46 | + - name: Install CUDA Toolkit (Linux) |
| 47 | + if: runner.os == 'Linux' |
| 48 | + uses: Jimver/cuda-toolkit@v0.2.15 |
| 49 | + with: |
| 50 | + cuda: '12.4.0' |
| 51 | + method: 'network' |
| 52 | + |
| 53 | + - name: Install CUDA Toolkit (Windows) |
| 54 | + if: runner.os == 'Windows' |
| 55 | + uses: Jimver/cuda-toolkit@v0.2.15 |
| 56 | + with: |
| 57 | + cuda: '12.4.0' |
| 58 | + method: 'network' |
| 59 | + |
| 60 | + - name: Install build dependencies |
| 61 | + run: | |
| 62 | + python -m pip install --upgrade pip |
| 63 | + pip install build scikit-build-core pybind11 cmake ninja |
| 64 | +
|
| 65 | + - name: Build wheel |
| 66 | + run: python -m build --wheel |
| 67 | + env: |
| 68 | + CMAKE_CUDA_ARCHITECTURES: "90;100" |
| 69 | + |
| 70 | + - name: Upload wheels |
| 71 | + uses: actions/upload-artifact@v4 |
| 72 | + with: |
| 73 | + name: wheels-${{ matrix.os }}-py${{ matrix.python-version }} |
| 74 | + path: dist/*.whl |
| 75 | + |
| 76 | + build_sdist: |
| 77 | + name: Build source distribution |
| 78 | + needs: release-please |
| 79 | + if: ${{ needs.release-please.outputs.release_created }} |
| 80 | + runs-on: ubuntu-latest |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@v4 |
| 83 | + with: |
| 84 | + fetch-depth: 0 |
| 85 | + |
| 86 | + - name: Set up Python |
| 87 | + uses: actions/setup-python@v5 |
| 88 | + with: |
| 89 | + python-version: '3.11' |
| 90 | + |
| 91 | + - name: Install build dependencies |
| 92 | + run: | |
| 93 | + python -m pip install --upgrade pip |
| 94 | + pip install build |
| 95 | +
|
| 96 | + - name: Build sdist |
| 97 | + run: python -m build --sdist |
| 98 | + |
| 99 | + - name: Upload sdist |
| 100 | + uses: actions/upload-artifact@v4 |
| 101 | + with: |
| 102 | + name: sdist |
| 103 | + path: dist/*.tar.gz |
| 104 | + |
| 105 | + publish: |
| 106 | + name: Publish to PyPI |
| 107 | + needs: [release-please, build_wheels, build_sdist] |
| 108 | + if: ${{ needs.release-please.outputs.release_created }} |
| 109 | + runs-on: ubuntu-latest |
| 110 | + environment: |
| 111 | + name: pypi |
| 112 | + url: https://pypi.org/p/explodethosebits |
| 113 | + permissions: |
| 114 | + id-token: write |
| 115 | + |
| 116 | + steps: |
| 117 | + - name: Download all artifacts |
| 118 | + uses: actions/download-artifact@v4 |
| 119 | + with: |
| 120 | + path: dist |
| 121 | + merge-multiple: true |
| 122 | + |
| 123 | + - name: Publish to PyPI |
| 124 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 125 | + with: |
| 126 | + packages-dir: dist/ |
0 commit comments