From d06d83ef0707cd9b02c0633aba1999c49bc15db3 Mon Sep 17 00:00:00 2001 From: Moandor Date: Thu, 12 Nov 2020 11:42:51 +0800 Subject: [PATCH] [github-actions] retry coverage uploading on failures (#5799) --- script/test | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/script/test b/script/test index 7dc18b919..7de8fe87e 100755 --- a/script/test +++ b/script/test @@ -420,14 +420,28 @@ do_generate_coverage() do_upload_codecov() { ls -R coverage/ + readarray -d '' files < <(find coverage/ -type f -name 'coverage*.info' -print0) + local args=() for i in "${files[@]}"; do args+=('-a') args+=("$i") done lcov "${args[@]}" -o final.info - bash <(curl -s https://codecov.io/bash) -f final.info -Z + + local retry_count=5 + local fail_count=0 + until ((fail_count > retry_count)); do + bash <(curl -s https://codecov.io/bash) -f final.info -Z && break + ((++fail_count)) + echo >&2 "Upload failed, retrying (${fail_count}/${retry_count})" + sleep 1m + done + + if ((fail_count > retry_count)); then + exit 1 + fi } envsetup()