|
| 1 | + |
| 2 | +# Derived in part from https://github.com/google/brotli-wheels |
| 3 | +# |
| 4 | +# Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. |
| 5 | +# |
| 6 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | +# of this software and associated documentation files (the "Software"), to deal |
| 8 | +# in the Software without restriction, including without limitation the rights |
| 9 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | +# copies of the Software, and to permit persons to whom the Software is |
| 11 | +# furnished to do so, subject to the following conditions: |
| 12 | +# |
| 13 | +# The above copyright notice and this permission notice shall be included in |
| 14 | +# all copies or substantial portions of the Software. |
| 15 | +# |
| 16 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | +# THE SOFTWARE. |
| 23 | + |
| 24 | + |
| 25 | +name: Create library release archives, create a GH release and publish PyPI wheel and sdist on tag push |
| 26 | + |
| 27 | +on: |
| 28 | + workflow_dispatch: |
| 29 | + push: |
| 30 | + tags: |
| 31 | + - "v*.*.*" |
| 32 | + |
| 33 | +jobs: |
| 34 | + build-wheels: |
| 35 | + name: Build unicode wheels ${{ matrix.type }} ${{ matrix.arch }} on ${{ matrix.os }} |
| 36 | + runs-on: ${{ matrix.os }} |
| 37 | + defaults: |
| 38 | + run: |
| 39 | + shell: bash |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + os: [macos-latest, windows-latest] |
| 44 | + arch: [auto64] |
| 45 | + build: ["cp{310,311,312,313,314}-*"] |
| 46 | + |
| 47 | + include: |
| 48 | + - os: ubuntu-latest |
| 49 | + arch: auto64 |
| 50 | + type: manylinux2014 |
| 51 | + build: "cp{310,311,312,313,314}-*" |
| 52 | + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 |
| 53 | + |
| 54 | + - os: macos-latest |
| 55 | + arch: universal2 |
| 56 | + build: "cp{310,311,312,313,314}-*" |
| 57 | + |
| 58 | + - os: windows-latest |
| 59 | + arch: auto64 |
| 60 | + build: "cp{310,311,312,313,314}-*" |
| 61 | + |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v4 |
| 64 | + |
| 65 | + - name: Build wheels and run tests |
| 66 | + |
| 67 | + env: |
| 68 | + CIBW_BUILD: ${{ matrix.build }} |
| 69 | + CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.CIBW_MANYLINUX_I686_IMAGE }} |
| 70 | + CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.CIBW_MANYLINUX_X86_64_IMAGE }} |
| 71 | + CIBW_ARCHS: ${{ matrix.arch }} |
| 72 | + |
| 73 | + - name: Collect built wheels |
| 74 | + uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + name: intbitset-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
| 77 | + path: ./wheelhouse/*.whl |
| 78 | + |
| 79 | + build-sdist: |
| 80 | + name: Build source distribution |
| 81 | + runs-on: ubuntu-24.04 |
| 82 | + |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v4 |
| 85 | + |
| 86 | + - name: Checkout and install reqs |
| 87 | + run: | |
| 88 | + pip install --upgrade --user build twine pkginfo packaging pip setuptools cython |
| 89 | +
|
| 90 | + - name: Build sdist |
| 91 | + run: | |
| 92 | + python setup.py sdist |
| 93 | + twine check dist/* |
| 94 | +
|
| 95 | + - name: Collect built sdist |
| 96 | + uses: actions/upload-artifact@v4 |
| 97 | + with: |
| 98 | + name: intbitset-sdist |
| 99 | + path: dist/*.tar.gz |
| 100 | + |
| 101 | + merge: |
| 102 | + runs-on: ubuntu-latest |
| 103 | + needs: [build-sdist, build-wheels] |
| 104 | + steps: |
| 105 | + - name: Merge created wheels and sdist in a single zip |
| 106 | + uses: actions/upload-artifact/merge@v4 |
| 107 | + with: |
| 108 | + name: intbitset-build |
| 109 | + pattern: intbitset-* |
| 110 | + |
| 111 | + check-dist: |
| 112 | + name: Check distributions are PyPi-correct |
| 113 | + needs: merge |
| 114 | + runs-on: ubuntu-22.04 |
| 115 | + steps: |
| 116 | + - uses: actions/download-artifact@v4 |
| 117 | + with: |
| 118 | + path: intbitset-build |
| 119 | + - run: find . -ls |
| 120 | + - run: pipx run twine check --strict intbitset-build/*/* |
| 121 | + |
| 122 | + create-gh-release: |
| 123 | + name: Create GH release |
| 124 | + needs: |
| 125 | + - check-dist |
| 126 | + runs-on: ubuntu-24.04 |
| 127 | + |
| 128 | + steps: |
| 129 | + - name: Download builds |
| 130 | + uses: actions/download-artifact@v4 |
| 131 | + with: |
| 132 | + name: intbitset-build |
| 133 | + path: intbitset-build |
| 134 | + |
| 135 | + - name: Create GH release |
| 136 | + uses: softprops/action-gh-release@v2 |
| 137 | + with: |
| 138 | + draft: true |
| 139 | + files: intbitset-build/* |
| 140 | + |
| 141 | + create-pypi-release: |
| 142 | + name: Create PyPI release |
| 143 | + needs: |
| 144 | + - create-gh-release |
| 145 | + runs-on: ubuntu-24.04 |
| 146 | + permissions: |
| 147 | + id-token: write |
| 148 | + |
| 149 | + steps: |
| 150 | + - name: Download builds |
| 151 | + uses: actions/download-artifact@v4 |
| 152 | + with: |
| 153 | + name: intbitset-build |
| 154 | + path: dist/ |
| 155 | + |
| 156 | + - name: Mock PyPI upload |
| 157 | + run: | |
| 158 | + ls -al dist |
| 159 | +
|
| 160 | + - name: Publish to PyPI |
| 161 | + if: startsWith(github.ref, 'refs/tags') |
| 162 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments