Skip to content

Commit

Permalink
[EZ] Use curl --fail to correctly fail the job when the link is inval…
Browse files Browse the repository at this point in the history
…id (#5988)

As the job downloads the link and store the content in a file before
continuing, it makes sense to fail it when the link is invalid, i.e.
https://gha-artifacts.s3.amazonaws.com/pytorch/executorch/12021308640/artifacts/stories110M_xnnpack/model.zip.
Otherwise, the subsequent test step would fail anyway, but we waste
sometimes spinning up those mobile devices
  • Loading branch information
huydhn authored Nov 26, 2024
1 parent 38f185f commit f75268c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/mobile_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ jobs:
contents: read
outputs:
artifacts: ${{ inputs.device-type == 'ios' && steps.ios-test.outputs.artifacts || inputs.device-type == 'android' && steps.android-test.outputs.artifacts || '[]' }}
env:
CURL_PARAMS: -s --fail
steps:
- name: Clean workspace
run: |
Expand Down Expand Up @@ -161,7 +163,8 @@ jobs:
if [[ "${IPA_ARCHIVE}" == http* ]]; then
IPA_ARCHIVE_OUTPUT="ci.ipa"
curl -s "${IPA_ARCHIVE}" -o "${IPA_ARCHIVE_OUTPUT}"
# shellcheck disable=SC2086
curl ${CURL_PARAMS} "${IPA_ARCHIVE}" -o "${IPA_ARCHIVE_OUTPUT}"
ls -lah "${IPA_ARCHIVE_OUTPUT}"
else
IPA_ARCHIVE_OUTPUT="${IPA_ARCHIVE}"
Expand All @@ -172,7 +175,8 @@ jobs:
if [[ "${XCTESTRUN_ZIP}" == http* ]]; then
XCTESTRUN_ZIP_OUTPUT="ci.xctestrun.zip"
curl -s "${XCTESTRUN_ZIP}" -o "${XCTESTRUN_ZIP_OUTPUT}"
# shellcheck disable=SC2086
curl ${CURL_PARAMS} "${XCTESTRUN_ZIP}" -o "${XCTESTRUN_ZIP_OUTPUT}"
ls -lah "${XCTESTRUN_ZIP_OUTPUT}"
else
XCTESTRUN_ZIP_OUTPUT="${XCTESTRUN_ZIP}"
Expand All @@ -199,7 +203,8 @@ jobs:
if [[ "${APP_ARCHIVE}" == http* ]]; then
APP_ARCHIVE_OUTPUT="ci.apk"
curl -s "${APP_ARCHIVE}" -o "${APP_ARCHIVE_OUTPUT}"
# shellcheck disable=SC2086
curl ${CURL_PARAMS} "${APP_ARCHIVE}" -o "${APP_ARCHIVE_OUTPUT}"
ls -lah "${APP_ARCHIVE_OUTPUT}"
else
APP_ARCHIVE_OUTPUT="${APP_ARCHIVE}"
Expand All @@ -210,7 +215,8 @@ jobs:
if [[ "${TEST_ARCHIVE}" == http* ]]; then
TEST_ARCHIVE_OUTPUT="ci.test.apk"
curl -s "${TEST_ARCHIVE}" -o "${TEST_ARCHIVE_OUTPUT}"
# shellcheck disable=SC2086
curl ${CURL_PARAMS} "${TEST_ARCHIVE}" -o "${TEST_ARCHIVE_OUTPUT}"
ls -lah "${TEST_ARCHIVE_OUTPUT}"
else
TEST_ARCHIVE_OUTPUT="${TEST_ARCHIVE}"
Expand All @@ -230,7 +236,8 @@ jobs:
if [[ "${TEST_SPEC}" == http* ]]; then
TEST_SPEC_OUTPUT="ci.yml"
curl -s "${TEST_SPEC}" -o "${TEST_SPEC_OUTPUT}"
# shellcheck disable=SC2086
curl ${CURL_PARAMS} "${TEST_SPEC}" -o "${TEST_SPEC_OUTPUT}"
cat "${TEST_SPEC_OUTPUT}"
else
TEST_SPEC_OUTPUT="${TEST_SPEC}"
Expand All @@ -251,7 +258,8 @@ jobs:
if [[ "${EXTRA_DATA}" == http* ]]; then
EXTRA_DATA_OUTPUT="extra-data.zip"
curl -s "${EXTRA_DATA}" -o "${EXTRA_DATA_OUTPUT}"
# shellcheck disable=SC2086
curl ${CURL_PARAMS} "${EXTRA_DATA}" -o "${EXTRA_DATA_OUTPUT}"
ls -lah "${EXTRA_DATA_OUTPUT}"
else
EXTRA_DATA_OUTPUT="${EXTRA_DATA}"
Expand Down

0 comments on commit f75268c

Please sign in to comment.