Skip to content

Commit b8b018a

Browse files
authored
Fixing the artifact generation to use the right Python versions (#157)
* Fixing the artifact generation to use the right Python versions * Building one abi wheel per OS/arch for pecos-rslib and testing the installation/import per supported Python versions
1 parent f262abd commit b8b018a

File tree

1 file changed

+67
-18
lines changed

1 file changed

+67
-18
lines changed

.github/workflows/python-release.yml

Lines changed: 67 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Python Artifacts
22

33
env:
44
TRIGGER_ON_PR_PUSH: true # Set to true to enable triggers on PR pushes
5-
PYTHON_VERSION: '3.10'
65

76
on:
87
push:
@@ -63,7 +62,6 @@ jobs:
6362
fail-fast: false
6463
matrix:
6564
os: [ubuntu-latest, macos-latest, windows-latest]
66-
python-version: ['3.10', '3.11', '3.12', '3.13']
6765
architecture: [ x86_64, aarch64 ]
6866
exclude:
6967
- os: windows-latest
@@ -77,7 +75,7 @@ jobs:
7775
- name: Set up Python
7876
uses: actions/setup-python@v5
7977
with:
80-
python-version: ${{ matrix.python-version }}
78+
python-version: '3.10'
8179

8280
- name: Remove conflicting README.md
8381
run: |
@@ -92,7 +90,7 @@ jobs:
9290
uses: PyO3/maturin-action@v1
9391
with:
9492
command: build
95-
args: --release --out dist --interpreter python${{ matrix.python-version }}
93+
args: --release --out dist --interpreter python3.10
9694
working-directory: python/pecos-rslib
9795
target: ${{ matrix.architecture == 'aarch64' && (matrix.os == 'macos-latest' && 'aarch64-apple-darwin' || 'aarch64-unknown-linux-gnu') || (matrix.os == 'macos-latest' && 'x86_64-apple-darwin' || '') }}
9896
manylinux: auto
@@ -116,18 +114,73 @@ jobs:
116114
echo "No README.md backup found"
117115
fi
118116
119-
- name: Test wheel
120-
if: ${{ !(matrix.architecture == 'x86_64' && matrix.os == 'macos-latest') && matrix.architecture != 'aarch64' }}
117+
- name: Test wheel is abi3
121118
run: |
122-
pip install --force-reinstall --verbose python/pecos-rslib/dist/*.whl
123-
python -c 'import pecos_rslib; print(pecos_rslib.__version__)'
119+
# Check that the wheel has abi3 tag
120+
ls -la python/pecos-rslib/dist/
121+
wheel_file=$(ls python/pecos-rslib/dist/*.whl)
122+
echo "Built wheel: $wheel_file"
123+
if [[ $wheel_file == *"abi3"* ]]; then
124+
echo "Wheel has abi3 tag"
125+
else
126+
echo "ERROR: Wheel does not have abi3 tag!"
127+
exit 1
128+
fi
124129
125130
- name: Upload wheel
126131
uses: actions/upload-artifact@v4
127132
with:
128-
name: wheel-pecos-rslib-${{ matrix.os }}-${{ matrix.architecture }}-py${{ matrix.python-version }}
133+
name: wheel-pecos-rslib-${{ matrix.os }}-${{ matrix.architecture }}
129134
path: python/pecos-rslib/dist/*.whl
130135

136+
test_abi3_wheels:
137+
needs: build_wheels_pecos_rslib
138+
runs-on: ${{ matrix.runner }}
139+
strategy:
140+
fail-fast: false
141+
matrix:
142+
python-version: ['3.10', '3.11', '3.12', '3.13']
143+
include:
144+
# Linux x86_64
145+
- runner: ubuntu-latest
146+
os: ubuntu-latest
147+
architecture: x86_64
148+
# Windows x86_64
149+
- runner: windows-latest
150+
os: windows-latest
151+
architecture: x86_64
152+
# macOS x86_64 (Intel)
153+
- runner: macos-13
154+
os: macos-latest
155+
architecture: x86_64
156+
# macOS aarch64 (Apple Silicon)
157+
- runner: macos-latest
158+
os: macos-latest
159+
architecture: aarch64
160+
steps:
161+
- uses: actions/checkout@v4
162+
with:
163+
ref: ${{ inputs.sha || github.sha }}
164+
165+
- name: Set up Python ${{ matrix.python-version }}
166+
uses: actions/setup-python@v5
167+
with:
168+
python-version: ${{ matrix.python-version }}
169+
170+
- name: Download abi3 wheel
171+
uses: actions/download-artifact@v4
172+
with:
173+
name: wheel-pecos-rslib-${{ matrix.os }}-${{ matrix.architecture }}
174+
path: ./pecos-rslib-wheel
175+
176+
- name: Test abi3 wheel with Python ${{ matrix.python-version }}
177+
run: |
178+
echo "Testing abi3 wheel with Python ${{ matrix.python-version }}"
179+
python --version
180+
pip install --force-reinstall --verbose ./pecos-rslib-wheel/*.whl
181+
python -c 'import pecos_rslib; print(f"pecos_rslib version: {pecos_rslib.__version__}")'
182+
python -c 'import sys; print(f"Python version: {sys.version}")'
183+
131184
build_sdist_quantum_pecos:
132185
needs: [check_pr_push, build_wheels_pecos_rslib]
133186
if: |
@@ -143,12 +196,12 @@ jobs:
143196
- name: Set up Python
144197
uses: actions/setup-python@v5
145198
with:
146-
python-version: ${{ env.PYTHON_VERSION }}
199+
python-version: '3.10'
147200

148201
- name: Download pecos-rslib wheel
149202
uses: actions/download-artifact@v4
150203
with:
151-
name: wheel-pecos-rslib-ubuntu-latest-x86_64-py${{ env.PYTHON_VERSION }}
204+
name: wheel-pecos-rslib-ubuntu-latest-x86_64
152205
path: ./pecos-rslib-wheel
153206

154207
- name: Install pecos-rslib
@@ -188,24 +241,21 @@ jobs:
188241
(needs.check_pr_push.result == 'success' && needs.check_pr_push.outputs.run == 'true' || needs.check_pr_push.result == 'skipped') &&
189242
(github.event_name != 'pull_request' || github.event.pull_request.merged == true || github.event.action == 'opened' || github.event.action == 'synchronize')
190243
runs-on: ubuntu-latest
191-
strategy:
192-
matrix:
193-
python-version: ['3.10', '3.11', '3.12', '3.13']
194244

195245
steps:
196246
- uses: actions/checkout@v4
197247
with:
198248
ref: ${{ inputs.sha || github.sha }}
199249

200-
- name: Set up Python ${{ matrix.python-version }}
250+
- name: Set up Python
201251
uses: actions/setup-python@v5
202252
with:
203-
python-version: ${{ matrix.python-version }}
253+
python-version: '3.10'
204254

205255
- name: Download pecos-rslib wheel
206256
uses: actions/download-artifact@v4
207257
with:
208-
name: wheel-pecos-rslib-ubuntu-latest-x86_64-py${{ matrix.python-version }}
258+
name: wheel-pecos-rslib-ubuntu-latest-x86_64
209259
path: ./pecos-rslib-wheel
210260

211261
- name: Install pecos-rslib
@@ -234,7 +284,6 @@ jobs:
234284
235285
- name: Upload quantum-pecos wheel
236286
uses: actions/upload-artifact@v4
237-
if: matrix.python-version == '3.10'
238287
with:
239288
name: wheel-quantum-pecos
240289
path: python/quantum-pecos/dist/*.whl

0 commit comments

Comments
 (0)