86
86
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
87
87
-d '{"state":"pending","description":"The check has been started","context":"build_${{inputs.build_preset}}"}'
88
88
89
- if [[ "${{inputs.run_tests}}" == "true" ]];then
89
+ if [[ "${{inputs.run_tests}}" == "true" ]]; then
90
90
curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \
91
91
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
92
92
-d '{"state":"pending","description":"The check has been started","context":"test_${{inputs.build_preset}}"}'
@@ -143,11 +143,18 @@ runs:
143
143
echo "NODE_TLS_REJECT_UNAUTHORIZED=0" >> $GITHUB_ENV
144
144
fi
145
145
146
+ - name : Setup cache
147
+ shell : bash
148
+ run : |
149
+ export BAZEL_REMOTE_PASSWORD_FILE=$(mktemp)
150
+ echo "${{ inputs.bazel_remote_password }}" > $BAZEL_REMOTE_PASSWORD_FILE
151
+ echo "BAZEL_REMOTE_PASSWORD_FILE=$BAZEL_REMOTE_PASSWORD_FILE" >> $GITHUB_ENV
152
+
146
153
- name : ya build and test
147
154
id : build
148
155
shell : bash
149
156
run : |
150
- set -x
157
+ set -ex
151
158
echo "Artifacts will be uploaded [here](${PUBLIC_DIR_URL}/index.html)" | GITHUB_TOKEN="${{ github.token }}" .github/scripts/tests/comment-pr.py
152
159
153
160
ORIGINAL_HEAD=$(git rev-parse HEAD)
@@ -187,6 +194,7 @@ runs:
187
194
)
188
195
189
196
TEST_RETRY_COUNT=${{ inputs.test_retry_count }}
197
+ IS_TEST_RESULT_IGNORED=0
190
198
191
199
case "$BUILD_PRESET" in
192
200
debug)
@@ -212,6 +220,7 @@ runs:
212
220
if [ $TEST_RETRY_COUNT -z ]; then
213
221
TEST_RETRY_COUNT=1
214
222
fi
223
+ IS_TEST_RESULT_IGNORED=1
215
224
;;
216
225
release-tsan)
217
226
params+=(
@@ -221,6 +230,7 @@ runs:
221
230
if [ $TEST_RETRY_COUNT -z ]; then
222
231
TEST_RETRY_COUNT=1
223
232
fi
233
+ IS_TEST_RESULT_IGNORED=1
224
234
;;
225
235
release-msan)
226
236
params+=(
@@ -230,12 +240,15 @@ runs:
230
240
if [ $TEST_RETRY_COUNT -z ]; then
231
241
TEST_RETRY_COUNT=1
232
242
fi
243
+ IS_TEST_RESULT_IGNORED=1
233
244
;;
234
245
*)
235
246
echo "Invalid preset: $BUILD_PRESET"
236
247
exit 1
237
248
;;
238
249
esac
250
+
251
+ echo "IS_TEST_RESULT_IGNORED=$IS_TEST_RESULT_IGNORED" >> $GITHUB_ENV
239
252
240
253
if [ $TEST_RETRY_COUNT -z ]; then
241
254
# default is 3 for ordinary build and 1 for sanitizer builds
@@ -253,7 +266,7 @@ runs:
253
266
254
267
if [ "${{ inputs.put_build_results_to_cache }}" = "true" ]; then
255
268
params+=(--bazel-remote-username "${{ inputs.bazel_remote_username }}")
256
- params+=(--bazel-remote-password "${{ inputs.bazel_remote_password }} ")
269
+ params+=(--bazel-remote-password-file "$BAZEL_REMOTE_PASSWORD_FILE ")
257
270
params+=(--bazel-remote-put --dist-cache-max-file-size=209715200)
258
271
fi
259
272
@@ -371,12 +384,12 @@ runs:
371
384
372
385
CURRENT_JUNIT_XML_PATH=$CURRENT_PUBLIC_DIR/junit.xml
373
386
CURRENT_REPORT=$CURRENT_PUBLIC_DIR/report.json
374
- set +ex
387
+ set +e
375
388
(./ya make $YA_MAKE_TARGET "${params[@]}" \
376
389
$RERUN_FAILED_OPT --log-file "$PUBLIC_DIR/ya_log.log" \
377
390
--evlog-file "$CURRENT_PUBLIC_DIR/ya_evlog.jsonl" \
378
391
--junit "$CURRENT_JUNIT_XML_PATH" --build-results-report "$CURRENT_REPORT" --output "$YA_MAKE_OUT_DIR"; echo $? > exit_code) |& cat >> $YA_MAKE_OUTPUT
379
- set -ex
392
+ set -e
380
393
RC=`cat exit_code`
381
394
382
395
.github/scripts/tests/report_analyzer.py --report_file "$CURRENT_REPORT" --summary_file $CURRENT_PUBLIC_DIR/summary_report.txt || true
@@ -399,7 +412,7 @@ runs:
399
412
gzip -c $CURRENT_JUNIT_XML_PATH > $CURRENT_PUBLIC_DIR/orig_junit.xml.gz
400
413
401
414
# postprocess junit report
402
- .github/scripts/tests/transform-ya-junit .py -i \
415
+ .github/scripts/tests/transform_ya_junit .py -i \
403
416
-m .github/config/muted_ya.txt \
404
417
--ya_out "$YA_MAKE_OUT_DIR" \
405
418
--public_dir "$PUBLIC_DIR" \
@@ -434,6 +447,7 @@ runs:
434
447
--status_report_file statusrep.txt \
435
448
--is_retry $IS_RETRY \
436
449
--is_last_retry $IS_LAST_RETRY \
450
+ --is_test_result_ignored $IS_TEST_RESULT_IGNORED \
437
451
--comment_color_file summary_color.txt \
438
452
--comment_text_file summary_text.txt \
439
453
" Tests" $CURRENT_PUBLIC_DIR/ya-test.html "$CURRENT_JUNIT_XML_PATH"
@@ -513,7 +527,7 @@ runs:
513
527
set -x
514
528
if [ true = ${{ inputs.run_tests }} ]; then
515
529
teststatus=$(cat statusrep.txt)
516
- if [[ $teststatus == "success" ]];then
530
+ if [[ $teststatus == "success" ]]; then
517
531
testmessage="The check has been completed successfully"
518
532
else
519
533
testmessage="The check has been failed"
@@ -522,7 +536,7 @@ runs:
522
536
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
523
537
-d '{"state":"'$teststatus'","description":"'"$testmessage"'","context":"test_${{inputs.build_preset}}"}'
524
538
525
- if [[ $teststatus != "success" ]];then
539
+ if [[ $teststatus != "success" ]]; then
526
540
echo "status=failed" >> $GITHUB_OUTPUT
527
541
fi
528
542
fi
@@ -531,8 +545,48 @@ runs:
531
545
if : inputs.run_tests
532
546
shell : bash
533
547
run : |
534
- .github/scripts/tests/fail-checker.py "$LAST_JUNIT_REPORT_XML"
548
+ if [ $IS_TEST_RESULT_IGNORED == 0 ]; then
549
+ .github/scripts/tests/fail-checker.py "$LAST_JUNIT_REPORT_XML"
550
+ fi
535
551
552
+ - name : show diff mute_ya.txt
553
+ if : inputs.build_preset == 'relwithdebinfo' && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target')
554
+ shell : bash
555
+ continue-on-error : true
556
+ env :
557
+ GITHUB_TOKEN : ${{ github.token }}
558
+ run : |
559
+ ORIGINAL_HEAD=$(git rev-parse HEAD)
560
+ get_file_diff_script=.github/scripts/tests/get_diff_lines_of_file.py
561
+ file_to_check=.github/config/muted_ya.txt
562
+ check_result=`$get_file_diff_script --base_sha $ORIGINAL_HEAD~1 --head_sha $ORIGINAL_HEAD --file_path $file_to_check`
563
+ if [[ ${check_result} == *"not changed" ]];then
564
+ echo file ${file_to_check} NOT changed
565
+ else
566
+ echo file ${file_to_check} changed
567
+ .github/scripts/tests/get_muted_tests.py --output_folder "$PUBLIC_DIR/mute_info/" get_mute_diff --base_sha $ORIGINAL_HEAD~1 --head_sha $ORIGINAL_HEAD --job-id "${{ github.run_id }}" --branch "${GITHUB_REF_NAME}"
568
+ FILE_PATH=$PUBLIC_DIR/mute_info/2_new_muted_tests.txt
569
+ SEPARATOR=""
570
+ if [ -f "$FILE_PATH" ]; then
571
+ LINE_COUNT=$(wc -l < "$FILE_PATH")
572
+ if [ "$LINE_COUNT" -gt 0 ]; then
573
+ SEPARATOR=', '
574
+ MESSAGE="Muted new $LINE_COUNT [tests](${PUBLIC_DIR_URL}/mute_info/2_new_muted_tests.txt)"
575
+ fi
576
+ fi
577
+ FILE_PATH=$PUBLIC_DIR/mute_info/3_unmuted_tests.txt
578
+ if [ -f "$FILE_PATH" ]; then
579
+ LINE_COUNT_unmute=$(wc -l < "$FILE_PATH")
580
+ if [ "$LINE_COUNT_unmute" -gt 0 ]; then
581
+ MESSAGE="${MESSAGE}${SEPARATOR}Unmuted $LINE_COUNT_unmute [tests](${PUBLIC_DIR_URL}/mute_info/3_unmuted_tests.txt)"
582
+ fi
583
+ fi
584
+ if [ -n "$MESSAGE" ]; then
585
+ printf "$MESSAGE" | .github/scripts/tests/comment-pr.py --color orange
586
+ fi
587
+ fi
588
+
589
+
536
590
- name : sync results to s3 and publish links
537
591
if : always()
538
592
shell : bash
@@ -585,7 +639,7 @@ runs:
585
639
read -ra comment_arr <<< "$comment_raw"
586
640
587
641
printf "$comment"
588
- if [[ ${comment_raw} != "Error"* ]];then
642
+ if [[ ${comment_raw} != "Error"* ]]; then
589
643
color=${comment_arr[0]}
590
644
replace=$color";;;"
591
645
comment=${comment_raw/$replace/""}
@@ -602,4 +656,4 @@ runs:
602
656
env :
603
657
BUILD_PRESET : ${{ inputs.build_preset }}
604
658
GITHUB_TOKEN : ${{ github.token }}
605
- run : echo "Check cancelled" | .github/scripts/tests/comment-pr.py --color black
659
+ run : echo "Check cancelled" | .github/scripts/tests/comment-pr.py --color black
0 commit comments