|
| 1 | +# Build wheels using cibuildwheel (https://cibuildwheel.pypa.io/) |
| 2 | +name: build-wheels |
| 3 | + |
| 4 | +on: |
| 5 | + # Run when a release has been created |
| 6 | + release: |
| 7 | + types: [created] |
| 8 | + |
| 9 | + # NOTE(vytas): Also allow to release to Test PyPi manually. |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-sdist: |
| 14 | + # NOTE(vytas): We actually build sdist and pure-Python wheel. |
| 15 | + name: sdist |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 2 |
| 23 | + |
| 24 | + - name: Set up Python |
| 25 | + uses: actions/setup-python@v5 |
| 26 | + with: |
| 27 | + python-version: "3.12" |
| 28 | + |
| 29 | + - name: Build sdist and pure-Python wheel |
| 30 | + env: |
| 31 | + FALCON_DISABLE_CYTHON: "Y" |
| 32 | + run: | |
| 33 | + pip install --upgrade pip |
| 34 | + pip install --upgrade build |
| 35 | + python -m build |
| 36 | +
|
| 37 | + - name: Check built artifacts |
| 38 | + run: | |
| 39 | + tools/check_dist.py ${{ github.event_name == 'release' && format('-r {0}', github.ref) || '' }} |
| 40 | +
|
| 41 | + - name: Test sdist |
| 42 | + run: | |
| 43 | + tools/test_dist.py dist/*.tar.gz |
| 44 | +
|
| 45 | + - name: Test pure-Python wheel |
| 46 | + run: | |
| 47 | + tools/test_dist.py dist/*.whl |
| 48 | +
|
| 49 | + - name: Upload artifacts |
| 50 | + uses: actions/upload-artifact@v4 |
| 51 | + with: |
| 52 | + name: cibw-sdist |
| 53 | + path: dist/falcon-* |
| 54 | + |
| 55 | + build-wheels: |
| 56 | + name: ${{ matrix.python }}-${{ matrix.platform.name }} |
| 57 | + needs: build-sdist |
| 58 | + runs-on: ${{ matrix.platform.os }} |
| 59 | + strategy: |
| 60 | + fail-fast: false |
| 61 | + matrix: |
| 62 | + platform: |
| 63 | + - name: manylinux_x86_64 |
| 64 | + os: ubuntu-latest |
| 65 | + - name: musllinux_x86_64 |
| 66 | + os: ubuntu-latest |
| 67 | + - name: manylinux_aarch64 |
| 68 | + os: ubuntu-latest |
| 69 | + emulation: true |
| 70 | + - name: musllinux_aarch64 |
| 71 | + os: ubuntu-latest |
| 72 | + emulation: true |
| 73 | + - name: manylinux_s390x |
| 74 | + os: ubuntu-latest |
| 75 | + emulation: true |
| 76 | + - name: macosx_x86_64 |
| 77 | + os: macos-13 |
| 78 | + - name: macosx_arm64 |
| 79 | + os: macos-14 |
| 80 | + - name: win_amd64 |
| 81 | + os: windows-latest |
| 82 | + python: |
| 83 | + - cp39 |
| 84 | + - cp310 |
| 85 | + - cp311 |
| 86 | + - cp312 |
| 87 | + - cp313 |
| 88 | + include: |
| 89 | + - platform: |
| 90 | + name: manylinux_x86_64 |
| 91 | + os: ubuntu-latest |
| 92 | + python: cp38 |
| 93 | + - platform: |
| 94 | + name: musllinux_x86_64 |
| 95 | + os: ubuntu-latest |
| 96 | + python: cp38 |
| 97 | + |
| 98 | + defaults: |
| 99 | + run: |
| 100 | + shell: bash |
| 101 | + |
| 102 | + steps: |
| 103 | + - name: Checkout repository |
| 104 | + uses: actions/checkout@v4 |
| 105 | + with: |
| 106 | + fetch-depth: 2 |
| 107 | + |
| 108 | + - name: Set up QEMU |
| 109 | + uses: docker/setup-qemu-action@v3 |
| 110 | + if: ${{ matrix.platform.emulation }} |
| 111 | + with: |
| 112 | + platforms: all |
| 113 | + |
| 114 | + - name: Build wheels |
| 115 | + uses: pypa/cibuildwheel@v2.20.0 |
| 116 | + env: |
| 117 | + CIBW_ARCHS_LINUX: all |
| 118 | + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform.name }} |
| 119 | + |
| 120 | + - name: Upload artifacts |
| 121 | + uses: actions/upload-artifact@v4 |
| 122 | + with: |
| 123 | + name: cibw-wheel-${{ matrix.python }}-${{ matrix.platform.name }} |
| 124 | + path: wheelhouse/falcon-*.whl |
| 125 | + |
| 126 | + publish-sdist: |
| 127 | + name: publish-sdist |
| 128 | + needs: |
| 129 | + - build-sdist |
| 130 | + - build-wheels |
| 131 | + runs-on: ubuntu-latest |
| 132 | + |
| 133 | + steps: |
| 134 | + - name: Checkout repository |
| 135 | + uses: actions/checkout@v4 |
| 136 | + with: |
| 137 | + fetch-depth: 2 |
| 138 | + |
| 139 | + - name: Set up Python |
| 140 | + uses: actions/setup-python@v5 |
| 141 | + with: |
| 142 | + python-version: "3.12" |
| 143 | + |
| 144 | + - name: Download artifacts |
| 145 | + uses: actions/download-artifact@v4 |
| 146 | + with: |
| 147 | + pattern: cibw-sdist |
| 148 | + path: dist |
| 149 | + merge-multiple: true |
| 150 | + |
| 151 | + - name: Check collected artifacts |
| 152 | + run: | |
| 153 | + tools/check_dist.py ${{ github.event_name == 'release' && format('-r {0}', github.ref) || '' }} |
| 154 | +
|
| 155 | + - name: Upload sdist to release |
| 156 | + uses: AButler/upload-release-assets@v2.0 |
| 157 | + if: github.event_name == 'release' |
| 158 | + with: |
| 159 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 160 | + files: 'dist/*.tar.gz' |
| 161 | + |
| 162 | + - name: Publish sdist and pure-Python wheel to TestPyPI |
| 163 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 164 | + if: github.event_name == 'workflow_dispatch' |
| 165 | + with: |
| 166 | + password: ${{ secrets.TEST_PYPI_TOKEN }} |
| 167 | + repository-url: https://test.pypi.org/legacy/ |
| 168 | + |
| 169 | + - name: Publish sdist and pure-Python wheel to PyPI |
| 170 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 171 | + if: github.event_name == 'release' |
| 172 | + with: |
| 173 | + password: ${{ secrets.PYPI_TOKEN }} |
| 174 | + |
| 175 | + publish-wheels: |
| 176 | + name: publish-wheels |
| 177 | + needs: |
| 178 | + - build-sdist |
| 179 | + - build-wheels |
| 180 | + - publish-sdist |
| 181 | + runs-on: ubuntu-latest |
| 182 | + |
| 183 | + steps: |
| 184 | + - name: Checkout repository |
| 185 | + uses: actions/checkout@v4 |
| 186 | + with: |
| 187 | + fetch-depth: 2 |
| 188 | + |
| 189 | + - name: Set up Python |
| 190 | + uses: actions/setup-python@v5 |
| 191 | + with: |
| 192 | + python-version: "3.12" |
| 193 | + |
| 194 | + - name: Download artifacts |
| 195 | + uses: actions/download-artifact@v4 |
| 196 | + with: |
| 197 | + pattern: cibw-wheel-* |
| 198 | + path: dist |
| 199 | + merge-multiple: true |
| 200 | + |
| 201 | + - name: Check collected artifacts |
| 202 | + run: | |
| 203 | + tools/check_dist.py ${{ github.event_name == 'release' && format('-r {0}', github.ref) || '' }} |
| 204 | +
|
| 205 | + - name: Publish binary wheels to TestPyPI |
| 206 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 207 | + if: github.event_name == 'workflow_dispatch' |
| 208 | + with: |
| 209 | + password: ${{ secrets.TEST_PYPI_TOKEN }} |
| 210 | + repository-url: https://test.pypi.org/legacy/ |
| 211 | + |
| 212 | + - name: Publish binary wheels to PyPI |
| 213 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 214 | + if: github.event_name == 'release' |
| 215 | + with: |
| 216 | + password: ${{ secrets.PYPI_TOKEN }} |
0 commit comments