Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .circleci/ats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,29 @@ uv run --frozen codecovcli static-analysis --token ${CODECOV_STATIC_TOKEN} --fol
ATS_COLLECT_ARGS="${ATS_COLLECT_ARGS}${DEFAULT_TESTS},"
echo "Label analysis with base sha: ${BASE_SHA} and default tests: ${ATS_COLLECT_ARGS}"
runner_param="collect_tests_options=${ATS_COLLECT_ARGS}"
response=$(uv run --frozen codecovcli label-analysis --token ${CODECOV_STATIC_TOKEN} --base-sha=$BASE_SHA --dry-run --dry-run-format="json" --runner-param "$runner_param")

# Always get last 10 commits as fallback options, starting with BASE_SHA if provided
base_commit_candidates=($(git log --format=%H | sed -n "1,10p"))
if [[ -n ${BASE_SHA} ]]; then
# Prepend BASE_SHA to the candidates list if it's provided
base_commit_candidates=("${BASE_SHA}" "${base_commit_candidates[@]}")
fi

for base_commit in ${base_commit_candidates[@]}
do
echo "Attempting label analysis with base commit: $base_commit"
response=$(uv run --frozen codecovcli label-analysis --token ${CODECOV_STATIC_TOKEN} --base-sha=$base_commit --dry-run --dry-run-format="json" --runner-param "$runner_param" --max-wait-time=30 || true)
if [[ -n $response ]]; then
break
else
echo "-> Attempt failed"
fi
done

if [[ -z $response ]]; then
echo "Failed to run label analysis with any base commit."
fi

mkdir codecov_ats
jq <<< "$response" '.runner_options + .ats_tests_to_run | .[1:] | map(gsub("\""; "")) | join(" ")' --raw-output > codecov_ats/tests_to_run.txt
jq <<< "$response" '.runner_options + .ats_tests_to_skip | .[1:] | map(gsub("\""; "")) | join(" ")' --raw-output > codecov_ats/tests_to_skip.txt
Expand Down