Skip to content

Commit

Permalink
Update the ATS post-processing to be more concise and remove set +e
Browse files Browse the repository at this point in the history
  • Loading branch information
giovanni-guidini committed Oct 9, 2023
1 parent 07590c6 commit c5dee75
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/codecov_ats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,30 +89,22 @@ jobs:
id: label_analysis
continue-on-error: true
run: |
set +e
BASE_COMMIT=$(git rev-parse ${{ github.sha }}^)
echo $BASE_COMMIT
output=$(codecovcli --codecov-yml-path=codecov.yml label-analysis --dry-run --token=${CODECOV_STATIC_TOKEN} --base-sha=${BASE_COMMIT})
output=$(codecovcli --codecov-yml-path=codecov.yml label-analysis --dry-run --token=${CODECOV_STATIC_TOKEN} --base-sha=${BASE_COMMIT} || true)
json_output=$(echo $output | grep -o -e "{.*}")
if [ $? -eq 0 ]
then
tests_to_run=$(echo $json_output | jq -r '.ats_tests_to_run[]' | tr '\n' ' ')
tests_to_skip=$(echo $json_output | jq -r '.ats_tests_to_skip[]' | tr '\n' ' ')
runner_options=$(echo $json_output | jq -r '.runner_options[]' | tr '\n' ' ')
echo $ATS_TESTS_TO_RUN
echo $ATS_TESTS_TO_SKIP
echo "ATS_TESTS_TO_RUN=$(echo $runner_options $tests_to_run)" >> "$GITHUB_OUTPUT"
echo "ATS_TESTS_TO_SKIP=$(echo $runner_options $tests_to_skip)" >> "$GITHUB_OUTPUT"
echo ATS_TESTS_TO_RUN=$(jq <<< $json_output '.runner_options + .ats_tests_to_run | map(@sh) | join(" ")' --raw-output) >> "$GITHUB_OUTPUT"
echo ATS_TESTS_TO_SKIP=$(jq <<< $json_output '.runner_options + .ats_tests_to_skip | map(@sh) | join(" ")' --raw-output) >> "$GITHUB_OUTPUT"
test_to_run_count=$(echo $json_output | jq '.ats_tests_to_run | length')
test_to_skip_count=$(echo $json_output | jq '.ats_tests_to_skip | length')
total_tests_count=$(($test_to_run_count + $test_to_skip_count))
echo "Selected $test_to_run_count / $total_tests_count tests to run" >> $GITHUB_STEP_SUMMARY
else
echo "ATS failed. Can't get list of tests to run. Fallback to all tests"
echo "ATS failed. Can't get list of tests to run. Fallback to all tests" >> $GITHUB_STEP_SUMMARY
tee <<< "ATS failed. Can't get list of tests to run. Fallback to all tests" "$GITHUB_STEP_SUMMARY"
echo "ATS_TESTS_TO_RUN=--cov-context=test" >> "$GITHUB_OUTPUT"
echo "ATS_TESTS_TO_SKIP=" >> "$GITHUB_OUTPUT"
fi
Expand Down

0 comments on commit c5dee75

Please sign in to comment.