Skip to content

Commit

Permalink
ci: fix artifact download and include test pypi publish
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoralez committed Sep 13, 2024
1 parent f05ac5c commit c7efab6
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 5 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upload Python Package
name: Upload Python Package to PyPI

on:
push:
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
with:
path: dist/*.tar.gz

upload_to_pypi:
upload:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
Expand All @@ -70,8 +70,7 @@ jobs:
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: artifact
path: dist
merge-multiple: true

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@0ab0b79471669eb3a4d647e625009c62f9f3b241 # v1.10.1
- uses: pypa/gh-action-pypi-publish@0ab0b79471669eb3a4d647e625009c62f9f3b241 # v1.10.1
77 changes: 77 additions & 0 deletions .github/workflows/test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Upload Python Package to TestPyPI

on:
workflow_dispatch:

jobs:
build_wheels:
name: Build wheels for cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}
runs-on: ${{ matrix.os-platform[0] }}
strategy:
fail-fast: false
matrix:
python-version: [38, 39, 310, 311, 312]
os-platform:
[
[ubuntu-latest, manylinux_x86_64],
[ubuntu-latest, manylinux_aarch64],
[windows-latest, win_amd64],
[macos-12, macosx_x86_64],
[macos-14, macosx_arm64],
]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: "true"

- name: Set up QEMU
if: matrix.os-platform[1] == 'manylinux_aarch64'
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: arm64

- name: Build wheels
uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0
env:
CIBW_BUILD: cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}

- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: artifact-cp${{ matrix.python-version }}-${{ matrix.os-platform[1] }}
path: wheelhouse/*.whl
retention-days: 1

build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.10"

- name: Build sdist
run: |
python -m pip install build
python -m build --sdist --outdir dist
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
path: dist/*.tar.gz

upload:
name: Upload to Test PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@0ab0b79471669eb3a4d647e625009c62f9f3b241 # v1.10.1
with:
repository-url: https://test.pypi.org/legacy/

0 comments on commit c7efab6

Please sign in to comment.