Update README #18
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| jobs: | |
| build-sdist: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install build | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build cibuildwheel | |
| - name: Create source dist | |
| run: python -m build -s | |
| - name: Publish source dist to github | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-src | |
| path: dist/*.tar.* | |
| build-wheels-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| include: ${{ steps.set-matrix.outputs.include }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - run: pip install cibuildwheel==3.3.0 | |
| - id: set-matrix | |
| run: | | |
| MATRIX_INCLUDE=$( | |
| { | |
| cibuildwheel --print-build-identifiers --platform linux --archs x86_64,aarch64 | grep cp | jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \ | |
| && cibuildwheel --print-build-identifiers --platform macos --archs x86_64,arm64 | grep cp | jq -nRc '{"only": inputs, "os": "macos-latest"}' \ | |
| && cibuildwheel --print-build-identifiers --platform windows --archs x86,AMD64 | grep cp | jq -nRc '{"only": inputs, "os": "windows-latest"}' \ | |
| && cibuildwheel --print-build-identifiers --platform windows --archs ARM64 | grep cp | jq -nRc '{"only": inputs, "os": "windows-11-arm"}' | |
| } | jq -sc | |
| ) | |
| echo "include=$MATRIX_INCLUDE" >> $GITHUB_OUTPUT | |
| build-wheels: | |
| needs: build-wheels-matrix | |
| runs-on: ${{ matrix.os }} | |
| name: Build ${{ matrix.only }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJson(needs.build-wheels-matrix.outputs.include) }} | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| # Python that is used by github workers is build with -g flag | |
| # This flag is automatically passed when extensions are built | |
| # Add -g0 to negate -g. | |
| # This only affects our release builds when we are using cibuildwheel | |
| # If CFLAGS are defined they override default options from OPT. | |
| # So also add -O2 and -NDEBUG | |
| PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
| CIBW_ENVIRONMENT_LINUX: CFLAGS="$CFLAGS -O2 -g0 -DNDEBUG" | |
| CIBW_ENVIRONMENT_MACOS: CFLAGS="$CFLAGS -O2 -g0 -DNDEBUG" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 50 | |
| submodules: true | |
| - name: Set up QEMU | |
| if: runner.os == 'Linux' | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.3.0 | |
| with: | |
| only: ${{ matrix.only }} | |
| env: | |
| CIBW_BUILD_VERBOSITY: 1 | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-${{ matrix.only }} | |
| path: wheelhouse/*.whl | |
| publish: | |
| needs: [build-sdist, build-wheels] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 5 | |
| submodules: false | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist/ | |
| pattern: dist-* | |
| merge-multiple: true | |
| - run: | | |
| ls -al dist/ | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |