Skip to content

Commit 1bd356e

Browse files
authored
Merge pull request #27 from zasexton/easy-install
Easy install
2 parents 25ad175 + b8af658 commit 1bd356e

File tree

1 file changed

+64
-18
lines changed

1 file changed

+64
-18
lines changed

.github/workflows/upload.yml

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,57 @@ on:
1313
- "false"
1414

1515
jobs:
16-
build_wheels:
17-
# We'll build on a matrix of OSes and Python versions.
16+
build_base_wheel:
17+
# Build the pure-Python wheel once (no platform matrix needed)
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Check out code
21+
uses: actions/checkout@v4
22+
23+
- name: Install build dependencies
24+
run: |
25+
pip install --upgrade pip && pip install build
26+
27+
- name: Build base wheel (pure-Python svv)
28+
run: python -m build --wheel --outdir dist
29+
30+
- name: Upload base wheel artifact
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: base-wheel
34+
path: dist/*.whl
35+
36+
build_wheels_accelerated:
1837
runs-on: ${{ matrix.os }}
1938
strategy:
2039
matrix:
2140
os: [macOS-latest, ubuntu-latest, windows-latest]
2241
env:
2342
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
24-
CIBW_ENVIRONMENT: "PIP_NO_CACHE_DIR=1"
2543
CIBW_BUILD_VERBOSITY: 3
44+
# Install build deps before building each wheel (use python -m pip for Windows compatibility)
45+
CIBW_BEFORE_BUILD: "python -m pip install -U pip setuptools wheel cython numpy cmake"
46+
# Tell setup.py to build the companion 'svv-accelerated' distribution
47+
CIBW_ENVIRONMENT: "PIP_NO_CACHE_DIR=1 SVV_ACCEL_COMPANION=1"
2648

2749
steps:
2850
- name: Check out code
2951
uses: actions/checkout@v4
3052

31-
- name: Install build dependencies
32-
run: |
33-
pip install --upgrade pip && pip install cibuildwheel twine
34-
35-
- name: Upgrade pip, setuptools, wheel
36-
run: python -m pip install --upgrade setuptools wheel
53+
- name: Install cibuildwheel
54+
run: pip install --upgrade pip && pip install cibuildwheel
3755

38-
- name: Build wheels
56+
- name: Build wheels (svv-accelerated)
3957
run: cibuildwheel --output-dir dist
4058

4159
- name: Upload artifacts
4260
uses: actions/upload-artifact@v4
4361
with:
44-
name: cibw-wheels-${{ matrix.os }}
62+
name: cibw-wheels-accelerated-${{ matrix.os }}
4563
path: dist
4664

4765
build_sdist:
48-
needs: [build_wheels]
66+
needs: [build_base_wheel]
4967
runs-on: ubuntu-latest
5068
steps:
5169
- uses: actions/checkout@v4
@@ -63,22 +81,50 @@ jobs:
6381
path: dist/*.tar.gz
6482

6583
upload_pypi:
66-
needs: [build_wheels, build_sdist]
84+
needs: [build_base_wheel, build_wheels_accelerated, build_sdist]
6785
runs-on: ubuntu-latest
6886
steps:
6987
- uses: actions/download-artifact@v4
7088
with:
71-
# unpacks all CIBW artifacts into dist/
72-
pattern: cibw-*
89+
# download all artifacts from previous jobs (base wheels, sdist, accelerated wheels)
90+
pattern: '*'
7391
path: dist
7492
merge-multiple: true
7593

7694
- name: Install build dependencies
7795
run: |
7896
pip install --upgrade pip && pip install twine
7997
80-
- name: Upload to PyPI
81-
run: twine upload --repository pypi dist/*
98+
- name: Upload base package (svv) to PyPI
99+
run: |
100+
set -euo pipefail
101+
files=$(ls dist/svv-*.whl dist/svv-*.tar.gz 2>/dev/null | grep -v 'svv-accelerated' || true)
102+
if [ -z "$files" ]; then
103+
echo "No base svv artifacts found; skipping upload."
104+
exit 0
105+
fi
106+
if [ -z "${{ secrets.PYPI_PASSWORD_SVV }}" ]; then
107+
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.";
108+
exit 1
109+
fi
110+
twine upload --non-interactive --skip-existing --verbose --repository pypi $files
111+
env:
112+
TWINE_USERNAME: __token__
113+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD_SVV }}
114+
115+
- name: Upload accelerated wheels (svv-accelerated) to PyPI
116+
run: |
117+
set -euo pipefail
118+
files=$(ls dist/svv-accelerated-*.whl 2>/dev/null || true)
119+
if [ -z "$files" ]; then
120+
echo "No svv-accelerated artifacts found; skipping upload."
121+
exit 0
122+
fi
123+
if [ -z "${{ secrets.PYPI_PASSWORD_ACCEL }}" ]; then
124+
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.";
125+
exit 1
126+
fi
127+
twine upload --non-interactive --skip-existing --verbose --repository pypi $files
82128
env:
83129
TWINE_USERNAME: __token__
84-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
130+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD_ACCEL }}

0 commit comments

Comments
 (0)