Skip to content

Update ats script #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 30, 2025
Merged
Changes from 1 commit
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" --wait-time=2 || 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