Skip to content

Commit a21caa5

Browse files
authored
Move some into test_ya action (#8937)
1 parent d7a78d0 commit a21caa5

File tree

2 files changed

+82
-82
lines changed

2 files changed

+82
-82
lines changed

.github/actions/build_and_test_ya/action.yml

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -57,34 +57,6 @@ defaults:
5757
runs:
5858
using: "composite"
5959
steps:
60-
- name: comment-build-start
61-
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
62-
shell: bash
63-
env:
64-
BUILD_PRESET: ${{ inputs.build_preset }}
65-
GITHUB_TOKEN: ${{ github.token }}
66-
run: |
67-
jobs_url="https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs"
68-
# tricky: we are searching job with name that contains build_preset
69-
check_url=$(curl -s $jobs_url | jq --arg n "$BUILD_PRESET" -r '.jobs[] | select(.name | contains($n)) | .html_url')
70-
71-
platform_name="$(echo "$(uname -s)-$(uname -p)" | tr '[:upper:]' '[:lower:]')-$BUILD_PRESET"
72-
echo "Pre-commit [check]($check_url) **$platform_name** for $(git rev-parse HEAD) has started." | .github/scripts/tests/comment-pr.py --rewrite
73-
74-
curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \
75-
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
76-
-d '{"state":"pending","description":"The check has been started","context":"build_${{inputs.build_preset}}"}'
77-
78-
if [[ "${{inputs.run_tests}}" == "true" ]];then
79-
curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \
80-
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
81-
-d '{"state":"pending","description":"The check has been started","context":"test_${{inputs.build_preset}}"}'
82-
fi
83-
84-
- name: Clean ya cache
85-
shell: bash
86-
run: rm -rf ~/.ya
87-
8860
- name: Prepare s3cmd
8961
uses: ./.github/actions/s3cmd
9062
with:
@@ -116,57 +88,3 @@ runs:
11688
bazel_remote_password: ${{ fromJSON( inputs.secs ).REMOTE_CACHE_PASSWORD || '' }}
11789
put_build_results_to_cache: ${{ inputs.put_build_results_to_cache }}
11890
test_retry_count: ${{ inputs.test_retry_count }}
119-
120-
- name: build_stats
121-
shell: bash
122-
continue-on-error: true
123-
if: always()
124-
run: |
125-
set -x
126-
export build_preset="${{ inputs.build_preset }}"
127-
export commit_git_sha="$(git rev-parse HEAD)"
128-
129-
python3 -m pip install ydb ydb[yc]
130-
python3 .github/scripts/send_build_stats.py
131-
132-
- name: show_build_size_diff
133-
shell: bash
134-
continue-on-error: true
135-
if: always()
136-
env:
137-
GITHUB_TOKEN: ${{ github.token }}
138-
run: |
139-
set -x
140-
export build_preset="${{ inputs.build_preset }}"
141-
export branch_to_compare="$GITHUB_REF_NAME"
142-
export yellow_treshold=102400
143-
export red_treshold=2097152
144-
export commit_git_sha="$(git rev-parse HEAD)"
145-
146-
python3 -m pip install ydb ydb[yc] humanize
147-
148-
get_sizes_comment_script=.github/scripts/get_build_diff.py
149-
comment_raw=`$get_sizes_comment_script`
150-
151-
IFS=';;;'
152-
read -ra comment_arr <<< "$comment_raw"
153-
154-
printf "$comment"
155-
if [[ ${comment_raw} != "Error"* ]];then
156-
color=${comment_arr[0]}
157-
replace=$color";;;"
158-
comment=${comment_raw/$replace/""}
159-
160-
printf "$comment" | .github/scripts/tests/comment-pr.py --color $color
161-
162-
else
163-
echo "Skipped build size difference, comment_raw = ${comment_raw}"
164-
fi
165-
166-
- name: comment-if-cancel
167-
shell: bash
168-
if: cancelled() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target')
169-
env:
170-
BUILD_PRESET: ${{ inputs.build_preset }}
171-
GITHUB_TOKEN: ${{ github.token }}
172-
run: echo "Check cancelled" | .github/scripts/tests/comment-pr.py --color black

.github/actions/test_ya/action.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,34 @@ outputs:
6868
runs:
6969
using: "composite"
7070
steps:
71+
- name: comment-build-start
72+
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
73+
shell: bash
74+
env:
75+
BUILD_PRESET: ${{ inputs.build_preset }}
76+
GITHUB_TOKEN: ${{ github.token }}
77+
run: |
78+
jobs_url="https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs"
79+
# tricky: we are searching job with name that contains build_preset
80+
check_url=$(curl -s $jobs_url | jq --arg n "$BUILD_PRESET" -r '.jobs[] | select(.name | contains($n)) | .html_url')
81+
82+
platform_name="$(echo "$(uname -s)-$(uname -p)" | tr '[:upper:]' '[:lower:]')-$BUILD_PRESET"
83+
echo "Pre-commit [check]($check_url) **$platform_name** for $(git rev-parse HEAD) has started." | .github/scripts/tests/comment-pr.py --rewrite
84+
85+
curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{github.token}}" -H "X-GitHub-Api-Version: 2022-11-28" \
86+
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
87+
-d '{"state":"pending","description":"The check has been started","context":"build_${{inputs.build_preset}}"}'
88+
89+
if [[ "${{inputs.run_tests}}" == "true" ]];then
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+
https://api.github.com/repos/${{github.repository}}/statuses/${{github.event.pull_request.head.sha}} \
92+
-d '{"state":"pending","description":"The check has been started","context":"test_${{inputs.build_preset}}"}'
93+
fi
94+
95+
- name: Clean ya cache
96+
shell: bash
97+
run: rm -rf ~/.ya
98+
7199
- name: Init
72100
id: init
73101
shell: bash
@@ -519,3 +547,57 @@ runs:
519547
if: always()
520548
shell: bash
521549
run: df -h
550+
551+
- name: build_stats
552+
shell: bash
553+
continue-on-error: true
554+
if: always()
555+
run: |
556+
set -x
557+
export build_preset="${{ inputs.build_preset }}"
558+
export commit_git_sha="$(git rev-parse HEAD)"
559+
560+
python3 -m pip install ydb ydb[yc]
561+
python3 .github/scripts/send_build_stats.py
562+
563+
- name: show_build_size_diff
564+
shell: bash
565+
continue-on-error: true
566+
if: always()
567+
env:
568+
GITHUB_TOKEN: ${{ github.token }}
569+
run: |
570+
set -x
571+
export build_preset="${{ inputs.build_preset }}"
572+
export branch_to_compare="$GITHUB_REF_NAME"
573+
export yellow_treshold=102400
574+
export red_treshold=2097152
575+
export commit_git_sha="$(git rev-parse HEAD)"
576+
577+
python3 -m pip install ydb ydb[yc] humanize
578+
579+
get_sizes_comment_script=.github/scripts/get_build_diff.py
580+
comment_raw=`$get_sizes_comment_script`
581+
582+
IFS=';;;'
583+
read -ra comment_arr <<< "$comment_raw"
584+
585+
printf "$comment"
586+
if [[ ${comment_raw} != "Error"* ]];then
587+
color=${comment_arr[0]}
588+
replace=$color";;;"
589+
comment=${comment_raw/$replace/""}
590+
591+
printf "$comment" | .github/scripts/tests/comment-pr.py --color $color
592+
593+
else
594+
echo "Skipped build size difference, comment_raw = ${comment_raw}"
595+
fi
596+
597+
- name: comment-if-cancel
598+
shell: bash
599+
if: cancelled() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target')
600+
env:
601+
BUILD_PRESET: ${{ inputs.build_preset }}
602+
GITHUB_TOKEN: ${{ github.token }}
603+
run: echo "Check cancelled" | .github/scripts/tests/comment-pr.py --color black

0 commit comments

Comments
 (0)