Stabilize Python 3.10 wheel builds with cibuildwheel v3. (#333) #2312
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: build - check - upload | |
| on: | |
| push: | |
| branches: | |
| - main | |
| release: | |
| types: [published] | |
| pull_request: | |
| branches: | |
| - '**' | |
| concurrency: | |
| # SHA is added to the end if on `main` to let all main workflows run | |
| group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| build-wheels: | |
| name: Wheel - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }} | |
| runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - name: macOS | |
| matrix: macos | |
| runs-on: | |
| arm: [macos-15] | |
| intel: [macos-15-intel] | |
| cibw-archs-macos: | |
| arm: arm64 | |
| intel: x86_64 | |
| - name: Ubuntu | |
| matrix: ubuntu | |
| runs-on: | |
| arm: [Linux, ARM64] | |
| intel: [ubuntu-latest] | |
| - name: Windows | |
| matrix: windows | |
| runs-on: | |
| intel: [windows-latest] | |
| python: | |
| - major-dot-minor: '3.10' | |
| cibw-build: 'cp310-*' | |
| manylinux: manylinux_2_28 | |
| matrix: '3.10' | |
| cibuildwheel: 'cibuildwheel==3.2.1' | |
| - major-dot-minor: '3.11' | |
| cibw-build: 'cp311-*' | |
| manylinux: manylinux_2_28 | |
| matrix: '3.11' | |
| cibuildwheel: 'cibuildwheel==3.2.1' | |
| - major-dot-minor: '3.12' | |
| cibw-build: 'cp312-*' | |
| manylinux: manylinux_2_28 | |
| matrix: '3.12' | |
| cibuildwheel: 'cibuildwheel==3.2.1' | |
| - major-dot-minor: '3.13' | |
| cibw-build: 'cp313-*' | |
| manylinux: manylinux_2_28 | |
| matrix: '3.13' | |
| cibuildwheel: 'cibuildwheel==3.2.1' | |
| - major-dot-minor: '3.14' | |
| cibw-build: 'cp314-*' | |
| manylinux: manylinux_2_28 | |
| matrix: '3.14' | |
| cibuildwheel: 'cibuildwheel==3.2.1' | |
| arch: | |
| - name: ARM | |
| matrix: arm | |
| - name: Intel | |
| matrix: intel | |
| exclude: | |
| # Only partial entries are required here by GitHub Actions so generally I | |
| # only specify the `matrix:` entry. The super linter complains so for now | |
| # all entries are included to avoid that. Reported at | |
| # https://github.com/github/super-linter/issues/3016 | |
| - os: | |
| name: Windows | |
| matrix: windows | |
| runs-on: | |
| intel: [windows-latest] | |
| arch: | |
| name: ARM | |
| matrix: arm | |
| steps: | |
| - name: Clean workspace | |
| uses: Chia-Network/actions/clean-workspace@main | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: Chia-Network/actions/setup-python@main | |
| with: | |
| # cibuildwheel v3 requires Python >= 3.11 for the build host. | |
| # Keep wheel target selection via CIBW_BUILD so cp310 wheels still build. | |
| python-version: '3.12' | |
| - name: Install pipx | |
| run: | | |
| pip install pipx | |
| - name: Build and test (Linux) | |
| if: matrix.os.matrix == 'ubuntu' | |
| env: | |
| CIBW_BUILD: ${{ matrix.python.cibw-build }} | |
| CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.python.manylinux }} | |
| CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.python.manylinux }} | |
| CIBW_ENABLE: cpython-prerelease | |
| run: | |
| pipx run --spec=${{ matrix.python.cibuildwheel }} cibuildwheel --output-dir dist 2>&1 | |
| - name: Build and test (macOS) | |
| if: matrix.os.matrix == 'macos' | |
| env: | |
| CIBW_BUILD: ${{ matrix.python.cibw-build }} | |
| CIBW_ARCHS_MACOS: ${{ matrix.os.cibw-archs-macos[matrix.arch.matrix] }} | |
| CIBW_ENABLE: cpython-prerelease | |
| run: | |
| pipx run --spec=${{ matrix.python.cibuildwheel }} cibuildwheel --output-dir dist 2>&1 | |
| - name: Build and test (Windows) | |
| if: matrix.os.matrix == 'windows' | |
| env: | |
| # pipx warns when its home path contains spaces (common on Windows runners). | |
| # Use a fixed no-space location to avoid pipx path compatibility issues. | |
| PIPX_HOME: 'C:\pipx' | |
| PIPX_BIN_DIR: 'C:\pipx\bin' | |
| # setuptools/cibuildwheel on Windows can emit a benign RuntimeWarning: | |
| # "Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect". | |
| # PYTHONWARNINGS uses literal message matching (not regex), so match a | |
| # stable prefix and avoid punctuation-sensitive full-text matching. | |
| # TODO: Revisit periodically and remove once upstream tooling no longer | |
| # emits this warning in our Windows wheel builds. | |
| PYTHONWARNINGS: "ignore:Config variable 'Py_DEBUG' is unset:RuntimeWarning" | |
| CIBW_BUILD: ${{ matrix.python.cibw-build }} | |
| CIBW_ENABLE: cpython-prerelease | |
| run: | |
| pipx run --spec=${{ matrix.python.cibuildwheel }} cibuildwheel --output-dir dist 2>&1 | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: packages-${{ matrix.os.name }}-${{ matrix.python.major-dot-minor }}-${{ matrix.arch.name }} | |
| path: ./dist | |
| build-sdist: | |
| name: sdist - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }} | |
| runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - name: Ubuntu | |
| matrix: ubuntu | |
| runs-on: | |
| arm: [Linux, ARM64] | |
| intel: [ubuntu-latest] | |
| python: | |
| - major-dot-minor: '3.12' | |
| matrix: '3.12' | |
| arch: | |
| - name: Intel | |
| matrix: intel | |
| steps: | |
| - name: Clean workspace | |
| uses: Chia-Network/actions/clean-workspace@main | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: Chia-Network/actions/setup-python@main | |
| with: | |
| python-version: ${{ matrix.python.major-dot-minor }} | |
| - name: Build source distribution | |
| run: | | |
| pip install build | |
| python -m build --sdist --outdir dist . | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: packages-sdist-${{ matrix.os.name }}-${{ matrix.python.major-dot-minor }}-${{ matrix.arch.name }} | |
| path: ./dist | |
| check: | |
| name: Check - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }} | |
| runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - name: Ubuntu | |
| matrix: ubuntu | |
| runs-on: | |
| arm: [Linux, ARM64] | |
| intel: [ubuntu-latest] | |
| python: | |
| - major-dot-minor: '3.12' | |
| matrix: '3.12' | |
| arch: | |
| - name: Intel | |
| matrix: intel | |
| steps: | |
| - name: Clean workspace | |
| uses: Chia-Network/actions/clean-workspace@main | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: Chia-Network/actions/setup-python@main | |
| with: | |
| python-version: ${{ matrix.python.major-dot-minor }} | |
| - name: flake8 | |
| run: | | |
| pip install flake8 | |
| flake8 tests setup.py | |
| - name: mypy | |
| run: | | |
| pip install mypy | |
| mypy --config-file mypi.ini setup.py tests | |
| upload: | |
| name: Upload to PyPI - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }} | |
| runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} | |
| needs: | |
| - build-wheels | |
| - build-sdist | |
| - check | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - name: Ubuntu | |
| matrix: ubuntu | |
| runs-on: | |
| arm: [Linux, ARM64] | |
| intel: [ubuntu-latest] | |
| python: | |
| - major-dot-minor: '3.12' | |
| matrix: '3.12' | |
| arch: | |
| - name: Intel | |
| matrix: intel | |
| steps: | |
| - name: Clean workspace | |
| uses: Chia-Network/actions/clean-workspace@main | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set Env | |
| uses: Chia-Network/actions/setjobenv@main | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: Chia-Network/actions/setup-python@main | |
| with: | |
| python-version: ${{ matrix.python.major-dot-minor }} | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| merge-multiple: true | |
| pattern: packages-* | |
| path: ./dist | |
| - name: Publish distribution to PyPI | |
| if: env.RELEASE == 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ | |
| skip-existing: true | |
| - name: Publish distribution to Test PyPI | |
| if: env.PRE_RELEASE == 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| packages-dir: dist/ | |
| skip-existing: true |