Skip to content
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

Do not paint red for asan #9704

Merged
merged 7 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
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
19 changes: 14 additions & 5 deletions .github/actions/test_ya/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ runs:
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
-d '{"state":"pending","description":"The check has been started","context":"build_${{inputs.build_preset}}"}'

if [[ "${{inputs.run_tests}}" == "true" ]];then
if [[ "${{inputs.run_tests}}" == "true" ]]; then
curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
-d '{"state":"pending","description":"The check has been started","context":"test_${{inputs.build_preset}}"}'
Expand Down Expand Up @@ -187,6 +187,7 @@ runs:
)

TEST_RETRY_COUNT=${{ inputs.test_retry_count }}
IS_TEST_RESULT_IGNORED=0

case "$BUILD_PRESET" in
debug)
Expand All @@ -212,6 +213,7 @@ runs:
if [ $TEST_RETRY_COUNT -z ]; then
TEST_RETRY_COUNT=1
fi
IS_TEST_RESULT_IGNORED=1
;;
release-tsan)
params+=(
Expand All @@ -221,6 +223,7 @@ runs:
if [ $TEST_RETRY_COUNT -z ]; then
TEST_RETRY_COUNT=1
fi
IS_TEST_RESULT_IGNORED=1
;;
release-msan)
params+=(
Expand All @@ -230,12 +233,15 @@ runs:
if [ $TEST_RETRY_COUNT -z ]; then
TEST_RETRY_COUNT=1
fi
IS_TEST_RESULT_IGNORED=1
;;
*)
echo "Invalid preset: $BUILD_PRESET"
exit 1
;;
esac

echo "IS_TEST_RESULT_IGNORED=$IS_TEST_RESULT_IGNORED" >> $GITHUB_ENV

if [ $TEST_RETRY_COUNT -z ]; then
# default is 3 for ordinary build and 1 for sanitizer builds
Expand Down Expand Up @@ -434,6 +440,7 @@ runs:
--status_report_file statusrep.txt \
--is_retry $IS_RETRY \
--is_last_retry $IS_LAST_RETRY \
--is_test_result_ignored $IS_TEST_RESULT_IGNORED \
--comment_color_file summary_color.txt \
--comment_text_file summary_text.txt \
"Tests" $CURRENT_PUBLIC_DIR/ya-test.html "$CURRENT_JUNIT_XML_PATH"
Expand Down Expand Up @@ -513,7 +520,7 @@ runs:
set -x
if [ true = ${{ inputs.run_tests }} ]; then
teststatus=$(cat statusrep.txt)
if [[ $teststatus == "success" ]];then
if [[ $teststatus == "success" ]]; then
testmessage="The check has been completed successfully"
else
testmessage="The check has been failed"
Expand All @@ -522,7 +529,7 @@ runs:
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
-d '{"state":"'$teststatus'","description":"'"$testmessage"'","context":"test_${{inputs.build_preset}}"}'

if [[ $teststatus != "success" ]];then
if [[ $teststatus != "success" ]]; then
echo "status=failed" >> $GITHUB_OUTPUT
fi
fi
Expand All @@ -531,7 +538,9 @@ runs:
if: inputs.run_tests
shell: bash
run: |
.github/scripts/tests/fail-checker.py "$LAST_JUNIT_REPORT_XML"
if [ $IS_TEST_RESULT_IGNORED == 0 ]; then
.github/scripts/tests/fail-checker.py "$LAST_JUNIT_REPORT_XML"
fi

- name: sync results to s3 and publish links
if: always()
Expand Down Expand Up @@ -585,7 +594,7 @@ runs:
read -ra comment_arr <<< "$comment_raw"

printf "$comment"
if [[ ${comment_raw} != "Error"* ]];then
if [[ ${comment_raw} != "Error"* ]]; then
color=${comment_arr[0]}
replace=$color";;;"
comment=${comment_raw/$replace/""}
Expand Down
15 changes: 10 additions & 5 deletions .github/scripts/tests/generate-summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,15 @@ def gen_summary(public_dir, public_dir_url, paths, is_retry: bool, build_preset)
return summary


def get_comment_text(summary: TestSummary, summary_links: str, is_last_retry: bool)->tuple[str, list[str]]:
def get_comment_text(summary: TestSummary, summary_links: str, is_last_retry: bool, is_test_result_ignored: bool)->tuple[str, list[str]]:
color = "red"
if summary.is_failed:
color = "red" if is_last_retry else "yellow"
result = f"Some tests failed, follow the links below."
if is_test_result_ignored:
color = "yellow"
result = f"Some tests failed, follow the links below. This fail is not in blocking policy yet"
else:
color = "red" if is_last_retry else "yellow"
result = f"Some tests failed, follow the links below."
if not is_last_retry:
result += " Going to retry failed tests..."
else:
Expand Down Expand Up @@ -397,6 +401,7 @@ def main():
parser.add_argument('--status_report_file', required=False)
parser.add_argument('--is_retry', required=True, type=int)
parser.add_argument('--is_last_retry', required=True, type=int)
parser.add_argument('--is_test_result_ignored', required=True, type=int)
parser.add_argument('--comment_color_file', required=True)
parser.add_argument('--comment_text_file', required=True)
parser.add_argument("args", nargs="+", metavar="TITLE html_out path")
Expand All @@ -412,12 +417,12 @@ def main():
summary = gen_summary(args.public_dir, args.public_dir_url, title_path, is_retry=bool(args.is_retry),build_preset=args.build_preset)
write_summary(summary)

if summary.is_failed:
if summary.is_failed and not args.is_test_result_ignored:
overall_status = "failure"
else:
overall_status = "success"

color, text = get_comment_text(summary, args.summary_links, is_last_retry=bool(args.is_last_retry))
color, text = get_comment_text(summary, args.summary_links, is_last_retry=bool(args.is_last_retry), is_test_result_ignored=args.is_test_result_ignored)

with open(args.comment_color_file, "w") as f:
f.write(color)
Expand Down
Loading