From b9e2d798fe213840f7ac9c769c70991b3e7c12b9 Mon Sep 17 00:00:00 2001 From: AlexSm Date: Tue, 21 May 2024 17:11:39 +0200 Subject: [PATCH 01/21] Report statuses --- .github/actions/build_ya/action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/build_ya/action.yml b/.github/actions/build_ya/action.yml index 2869db1eb766..bf55c0124cc6 100644 --- a/.github/actions/build_ya/action.yml +++ b/.github/actions/build_ya/action.yml @@ -140,8 +140,12 @@ runs: run: | set -x if [ "${{ steps.build.outputs.status }}" == "failed" ]; 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.head_sha}} -d '{"state":"failure","description":"Build failed","context":"${{input.build_preset}}"}' echo "Build failed. see the [build logs]($LOG_URL)." | .github/scripts/tests/comment-pr.py --fail else + 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.head_sha}} -d '{"state":"success","description":"Build successful","context":"${{input.build_preset}}"}' echo "Build successful." | .github/scripts/tests/comment-pr.py --ok fi From 807da8e5d1a20e3c34dbe0d2d87919d5ed855f45 Mon Sep 17 00:00:00 2001 From: AlexSm Date: Tue, 21 May 2024 17:25:40 +0200 Subject: [PATCH 02/21] Update action.yml --- .github/actions/build_ya/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/build_ya/action.yml b/.github/actions/build_ya/action.yml index bf55c0124cc6..33c46abba2df 100644 --- a/.github/actions/build_ya/action.yml +++ b/.github/actions/build_ya/action.yml @@ -141,11 +141,11 @@ runs: set -x if [ "${{ steps.build.outputs.status }}" == "failed" ]; 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.head_sha}} -d '{"state":"failure","description":"Build failed","context":"${{input.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.head_sha}} -d '{"state":"failure","description":"Build failed","context":"${{inputs.build_preset}}"}' echo "Build failed. see the [build logs]($LOG_URL)." | .github/scripts/tests/comment-pr.py --fail else 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.head_sha}} -d '{"state":"success","description":"Build successful","context":"${{input.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.head_sha}} -d '{"state":"success","description":"Build successful","context":"${{inputs.build_preset}}"}' echo "Build successful." | .github/scripts/tests/comment-pr.py --ok fi From e91f8075a690c4ac4cf77a2291fe9164f1f58872 Mon Sep 17 00:00:00 2001 From: AlexSm Date: Tue, 21 May 2024 17:37:29 +0200 Subject: [PATCH 03/21] Update action.yml --- .github/actions/build_ya/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/build_ya/action.yml b/.github/actions/build_ya/action.yml index 33c46abba2df..55e60dc5af15 100644 --- a/.github/actions/build_ya/action.yml +++ b/.github/actions/build_ya/action.yml @@ -141,11 +141,11 @@ runs: set -x if [ "${{ steps.build.outputs.status }}" == "failed" ]; 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.head_sha}} -d '{"state":"failure","description":"Build failed","context":"${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.head_ref}} -d '{"state":"failure","description":"Build failed","context":"${{inputs.build_preset}}"}' echo "Build failed. see the [build logs]($LOG_URL)." | .github/scripts/tests/comment-pr.py --fail else 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.head_sha}} -d '{"state":"success","description":"Build successful","context":"${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.head_ref}} -d '{"state":"success","description":"Build successful","context":"${{inputs.build_preset}}"}' echo "Build successful." | .github/scripts/tests/comment-pr.py --ok fi From 89e4811b2c1424b53f7286b42504be1399d20a93 Mon Sep 17 00:00:00 2001 From: AlexSm Date: Tue, 21 May 2024 17:43:07 +0200 Subject: [PATCH 04/21] Update action.yml --- .github/actions/build_ya/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/build_ya/action.yml b/.github/actions/build_ya/action.yml index 55e60dc5af15..08502bb90f65 100644 --- a/.github/actions/build_ya/action.yml +++ b/.github/actions/build_ya/action.yml @@ -141,11 +141,11 @@ runs: set -x if [ "${{ steps.build.outputs.status }}" == "failed" ]; 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.head_ref}} -d '{"state":"failure","description":"Build failed","context":"${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.sha}} -d '{"state":"failure","description":"Build failed","context":"${{inputs.build_preset}}"}' echo "Build failed. see the [build logs]($LOG_URL)." | .github/scripts/tests/comment-pr.py --fail else 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.head_ref}} -d '{"state":"success","description":"Build successful","context":"${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.sha}} -d '{"state":"success","description":"Build successful","context":"${{inputs.build_preset}}"}' echo "Build successful." | .github/scripts/tests/comment-pr.py --ok fi From 07559c2784a5af19f021a3e306de6bd5ef438493 Mon Sep 17 00:00:00 2001 From: AlexSm Date: Tue, 21 May 2024 18:19:24 +0200 Subject: [PATCH 05/21] Update action.yml --- .github/actions/build_ya/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/build_ya/action.yml b/.github/actions/build_ya/action.yml index 08502bb90f65..83977e1bd05d 100644 --- a/.github/actions/build_ya/action.yml +++ b/.github/actions/build_ya/action.yml @@ -141,11 +141,11 @@ runs: set -x if [ "${{ steps.build.outputs.status }}" == "failed" ]; 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.sha}} -d '{"state":"failure","description":"Build failed","context":"${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} -d '{"state":"failure","description":"Build failed","context":"${{inputs.build_preset}}"}' echo "Build failed. see the [build logs]($LOG_URL)." | .github/scripts/tests/comment-pr.py --fail else 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.sha}} -d '{"state":"success","description":"Build successful","context":"${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} -d '{"state":"success","description":"Build successful","context":"${{inputs.build_preset}}"}' echo "Build successful." | .github/scripts/tests/comment-pr.py --ok fi From 8945ce6167a66aaeb5e14ab0ecab4acd1f628a48 Mon Sep 17 00:00:00 2001 From: AlexSm Date: Tue, 21 May 2024 18:23:12 +0200 Subject: [PATCH 06/21] Update action.yml --- .github/actions/build_ya/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/build_ya/action.yml b/.github/actions/build_ya/action.yml index 83977e1bd05d..8a9d2c866186 100644 --- a/.github/actions/build_ya/action.yml +++ b/.github/actions/build_ya/action.yml @@ -141,11 +141,11 @@ runs: set -x if [ "${{ steps.build.outputs.status }}" == "failed" ]; 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":"failure","description":"Build failed","context":"${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} -d '{"state":"failure","description":"Build failed","context":"build_${{inputs.build_preset}}"}' echo "Build failed. see the [build logs]($LOG_URL)." | .github/scripts/tests/comment-pr.py --fail else 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":"success","description":"Build successful","context":"${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} -d '{"state":"success","description":"Build successful","context":"build_${{inputs.build_preset}}"}' echo "Build successful." | .github/scripts/tests/comment-pr.py --ok fi From a77712e1094235d3eec7fd0d8fdfa22d65d8a4fe Mon Sep 17 00:00:00 2001 From: AlexSm Date: Tue, 21 May 2024 20:10:12 +0200 Subject: [PATCH 07/21] Update generate-summary.py --- .github/scripts/tests/generate-summary.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/scripts/tests/generate-summary.py b/.github/scripts/tests/generate-summary.py index 68700b2623dd..256e14bf44d3 100755 --- a/.github/scripts/tests/generate-summary.py +++ b/.github/scripts/tests/generate-summary.py @@ -349,13 +349,16 @@ def main(): if summary.is_empty | summary.is_failed: color = 'red' + result_code = 1 else: color = 'green' + result_code = 0 run_number = int(os.environ.get("GITHUB_RUN_NUMBER")) update_pr_comment_text(pr, args.build_preset, run_number, color, text='\n'.join(text), rewrite=False) + return result_code if __name__ == "__main__": - main() + return main() From 1fbad644a9c440e1e44bc42146ce271e40766e7d Mon Sep 17 00:00:00 2001 From: AlexSm Date: Tue, 21 May 2024 20:14:56 +0200 Subject: [PATCH 08/21] Update action.yml --- .github/actions/test_ya/action.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/actions/test_ya/action.yml b/.github/actions/test_ya/action.yml index 7f48dd4b467c..732c3386ee2a 100644 --- a/.github/actions/test_ya/action.yml +++ b/.github/actions/test_ya/action.yml @@ -279,13 +279,21 @@ runs: mkdir $ARTIFACTS_DIR/summary/ cat $SUMMARY_LINKS | python3 -c 'import sys; print(" | ".join([v for _, v in sorted([l.strip().split(" ", 1) for l in sys.stdin], key=lambda a: (int(a[0]), a))]))' >> $GITHUB_STEP_SUMMARY - + + teststatus="success" .github/scripts/tests/generate-summary.py \ --summary-out-path $ARTIFACTS_DIR/summary/ \ --summary-url-prefix $S3_URL_PREFIX/summary/ \ --test-history-url $TEST_HISTORY_URL \ --build-preset "$BUILD_PRESET" \ - "Tests" ya-test.html "$JUNIT_REPORT_XML" + "Tests" ya-test.html "$JUNIT_REPORT_XML" || ( + RC=$? + teststatus="failure" + echo "::debug::testresult RC=$RC" + ) + + 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":"'$teststatus'","description":"Tests '$teststatus'","context":"test_${{inputs.build_preset}}"}' - name: sync test results to s3 if: always() From 9c3a645666fbdfb65f521573b1a532e5b5c7130c Mon Sep 17 00:00:00 2001 From: AlexSm Date: Tue, 21 May 2024 20:26:09 +0200 Subject: [PATCH 09/21] Update action.yml --- .github/actions/test_ya/action.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/actions/test_ya/action.yml b/.github/actions/test_ya/action.yml index 732c3386ee2a..e9114963d4a6 100644 --- a/.github/actions/test_ya/action.yml +++ b/.github/actions/test_ya/action.yml @@ -280,19 +280,14 @@ runs: cat $SUMMARY_LINKS | python3 -c 'import sys; print(" | ".join([v for _, v in sorted([l.strip().split(" ", 1) for l in sys.stdin], key=lambda a: (int(a[0]), a))]))' >> $GITHUB_STEP_SUMMARY - teststatus="success" - .github/scripts/tests/generate-summary.py \ + teststatus=$(.github/scripts/tests/generate-summary.py \ --summary-out-path $ARTIFACTS_DIR/summary/ \ --summary-url-prefix $S3_URL_PREFIX/summary/ \ --test-history-url $TEST_HISTORY_URL \ --build-preset "$BUILD_PRESET" \ - "Tests" ya-test.html "$JUNIT_REPORT_XML" || ( - RC=$? - teststatus="failure" - echo "::debug::testresult RC=$RC" - ) + "Tests" ya-test.html "$JUNIT_REPORT_XML") - curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \ + 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":"'$teststatus'","description":"Tests '$teststatus'","context":"test_${{inputs.build_preset}}"}' - name: sync test results to s3 From 78a51dab8933c2a013f3bb3306866757d43b16b9 Mon Sep 17 00:00:00 2001 From: AlexSm Date: Tue, 21 May 2024 20:27:12 +0200 Subject: [PATCH 10/21] Update generate-summary.py --- .github/scripts/tests/generate-summary.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/scripts/tests/generate-summary.py b/.github/scripts/tests/generate-summary.py index 256e14bf44d3..dbcc81e04717 100755 --- a/.github/scripts/tests/generate-summary.py +++ b/.github/scripts/tests/generate-summary.py @@ -349,16 +349,14 @@ def main(): if summary.is_empty | summary.is_failed: color = 'red' - result_code = 1 + print("failure") else: color = 'green' - result_code = 0 + print("success") run_number = int(os.environ.get("GITHUB_RUN_NUMBER")) update_pr_comment_text(pr, args.build_preset, run_number, color, text='\n'.join(text), rewrite=False) - return result_code - if __name__ == "__main__": - return main() + main() From a0d5cbb83ba20028c2a8e994a2ff032c5e30222f Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Tue, 21 May 2024 21:02:59 +0200 Subject: [PATCH 11/21] status rep file --- .github/actions/test_ya/action.yml | 6 ++++-- .github/scripts/tests/generate-summary.py | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/actions/test_ya/action.yml b/.github/actions/test_ya/action.yml index e9114963d4a6..c85dece846a5 100644 --- a/.github/actions/test_ya/action.yml +++ b/.github/actions/test_ya/action.yml @@ -280,13 +280,15 @@ runs: cat $SUMMARY_LINKS | python3 -c 'import sys; print(" | ".join([v for _, v in sorted([l.strip().split(" ", 1) for l in sys.stdin], key=lambda a: (int(a[0]), a))]))' >> $GITHUB_STEP_SUMMARY - teststatus=$(.github/scripts/tests/generate-summary.py \ + .github/scripts/tests/generate-summary.py \ --summary-out-path $ARTIFACTS_DIR/summary/ \ --summary-url-prefix $S3_URL_PREFIX/summary/ \ --test-history-url $TEST_HISTORY_URL \ --build-preset "$BUILD_PRESET" \ - "Tests" ya-test.html "$JUNIT_REPORT_XML") + --status-report-file statusrep.txt + "Tests" ya-test.html "$JUNIT_REPORT_XML" + teststatus=$(cat statusrep.txt) 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":"'$teststatus'","description":"Tests '$teststatus'","context":"test_${{inputs.build_preset}}"}' diff --git a/.github/scripts/tests/generate-summary.py b/.github/scripts/tests/generate-summary.py index dbcc81e04717..5bd1db69610d 100755 --- a/.github/scripts/tests/generate-summary.py +++ b/.github/scripts/tests/generate-summary.py @@ -324,6 +324,7 @@ def main(): parser.add_argument("--summary-url-prefix", required=True) parser.add_argument('--test-history-url', required=False) parser.add_argument('--build-preset', default="default-linux-x86-64-relwithdebinfo", required=False) + parser.add_argument('--status-report-file', required=False) parser.add_argument("args", nargs="+", metavar="TITLE html_out path") args = parser.parse_args() @@ -349,14 +350,18 @@ def main(): if summary.is_empty | summary.is_failed: color = 'red' - print("failure") + overall_status="failure" else: color = 'green' - print("success") + overall_status="success" run_number = int(os.environ.get("GITHUB_RUN_NUMBER")) update_pr_comment_text(pr, args.build_preset, run_number, color, text='\n'.join(text), rewrite=False) + if args.status_report_file: + with open(args.status_report_file,'w') as fo: + print( overall_status, fo) + if __name__ == "__main__": main() From 9be496ecc1b9c7d3699652d410d240efa213c976 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Tue, 21 May 2024 21:08:47 +0200 Subject: [PATCH 12/21] fix --- .github/actions/test_ya/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test_ya/action.yml b/.github/actions/test_ya/action.yml index c85dece846a5..3785a178a3b7 100644 --- a/.github/actions/test_ya/action.yml +++ b/.github/actions/test_ya/action.yml @@ -285,7 +285,7 @@ runs: --summary-url-prefix $S3_URL_PREFIX/summary/ \ --test-history-url $TEST_HISTORY_URL \ --build-preset "$BUILD_PRESET" \ - --status-report-file statusrep.txt + --status-report-file statusrep.txt \ "Tests" ya-test.html "$JUNIT_REPORT_XML" teststatus=$(cat statusrep.txt) From f9b875b8015d9df1cee11a8afc5196183e1a3b26 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Tue, 21 May 2024 21:17:07 +0200 Subject: [PATCH 13/21] fix --- .github/scripts/tests/generate-summary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/tests/generate-summary.py b/.github/scripts/tests/generate-summary.py index 5bd1db69610d..f8b441744bcd 100755 --- a/.github/scripts/tests/generate-summary.py +++ b/.github/scripts/tests/generate-summary.py @@ -361,7 +361,7 @@ def main(): if args.status_report_file: with open(args.status_report_file,'w') as fo: - print( overall_status, fo) + fo.write( overall_status ) if __name__ == "__main__": main() From fef69bca344c9c54dc41f989b7f9da3c14968609 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Tue, 21 May 2024 21:23:55 +0200 Subject: [PATCH 14/21] pending --- .github/actions/build_and_test_ya/action.yml | 6 +++++- .github/actions/build_ya/action.yml | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/actions/build_and_test_ya/action.yml b/.github/actions/build_and_test_ya/action.yml index 26c46d2df812..87b2fbbb1eee 100644 --- a/.github/actions/build_and_test_ya/action.yml +++ b/.github/actions/build_and_test_ya/action.yml @@ -66,7 +66,11 @@ runs: check_url=$(curl -s $jobs_url | jq --arg n "$BUILD_PRESET" -r '.jobs[] | select(.name | contains($n)) | .html_url') echo "Pre-commit [check]($check_url) for $(git rev-parse HEAD) has started." | .github/scripts/tests/comment-pr.py --rewrite - + + 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":"Pending","context":"build_${{inputs.build_preset}}"}' + - name: Prepare s3cmd uses: ./.github/actions/s3cmd with: diff --git a/.github/actions/build_ya/action.yml b/.github/actions/build_ya/action.yml index 8a9d2c866186..98723e7c9ca4 100644 --- a/.github/actions/build_ya/action.yml +++ b/.github/actions/build_ya/action.yml @@ -141,11 +141,11 @@ runs: set -x if [ "${{ steps.build.outputs.status }}" == "failed" ]; 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":"failure","description":"Build failed","context":"build_${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} -d '{"state":"failure","description":"Failed","context":"build_${{inputs.build_preset}}"}' echo "Build failed. see the [build logs]($LOG_URL)." | .github/scripts/tests/comment-pr.py --fail else 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":"success","description":"Build successful","context":"build_${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} -d '{"state":"success","description":"Success","context":"build_${{inputs.build_preset}}"}' echo "Build successful." | .github/scripts/tests/comment-pr.py --ok fi From 5838bd2946fd2f8b953f10af6deeb59780af6e57 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 23 May 2024 17:12:18 +0200 Subject: [PATCH 15/21] integrated --- .github/workflows/pr_check.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml index 48633d40a1e3..d03198efa5ba 100644 --- a/.github/workflows/pr_check.yml +++ b/.github/workflows/pr_check.yml @@ -25,6 +25,12 @@ jobs: result: ${{ steps.check-ownership-membership.outputs.result == 'true' && steps.check-is-mergeable.outputs.result == 'true' }} commit_sha: ${{ steps.check-is-mergeable.outputs.commit_sha }} steps: + - name: Reset integrated status + run: | + 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":"Pending required checks to complete","context":"checks_integrated"}' + - name: Check if running tests is allowed id: check-ownership-membership uses: actions/github-script@v6 @@ -225,3 +231,26 @@ jobs: secrets.TESTMO_TOKEN, secrets.AWS_KEY_ID, secrets.AWS_KEY_VALUE, secrets.REMOTE_CACHE_USERNAME, secrets.REMOTE_CACHE_PASSWORD ) }} vars: ${{ format('{{"AWS_BUCKET":"{0}","AWS_ENDPOINT":"{1}","REMOTE_CACHE_URL":"{2}","TESTMO_URL":"{3}","TESTMO_PROJECT_ID":"{4}"}}', vars.AWS_BUCKET, vars.AWS_ENDPOINT, vars.REMOTE_CACHE_URL_YA, vars.TESTMO_URL, vars.TESTMO_PROJECT_ID ) }} + + update_integrated_status: + runs-on: ubuntu-latest + needs: build_and_test + steps: + - name: Gather required checks results + shell: bash + run: | + successbuilds=$(curl -L -X GET -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}}/commits/${{github.event.pull_request.head.sha}}/status' | \ + jq -cr '.statuses.[] | select(.state=="success") | select(.context | startswith("build_")) | .context' ) | \ + wc -l + if [[ $successbuilds == 3 ]];then + integrated_check = "success" + else + integrated_chech = "failure" + fi + 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":"'$integrated_status'","description":"All checks completed","context":"checks_integrated"}' + + + From 00ee1eb867af7f670f0b8004fbc8486757c6114d Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 23 May 2024 17:34:11 +0200 Subject: [PATCH 16/21] fix --- .github/actions/build_and_test_ya/action.yml | 2 +- .github/actions/build_ya/action.yml | 6 ++++-- .github/actions/test_ya/action.yml | 8 +++++++- .github/workflows/pr_check.yml | 8 ++++---- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/actions/build_and_test_ya/action.yml b/.github/actions/build_and_test_ya/action.yml index 87b2fbbb1eee..2eb3da118a4d 100644 --- a/.github/actions/build_and_test_ya/action.yml +++ b/.github/actions/build_and_test_ya/action.yml @@ -69,7 +69,7 @@ runs: 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":"Pending","context":"build_${{inputs.build_preset}}"}' + -d '{"state":"pending","description":"The check has been started","context":"build_${{inputs.build_preset}}"}' - name: Prepare s3cmd uses: ./.github/actions/s3cmd diff --git a/.github/actions/build_ya/action.yml b/.github/actions/build_ya/action.yml index 98723e7c9ca4..91ef4489ae15 100644 --- a/.github/actions/build_ya/action.yml +++ b/.github/actions/build_ya/action.yml @@ -141,11 +141,13 @@ runs: set -x if [ "${{ steps.build.outputs.status }}" == "failed" ]; 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":"failure","description":"Failed","context":"build_${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \ + -d '{"state":"failure","description":"The check has been failed","context":"build_${{inputs.build_preset}}"}' echo "Build failed. see the [build logs]($LOG_URL)." | .github/scripts/tests/comment-pr.py --fail else 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":"success","description":"Success","context":"build_${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \ + -d '{"state":"success","description":"The check has been completed successfully","context":"build_${{inputs.build_preset}}"}' echo "Build successful." | .github/scripts/tests/comment-pr.py --ok fi diff --git a/.github/actions/test_ya/action.yml b/.github/actions/test_ya/action.yml index 3785a178a3b7..40874142ceeb 100644 --- a/.github/actions/test_ya/action.yml +++ b/.github/actions/test_ya/action.yml @@ -289,8 +289,14 @@ runs: "Tests" ya-test.html "$JUNIT_REPORT_XML" teststatus=$(cat statusrep.txt) + if [[ $teststatus == "success" ]];then + testmessage="The check has been completed successfully" + else + testmessage="The check has been failed" + fi 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":"'$teststatus'","description":"Tests '$teststatus'","context":"test_${{inputs.build_preset}}"}' + https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \ + -d '{"state":"'$teststatus'","description":"'$testmessage'","context":"test_${{inputs.build_preset}}"}' - name: sync test results to s3 if: always() diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml index d03198efa5ba..20ac928d0f95 100644 --- a/.github/workflows/pr_check.yml +++ b/.github/workflows/pr_check.yml @@ -240,13 +240,13 @@ jobs: shell: bash run: | successbuilds=$(curl -L -X GET -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}}/commits/${{github.event.pull_request.head.sha}}/status' | \ + https://api.github.com/repos/${{github.repository}}/commits/${{github.event.pull_request.head.sha}}/status | \ jq -cr '.statuses.[] | select(.state=="success") | select(.context | startswith("build_")) | .context' ) | \ wc -l - if [[ $successbuilds == 3 ]];then - integrated_check = "success" + if [[ $successbuilds == "3" ]];then + integrated_status = "success" else - integrated_chech = "failure" + integrated_status = "failure" fi 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}} \ From 5b66cd87b34b8936dc313d1df8752af79d2fdad2 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 23 May 2024 17:44:19 +0200 Subject: [PATCH 17/21] always --- .github/workflows/docs_build.yaml | 12 ++++++++++++ .github/workflows/pr_check.yml | 1 + 2 files changed, 13 insertions(+) diff --git a/.github/workflows/docs_build.yaml b/.github/workflows/docs_build.yaml index 63f6a00e8c39..fe5800f281c0 100644 --- a/.github/workflows/docs_build.yaml +++ b/.github/workflows/docs_build.yaml @@ -12,6 +12,12 @@ jobs: cancel-in-progress: true runs-on: ubuntu-latest steps: + - name: Update integrated status + shell: bash + run: | + 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":"Pending required checks to complete","context":"checks_integrated"}' - name: Checkout uses: actions/checkout@v3 - name: Build @@ -19,3 +25,9 @@ jobs: with: revision: "pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}" src-root: "./ydb/docs" + - name: Update integrated status + shell: bash + run: | + 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":"success","description":"All checks completed","context":"checks_integrated"}' diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml index 20ac928d0f95..0dffe28f56f5 100644 --- a/.github/workflows/pr_check.yml +++ b/.github/workflows/pr_check.yml @@ -235,6 +235,7 @@ jobs: update_integrated_status: runs-on: ubuntu-latest needs: build_and_test + if: always() steps: - name: Gather required checks results shell: bash From ed12925396b37c68541587c761c09291e0ff295f Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 23 May 2024 17:53:31 +0200 Subject: [PATCH 18/21] fix --- .github/actions/build_and_test_ya/action.yml | 8 +++++++- .github/workflows/pr_check.yml | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/actions/build_and_test_ya/action.yml b/.github/actions/build_and_test_ya/action.yml index 2eb3da118a4d..aa17949c3cd6 100644 --- a/.github/actions/build_and_test_ya/action.yml +++ b/.github/actions/build_and_test_ya/action.yml @@ -68,8 +68,14 @@ runs: echo "Pre-commit [check]($check_url) for $(git rev-parse HEAD) has started." | .github/scripts/tests/comment-pr.py --rewrite 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":"build_${{inputs.build_preset}}"}' + + 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":"build_${{inputs.build_preset}}"}' + -d '{"state":"pending","description":"The check has been started","context":"test_${{inputs.build_preset}}"}' + fi - name: Prepare s3cmd uses: ./.github/actions/s3cmd diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml index 0dffe28f56f5..73058ead1d62 100644 --- a/.github/workflows/pr_check.yml +++ b/.github/workflows/pr_check.yml @@ -242,8 +242,8 @@ jobs: run: | successbuilds=$(curl -L -X GET -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}}/commits/${{github.event.pull_request.head.sha}}/status | \ - jq -cr '.statuses.[] | select(.state=="success") | select(.context | startswith("build_")) | .context' ) | \ - wc -l + jq -cr '.statuses.[] | select(.state=="success") | select(.context | startswith("build_")) | .context' | \ + wc -l ) if [[ $successbuilds == "3" ]];then integrated_status = "success" else From 7a4e45d6882a9dbd9bec4d3ffc147507e6bd124f Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 23 May 2024 18:16:06 +0200 Subject: [PATCH 19/21] fix --- .github/workflows/pr_check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml index 73058ead1d62..0bbba005033c 100644 --- a/.github/workflows/pr_check.yml +++ b/.github/workflows/pr_check.yml @@ -242,7 +242,7 @@ jobs: run: | successbuilds=$(curl -L -X GET -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}}/commits/${{github.event.pull_request.head.sha}}/status | \ - jq -cr '.statuses.[] | select(.state=="success") | select(.context | startswith("build_")) | .context' | \ + jq -cr '.statuses | .[] | select(.state=="success") | select(.context | startswith("build_")) | .context' | \ wc -l ) if [[ $successbuilds == "3" ]];then integrated_status = "success" From 0078f00c614630fb0858fd7646265c0dfdb3dcbd Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 23 May 2024 18:30:24 +0200 Subject: [PATCH 20/21] fix --- .github/actions/test_ya/action.yml | 2 +- .github/workflows/pr_check.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/test_ya/action.yml b/.github/actions/test_ya/action.yml index 40874142ceeb..87790e08a069 100644 --- a/.github/actions/test_ya/action.yml +++ b/.github/actions/test_ya/action.yml @@ -296,7 +296,7 @@ runs: fi 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":"'$teststatus'","description":"'$testmessage'","context":"test_${{inputs.build_preset}}"}' + -d '{"state":"'$teststatus'","description":"'"$testmessage"'","context":"test_${{inputs.build_preset}}"}' - name: sync test results to s3 if: always() diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml index 0bbba005033c..7fb62e3e1e27 100644 --- a/.github/workflows/pr_check.yml +++ b/.github/workflows/pr_check.yml @@ -245,9 +245,9 @@ jobs: jq -cr '.statuses | .[] | select(.state=="success") | select(.context | startswith("build_")) | .context' | \ wc -l ) if [[ $successbuilds == "3" ]];then - integrated_status = "success" + integrated_status="success" else - integrated_status = "failure" + integrated_status="failure" fi 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}} \ From 5ba3a59af651153bc45536a380d04f46d560eb41 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 23 May 2024 18:49:04 +0200 Subject: [PATCH 21/21] fix --- .github/workflows/docs_build.yaml | 2 +- .github/workflows/pr_check.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs_build.yaml b/.github/workflows/docs_build.yaml index fe5800f281c0..179d0668ee72 100644 --- a/.github/workflows/docs_build.yaml +++ b/.github/workflows/docs_build.yaml @@ -17,7 +17,7 @@ jobs: run: | 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":"Pending required checks to complete","context":"checks_integrated"}' + -d '{"state":"pending","description":"Waiting for relevant checks to complete","context":"checks_integrated"}' - name: Checkout uses: actions/checkout@v3 - name: Build diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml index 7fb62e3e1e27..84ed514f45c8 100644 --- a/.github/workflows/pr_check.yml +++ b/.github/workflows/pr_check.yml @@ -29,7 +29,7 @@ jobs: run: | 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":"Pending required checks to complete","context":"checks_integrated"}' + -d '{"state":"pending","description":"Waiting for relevant checks to complete","context":"checks_integrated"}' - name: Check if running tests is allowed id: check-ownership-membership