Repository navigation
Conversation
- actions/checkout -> v7 - github/codeql-action -> v4
This adds a new workflow pypi-publish that builds wheels using the pypa/cibuildwheel GitHub action and a Python source distribution (sdist) via the build module (run via pipx, which is included in the runner images) and uploads them to PyPI via pypa/gh-action-pypi-publish using the trused publishing mechanism.
| - name: Store built wheels | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
There was a problem hiding this comment.
The job index is probably not very descriptive (and reordering or deprecating Python versions will make your brain freeze)... maybe be explicit here?
| name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
| name: cibw-wheels-${{ matrix.os }}-cp${{ matrix.python }}-${{ matrix.manylinux_platform }} |
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-latest | ||
| python: 39 | ||
| manylinux_platform: manylinux_x86_64 | ||
| - os: ubuntu-latest | ||
| python: 310 | ||
| manylinux_platform: manylinux_x86_64 | ||
| - os: ubuntu-latest | ||
| python: 311 | ||
| manylinux_platform: manylinux_x86_64 | ||
| - os: ubuntu-latest | ||
| python: 312 | ||
| manylinux_platform: manylinux_x86_64 | ||
| - os: ubuntu-latest | ||
| python: 313 | ||
| manylinux_platform: manylinux_x86_64 | ||
| - os: ubuntu-latest | ||
| python: 314 | ||
| manylinux_platform: manylinux_x86_64 | ||
| - os: ubuntu-latest | ||
| python: 314t | ||
| manylinux_platform: manylinux_x86_64 | ||
| - os: ubuntu-latest | ||
| python: 315 | ||
| manylinux_platform: manylinux_x86_64 | ||
| - os: ubuntu-latest | ||
| python: 315t | ||
| manylinux_platform: manylinux_x86_64 |
There was a problem hiding this comment.
You can write this way smaller, as a cross product... in theory you could also not include os and manylinux_platform and hardcode them... but I think this makes new versions of Python simpler to add.
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| python: 39 | |
| manylinux_platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: 310 | |
| manylinux_platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: 311 | |
| manylinux_platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: 312 | |
| manylinux_platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: 313 | |
| manylinux_platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: 314 | |
| manylinux_platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: 314t | |
| manylinux_platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: 315 | |
| manylinux_platform: manylinux_x86_64 | |
| - os: ubuntu-latest | |
| python: 315t | |
| manylinux_platform: manylinux_x86_64 | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| manylinux_platform: [manylinux_x86_64] | |
| python: [39, 310, 311, 312, 313, 314, 314t, 315, 315t] |
| @@ -0,0 +1,104 @@ | |||
| name: Build and publish Python package to TestPyPI | |||
|
|
|||
| on: [push] | |||
There was a problem hiding this comment.
I know that you are trying to test uploading into the test PyPI, but in general, that doesn't really test much other than that a) you can build a wheel b) The test API is working, and c) this wheel is accepted by PyPI. Other than "this wheel is accepted" everything else can (and should?) be just tested in CI/CD.
consider also add a on: publish that will upload github published artifacts
The publishing part is so far commented out, because trusted publishing needs to be set up, which it (probably) isn't yet, and I also wanted to see whether the build jobs actually work.