Skip to content

Commit fedf511

Browse files
authored
[CI] Fix empty wheel artifact checks (#8434)
There was a bug in artifact preparation where `find "dist/" -name "*.whl"` returned success whenever `dist/` existed, even if it contained no wheels. The following `mv dist/*.whl` then failed and obscured the earlier build failure. This was observed in https://github.com/meta-pytorch/monarch/actions/runs/30938873470/job/92093926645. This change iterates over `dist/*.whl` and moves entries only when `[[ -f "${wheel}" ]]` succeeds. Missing and empty `dist/` directories are no-ops, while an actual `mv` error still fails the artifact preparation step. Test plan: - Ran the repository actionlint on the five changed workflows. - Verified missing, empty, and populated `dist/` behavior under Bash, including a wheel filename containing spaces. - Verified that a real `mv` failure is propagated.
1 parent 80e5be8 commit fedf511

5 files changed

Lines changed: 25 additions & 15 deletions

File tree

.github/workflows/linux_job.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,11 @@ jobs:
300300
if [[ -n "${UPLOAD_ARTIFACT_NAME}" ]]; then
301301
# If the default execution path is followed then we should get a wheel in the dist/ folder
302302
# attempt to just grab whatever is in there and scoop it all up
303-
if find "dist/" -name "*.whl" >/dev/null 2>/dev/null; then
304-
mv -v dist/*.whl "${RUNNER_ARTIFACT_DIR}/"
305-
fi
303+
for wheel in dist/*.whl; do
304+
if [[ -f "${wheel}" ]]; then
305+
mv -v "${wheel}" "${RUNNER_ARTIFACT_DIR}/"
306+
fi
307+
done
306308
if [[ -d "artifacts-to-be-uploaded" ]]; then
307309
mv -v artifacts-to-be-uploaded/* "${RUNNER_ARTIFACT_DIR}/"
308310
fi

.github/workflows/linux_job_v2.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,11 @@ jobs:
330330
if [[ -n "${UPLOAD_ARTIFACT_NAME}" ]]; then
331331
# If the default execution path is followed then we should get a wheel in the dist/ folder
332332
# attempt to just grab whatever is in there and scoop it all up
333-
if find "dist/" -name "*.whl" >/dev/null 2>/dev/null; then
334-
mv -v dist/*.whl "${RUNNER_ARTIFACT_DIR}/"
335-
fi
333+
for wheel in dist/*.whl; do
334+
if [[ -f "${wheel}" ]]; then
335+
mv -v "${wheel}" "${RUNNER_ARTIFACT_DIR}/"
336+
fi
337+
done
336338
if [[ -d "artifacts-to-be-uploaded" ]]; then
337339
mv -v artifacts-to-be-uploaded/* "${RUNNER_ARTIFACT_DIR}/"
338340
fi

.github/workflows/linux_job_v3.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,11 @@ jobs:
273273
if [[ -n "${UPLOAD_ARTIFACT_NAME}" ]]; then
274274
# If the default execution path is followed then we should get a wheel in the dist/ folder
275275
# attempt to just grab whatever is in there and scoop it all up
276-
if find "dist/" -name "*.whl" >/dev/null 2>/dev/null; then
277-
mv -v dist/*.whl "${RUNNER_ARTIFACT_DIR}/"
278-
fi
276+
for wheel in dist/*.whl; do
277+
if [[ -f "${wheel}" ]]; then
278+
mv -v "${wheel}" "${RUNNER_ARTIFACT_DIR}/"
279+
fi
280+
done
279281
if [[ -d "artifacts-to-be-uploaded" ]]; then
280282
mv -v artifacts-to-be-uploaded/* "${RUNNER_ARTIFACT_DIR}/"
281283
fi

.github/workflows/macos_job.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,11 @@ jobs:
195195
run: |
196196
# If the default execution path is followed then we should get a wheel in the dist/ folder
197197
# attempt to just grab whatever is in there and scoop it all up
198-
if find "dist/" -name "*.whl" >/dev/null 2>/dev/null; then
199-
mv -v dist/*.whl "${RUNNER_ARTIFACT_DIR}/"
200-
fi
198+
for wheel in dist/*.whl; do
199+
if [[ -f "${wheel}" ]]; then
200+
mv -v "${wheel}" "${RUNNER_ARTIFACT_DIR}/"
201+
fi
202+
done
201203
if [[ -d "artifacts-to-be-uploaded" ]]; then
202204
mv -v artifacts-to-be-uploaded/* "${RUNNER_ARTIFACT_DIR}/"
203205
fi

.github/workflows/windows_job.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,11 @@ jobs:
186186
run: |
187187
# If the default execution path is followed then we should get a wheel in the dist/ folder
188188
# attempt to just grab whatever is in there and scoop it all up
189-
if find "dist/" -name "*.whl" >/dev/null 2>/dev/null; then
190-
mv -v dist/*.whl "${RUNNER_ARTIFACT_DIR}/"
191-
fi
189+
for wheel in dist/*.whl; do
190+
if [[ -f "${wheel}" ]]; then
191+
mv -v "${wheel}" "${RUNNER_ARTIFACT_DIR}/"
192+
fi
193+
done
192194
if [[ -d "artifacts-to-be-uploaded" ]]; then
193195
mv -v artifacts-to-be-uploaded/* "${RUNNER_ARTIFACT_DIR}/"
194196
fi

0 commit comments

Comments
 (0)