Add Gitea release workflow: per-platform wheel builds, then publish to PyPI
Matrix job builds and tests wheels on linux/macos/windows (no Gitea release, unlike mediahive); publish job uploads the merged dist/ to PyPI only after all platforms succeed. release.py gains --no-upload for the matrix jobs.
This commit is contained in:
1 parent
a1bfeb2434
commit
0cb7faf698
3 files changed
+76
No files matched your search
@@ -0,0 +1,67 @@
|
|||||||
|
name: release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
# Runner host prerequisites: git, uv, zig, and a C compiler.
|
||||||
|
jobs:
|
||||||
|
build-wheels:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: macos
|
||||||
|
shell: bash
|
||||||
|
- os: windows
|
||||||
|
shell: cmd
|
||||||
|
- os: linux
|
||||||
|
shell: bash
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
# Plain git clone: full history so setuptools_scm sees tags, and both
|
||||||
|
# shells work. Windows uses cmd: bash resolves to WSL (refuses SYSTEM
|
||||||
|
# accounts) and powershell hits the script execution policy under SYSTEM.
|
||||||
|
# --recursive pulls in the libaegis submodule needed by the build backend.
|
||||||
|
- name: Checkout
|
||||||
|
shell: ${{ matrix.shell }}
|
||||||
|
run: |
|
||||||
|
git clone --recursive "${{ gitea.server_url }}/${{ gitea.repository }}.git" .
|
||||||
|
git checkout -f "${{ gitea.sha }}"
|
||||||
|
|
||||||
|
# Builds sdist + all wheel variants for this platform, runs tests and
|
||||||
|
# benchmarks, leaves everything in dist/. Upload is left to publish-pypi.
|
||||||
|
- name: Build wheels for this platform
|
||||||
|
shell: ${{ matrix.shell }}
|
||||||
|
run: uv run tools/release.py --no-upload
|
||||||
|
|
||||||
|
- name: Upload wheels as artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dist-${{ matrix.os }}
|
||||||
|
path: dist/
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
# Publish to PyPI only once every platform's wheel build has succeeded.
|
||||||
|
# Jobs don't share a workspace, so the per-platform dist/ directories are
|
||||||
|
# passed around as artifacts and merged here. No Gitea release is created.
|
||||||
|
publish-pypi:
|
||||||
|
needs: build-wheels
|
||||||
|
runs-on: linux
|
||||||
|
steps:
|
||||||
|
- name: Download all platform wheels
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
pattern: dist-*
|
||||||
|
path: dist
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
# The sdist is identical across platforms; --skip-existing also makes
|
||||||
|
# reruns of a partially-published release safe.
|
||||||
|
- name: Publish to PyPI
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
TWINE_USERNAME: __token__
|
||||||
|
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
||||||
|
run: uvx twine upload --skip-existing dist/**
|
||||||
@@ -8,4 +8,5 @@
|
|||||||
/src/aeg/_aegis*.pyd
|
/src/aeg/_aegis*.pyd
|
||||||
__pycache__
|
__pycache__
|
||||||
!.gitignore
|
!.gitignore
|
||||||
|
!.gitea/
|
||||||
!.gitmodules
|
!.gitmodules
|
||||||
@@ -312,6 +312,10 @@ def run_benchmark(wheel: Path, py_version: str) -> bool:
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Build wheels for all supported Python versions."""
|
"""Build wheels for all supported Python versions."""
|
||||||
|
# CI matrix jobs build per-platform wheels but never upload; a separate
|
||||||
|
# publish job uploads everything once all platforms have succeeded.
|
||||||
|
no_upload = "--no-upload" in sys.argv
|
||||||
|
|
||||||
repo_root = Path(__file__).parent.parent
|
repo_root = Path(__file__).parent.parent
|
||||||
dist_dir = repo_root / "dist"
|
dist_dir = repo_root / "dist"
|
||||||
|
|
||||||
@@ -460,6 +464,10 @@ def main():
|
|||||||
print(f" - {file.name}")
|
print(f" - {file.name}")
|
||||||
|
|
||||||
# Only upload if this is a clean release version
|
# Only upload if this is a clean release version
|
||||||
|
if no_upload:
|
||||||
|
print("\n--no-upload given; upload to PyPI skipped.")
|
||||||
|
return 0
|
||||||
|
|
||||||
if not is_release:
|
if not is_release:
|
||||||
print(make_release_message(version))
|
print(make_release_message(version))
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in new issue
Block a user