Skip to content

Commit ae6bba2

Browse files
committed
CI: split PyPI uploads for svv and svv-accelerated; add per-project secrets and robust file selection
1 parent 65c09c3 commit ae6bba2

File tree

1 file changed

+63
-6
lines changed

1 file changed

+63
-6
lines changed

.github/workflows/upload.yml

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,35 @@ jobs:
4444
name: cibw-wheels-${{ matrix.os }}
4545
path: dist
4646

47+
build_wheels_accelerated:
48+
runs-on: ${{ matrix.os }}
49+
strategy:
50+
matrix:
51+
os: [macOS-latest, ubuntu-latest, windows-latest]
52+
env:
53+
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
54+
CIBW_BUILD_VERBOSITY: 3
55+
# Install build deps before building each wheel (use python -m pip for Windows compatibility)
56+
CIBW_BEFORE_BUILD: "python -m pip install -U pip setuptools wheel cython numpy cmake"
57+
# Tell setup.py to build the companion 'svv-accelerated' distribution
58+
CIBW_ENVIRONMENT: "PIP_NO_CACHE_DIR=1 SVV_ACCEL_COMPANION=1"
59+
60+
steps:
61+
- name: Check out code
62+
uses: actions/checkout@v4
63+
64+
- name: Install cibuildwheel
65+
run: pip install --upgrade pip && pip install cibuildwheel
66+
67+
- name: Build wheels (svv-accelerated)
68+
run: cibuildwheel --output-dir dist
69+
70+
- name: Upload artifacts
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: cibw-wheels-accelerated-${{ matrix.os }}
74+
path: dist
75+
4776
build_sdist:
4877
needs: [build_wheels]
4978
runs-on: ubuntu-latest
@@ -63,22 +92,50 @@ jobs:
6392
path: dist/*.tar.gz
6493

6594
upload_pypi:
66-
needs: [build_wheels, build_sdist]
95+
needs: [build_wheels, build_wheels_accelerated, build_sdist]
6796
runs-on: ubuntu-latest
6897
steps:
6998
- uses: actions/download-artifact@v4
7099
with:
71-
# unpacks all CIBW artifacts into dist/
72-
pattern: cibw-*
100+
# download all artifacts from previous jobs (base wheels, sdist, accelerated wheels)
101+
pattern: '*'
73102
path: dist
74103
merge-multiple: true
75104

76105
- name: Install build dependencies
77106
run: |
78107
pip install --upgrade pip && pip install twine
79108
80-
- name: Upload to PyPI
81-
run: twine upload --repository pypi dist/*
109+
- name: Upload base package (svv) to PyPI
110+
run: |
111+
set -euo pipefail
112+
files=$(ls dist/svv-*.whl dist/svv-*.tar.gz 2>/dev/null | grep -v 'svv-accelerated' || true)
113+
if [ -z "$files" ]; then
114+
echo "No base svv artifacts found; skipping upload."
115+
exit 0
116+
fi
117+
if [ -z "${{ secrets.PYPI_PASSWORD_SVV }}" ]; then
118+
echo "::error title=Missing secret::The repository secret 'PYPI_PASSWORD_SVV' is not configured. Set it to a PyPI API token with access to the 'svv' project.";
119+
exit 1
120+
fi
121+
twine upload --non-interactive --skip-existing --verbose --repository pypi $files
122+
env:
123+
TWINE_USERNAME: __token__
124+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD_SVV }}
125+
126+
- name: Upload accelerated wheels (svv-accelerated) to PyPI
127+
run: |
128+
set -euo pipefail
129+
files=$(ls dist/svv-accelerated-*.whl 2>/dev/null || true)
130+
if [ -z "$files" ]; then
131+
echo "No svv-accelerated artifacts found; skipping upload."
132+
exit 0
133+
fi
134+
if [ -z "${{ secrets.PYPI_PASSWORD_ACCEL }}" ]; then
135+
echo "::error title=Missing secret::The repository secret 'PYPI_PASSWORD_ACCEL' is not configured. Set it to a PyPI API token with access to the 'svv-accelerated' project.";
136+
exit 1
137+
fi
138+
twine upload --non-interactive --skip-existing --verbose --repository pypi $files
82139
env:
83140
TWINE_USERNAME: __token__
84-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
141+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD_ACCEL }}

0 commit comments

Comments
 (0)