mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-07 01:53:24 +09:00
[Fix] (CI): retrace exit detection tolerates a single failed pidof, and artifact cleanup lists jobs in pages the API serves.
This commit is contained in:
@@ -733,7 +733,8 @@ jobs:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
# Fail before deletion if either paginated inventory cannot be read.
|
||||
gh api --paginate "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs?per_page=100" \
|
||||
# 50 rows per page: the jobs endpoint answers HTTP 502 for 90+ rows on a re-run attempt of a run this size.
|
||||
gh api --paginate "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs?per_page=50" \
|
||||
--jq '.jobs[] | select(.name | startswith("retrace (")) | select(.conclusion == "failure" or .conclusion == "cancelled" or .conclusion == "timed_out" or .conclusion == "action_required") | .name' \
|
||||
> "${RUNNER_TEMP}/cleanup-jobs.txt"
|
||||
gh api --paginate "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts?per_page=100" \
|
||||
|
||||
@@ -3465,7 +3465,8 @@ jobs:
|
||||
# Read the complete inventories before deleting anything. A failed API
|
||||
# request must fail this step, not look like "no failed cases" through
|
||||
# an unchecked process substitution.
|
||||
gh api --paginate "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs?per_page=100" \
|
||||
# 50 rows per page: the jobs endpoint answers HTTP 502 for 90+ rows on a re-run attempt of a run this size.
|
||||
gh api --paginate "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs?per_page=50" \
|
||||
--jq '.jobs[] | select((.name | startswith("retrace (")) or (.name | startswith("retrace verify (")) or (.name | startswith("retrace split ("))) | select(.conclusion == "failure" or .conclusion == "cancelled" or .conclusion == "timed_out" or .conclusion == "action_required") | .name' \
|
||||
> "${RUNNER_TEMP}/cleanup-jobs.txt"
|
||||
gh api --paginate "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts?per_page=100" \
|
||||
|
||||
@@ -511,6 +511,10 @@ run_retrace() {
|
||||
|
||||
app_exited=0
|
||||
saw_app_process=0
|
||||
# One failed pidof is not an exit: under memory pressure the adb shell call
|
||||
# itself can fail while the app is alive (seen with the process still in
|
||||
# pidof and the activity still initializing right after the "exit").
|
||||
missed_app_polls=0
|
||||
poll_started="$(date +%s)"
|
||||
for _ in $(seq 1 "${timeout_seconds}"); do
|
||||
if adb_device_path shell run-as "${package_name}" ls "${app_dir}/output/result.json" >/dev/null 2>&1; then
|
||||
@@ -518,6 +522,7 @@ run_retrace() {
|
||||
fi
|
||||
if adb_device_path shell pidof "${package_name}" >/dev/null 2>&1; then
|
||||
saw_app_process=1
|
||||
missed_app_polls=0
|
||||
else
|
||||
poll_adb_state="$(adb_device_path get-state 2>/dev/null | tr -d '\r' || true)"
|
||||
if [ "${poll_adb_state}" != "device" ]; then
|
||||
@@ -525,8 +530,11 @@ run_retrace() {
|
||||
break
|
||||
fi
|
||||
if [ "${saw_app_process}" -eq 1 ]; then
|
||||
app_exited=1
|
||||
break
|
||||
missed_app_polls=$((missed_app_polls + 1))
|
||||
if [ "${missed_app_polls}" -ge 3 ]; then
|
||||
app_exited=1
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
Reference in New Issue
Block a user