@@ -61,23 +61,27 @@ jobs:
6161 exit 0
6262 fi
6363
64- PYPI_URL="https://pypi.org/pypi/dsf-mobility/${VERSION}/json"
6564 PYPI_NAME="PyPI"
66-
67- echo "Checking if dsf-mobility version ${VERSION} exists on ${PYPI_NAME}..."
68-
69- # Check PyPI/TestPyPI API for the specific version
70- HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "${PYPI_URL}")
71-
72- if [ "$HTTP_STATUS" = "200" ]; then
73- echo "Version ${VERSION} already exists on ${PYPI_NAME}"
74- echo "Version already published; skipping build and publish jobs."
75- echo "should_build=false" >> "$GITHUB_OUTPUT"
76- exit 0
77- else
78- echo "Version ${VERSION} does not exist on ${PYPI_NAME} (HTTP ${HTTP_STATUS})"
79- echo "should_build=true" >> "$GITHUB_OUTPUT"
80- fi
65+ PACKAGES=("dsf-mobility" "dsf-mobility-hpc")
66+
67+ for PACKAGE in "${PACKAGES[@]}"; do
68+ PYPI_URL="https://pypi.org/pypi/${PACKAGE}/${VERSION}/json"
69+ echo "Checking if ${PACKAGE} version ${VERSION} exists on ${PYPI_NAME}..."
70+
71+ # Check PyPI API for the specific version
72+ HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "${PYPI_URL}")
73+
74+ if [ "$HTTP_STATUS" = "200" ]; then
75+ echo "Version ${VERSION} already exists for ${PACKAGE} on ${PYPI_NAME}."
76+ echo "Version already published for at least one package; skipping build and publish jobs."
77+ echo "should_build=false" >> "$GITHUB_OUTPUT"
78+ exit 0
79+ fi
80+
81+ echo "Version ${VERSION} does not exist for ${PACKAGE} on ${PYPI_NAME} (HTTP ${HTTP_STATUS})"
82+ done
83+
84+ echo "should_build=true" >> "$GITHUB_OUTPUT"
8185
8286 uv-validate :
8387 name : Validate uv workflows
@@ -156,31 +160,40 @@ jobs:
156160 python -m pip install --upgrade pip
157161 python -m pip install build wheel setuptools pybind11-stubgen auditwheel
158162
163+ - name : Switch package name for HPC distribution
164+ if : matrix.build_variant == 'hpc'
165+ run : |
166+ python - <<'PY'
167+ from pathlib import Path
168+
169+ pyproject_path = Path("pyproject.toml")
170+ content = pyproject_path.read_text(encoding="utf-8")
171+ old = 'name = "dsf-mobility"'
172+ new = 'name = "dsf-mobility-hpc"'
173+ if old not in content:
174+ raise RuntimeError("Unable to locate project name in pyproject.toml")
175+ pyproject_path.write_text(content.replace(old, new, 1), encoding="utf-8")
176+ print("Switched project name to dsf-mobility-hpc for HPC build")
177+ PY
178+
179+ - name : Clean previous build artifacts
180+ run : |
181+ rm -rf dist wheelhouse
182+ rm -rf build/temp.* build/lib.*
183+
159184 - name : Build wheel
160185 env :
161186 CMAKE_ARGS : " -DDSF_OPTIMIZE_ARCH=OFF"
162187 DSF_PACKAGE_VERSION : ${{ needs.check-version.outputs.publish_version }}
163188 DSF_HPC_BUILD : ${{ matrix.build_variant == 'hpc' && '1' || '0' }}
164189 run : |
165- rm -rf dist wheelhouse
166190 python -m build --wheel
167191
168192 - name : Repair wheel (auditwheel)
169193 run : |
170194 mkdir -p wheelhouse
171195 auditwheel repair dist/*.whl -w wheelhouse
172196
173- - name : Rename HPC wheels with _hpc suffix
174- if : matrix.build_variant == 'hpc'
175- run : |
176- cd wheelhouse
177- for whl in *.whl; do
178- # Insert _hpc before .whl suffix
179- new_name="${whl%.whl}_hpc.whl"
180- mv "$whl" "$new_name"
181- done
182- ls -la
183-
184197 - name : Test wheel installation
185198 run : |
186199 python -m pip install wheelhouse/*.whl
@@ -193,14 +206,13 @@ jobs:
193206 path : wheelhouse/*.whl
194207
195208 build-wheels-macos :
196- name : Build wheels on macOS (Python ${{ matrix.python-version }} - ${{ matrix.build_variant }} )
209+ name : Build wheels on macOS (Python ${{ matrix.python-version }})
197210 needs : [check-version, uv-validate]
198211 runs-on : macos-latest
199212 if : needs.check-version.outputs.should_build == 'true'
200213 strategy :
201214 matrix :
202215 python-version : ['3.10', '3.12']
203- build_variant : ['standard', 'hpc']
204216
205217 steps :
206218 - name : Checkout repository
@@ -225,44 +237,37 @@ jobs:
225237 echo "ARCHFLAGS=-arch $(uname -m)" >> $GITHUB_ENV
226238 echo "_PYTHON_HOST_PLATFORM=macosx-$(sw_vers -productVersion | cut -d. -f1)-$(uname -m)" >> $GITHUB_ENV
227239
240+ - name : Clean previous build artifacts
241+ run : |
242+ rm -rf dist wheelhouse
243+ rm -rf build/temp.* build/lib.*
244+
228245 - name : Build wheel
229246 env :
230247 CMAKE_ARGS : " -DDSF_OPTIMIZE_ARCH=OFF"
231248 DSF_PACKAGE_VERSION : ${{ needs.check-version.outputs.publish_version }}
232- DSF_HPC_BUILD : ${{ matrix.build_variant == 'hpc' && '1' || '0' }}
249+ DSF_HPC_BUILD : " 0 "
233250 run : python -m build --wheel
234251
235252 - name : Repair wheel (bundle libraries)
236253 run : |
237254 mkdir -p wheelhouse
238255 delocate-wheel -w wheelhouse -v --require-archs $(uname -m) dist/*.whl
239256
240- - name : Rename HPC wheels with _hpc suffix
241- if : matrix.build_variant == 'hpc'
242- run : |
243- cd wheelhouse
244- for whl in *.whl; do
245- # Insert _hpc before .whl suffix
246- new_name="${whl%.whl}_hpc.whl"
247- mv "$whl" "$new_name"
248- done
249- ls -la
250-
251257 - name : Upload wheels as artifacts
252258 uses : actions/upload-artifact@v6
253259 with :
254- name : wheel-macos-${{ matrix.python-version }}-${{ matrix.build_variant }}
260+ name : wheel-macos-${{ matrix.python-version }}
255261 path : wheelhouse/*.whl
256262
257263 build-wheels-windows :
258- name : Build wheels on Windows (Python ${{ matrix.python-version }} - ${{ matrix.build_variant }} )
264+ name : Build wheels on Windows (Python ${{ matrix.python-version }})
259265 needs : [check-version, uv-validate]
260266 runs-on : windows-latest
261267 if : needs.check-version.outputs.should_build == 'true'
262268 strategy :
263269 matrix :
264270 python-version : ['3.10', '3.12']
265- build_variant : ['standard', 'hpc']
266271
267272 steps :
268273 - name : Checkout repository
@@ -289,29 +294,23 @@ jobs:
289294 python -m pip install --upgrade pip
290295 python -m pip install build wheel setuptools pybind11-stubgen
291296
297+ - name : Clean previous build artifacts
298+ shell : bash
299+ run : |
300+ rm -rf dist wheelhouse
301+ rm -rf build/temp.* build/lib.*
302+
292303 - name : Build wheel
293304 env :
294305 CMAKE_ARGS : " -DDSF_OPTIMIZE_ARCH=OFF"
295306 DSF_PACKAGE_VERSION : ${{ needs.check-version.outputs.publish_version }}
296- DSF_HPC_BUILD : ${{ matrix.build_variant == 'hpc' && '1' || '0' }}
307+ DSF_HPC_BUILD : " 0 "
297308 run : python -m build --wheel
298309
299- - name : Rename HPC wheels with _hpc suffix
300- if : matrix.build_variant == 'hpc'
301- shell : bash
302- run : |
303- cd dist
304- for whl in *.whl; do
305- # Insert _hpc before .whl suffix
306- new_name="${whl%.whl}_hpc.whl"
307- mv "$whl" "$new_name"
308- done
309- ls -la
310-
311310 - name : Upload wheels as artifacts
312311 uses : actions/upload-artifact@v6
313312 with :
314- name : wheel-windows-${{ matrix.python-version }}-${{ matrix.build_variant }}
313+ name : wheel-windows-${{ matrix.python-version }}
315314 path : dist/*.whl
316315
317316 build-sdist :
0 commit comments