[pre-commit.ci] pre-commit autoupdate #3583
Workflow file for this run
This file contains 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: Publish Python distributions to PyPI and TestPyPI | |
on: | |
release: | |
types: [published] | |
pull_request: | |
branch: main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build_wheels: | |
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }} | |
runs-on: ${{ matrix.buildplat[0] }} | |
strategy: | |
fail-fast: false | |
matrix: | |
buildplat: | |
- [ubuntu-20.04, manylinux, x86_64] | |
- [macos-13, macosx, x86_64] | |
- [macos-14, macosx, arm64] | |
- [windows-2019, win, AMD64] | |
python: ["cp310", "cp311", "cp312"] | |
steps: | |
- uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.18.1 | |
env: | |
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}* | |
CIBW_ARCHS: ${{ matrix.buildplat[2] }} | |
CIBW_TEST_REQUIRES: "-r ci/test_requirements.txt" | |
CIBW_TEST_COMMAND: "pytest {project}/tests -n auto" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }} | |
path: ./wheelhouse/*.whl | |
make_sdist: | |
name: Make SDist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- name: Build SDist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
upload_all: | |
needs: [build_wheels, make_sdist] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
# unpacks all CIBW artifacts into dist/ | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- name: Upload to test PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.test_pypi_password }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Upload to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.pypi_password }} |