Skip to content

Commit 4eb3ce8

Browse files
authored
Regression runs: multi-branch run support + refactoring (#16735)
1 parent 773bb0c commit 4eb3ce8

File tree

8 files changed

+158
-34
lines changed

8 files changed

+158
-34
lines changed

.github/actions/build_and_test_ya/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ inputs:
5151
vars:
5252
type: string
5353
default: ""
54+
custom_branch_name:
55+
description: "Custom branch name required when workflow branch != checkout branch"
56+
type: string
57+
required: false
5458
defaults:
5559
run:
5660
shell: bash
@@ -88,3 +92,4 @@ runs:
8892
bazel_remote_password: ${{ fromJSON( inputs.secs ).REMOTE_CACHE_PASSWORD || '' }}
8993
put_build_results_to_cache: ${{ inputs.put_build_results_to_cache }}
9094
test_retry_count: ${{ inputs.test_retry_count }}
95+
custom_branch_name: ${{ inputs.custom_branch_name }}

.github/actions/test_ya/action.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ inputs:
6060
type: string
6161
default: ""
6262
description: "how many times to retry failed tests"
63+
custom_branch_name:
64+
description: "Custom branch name required when workflow branch != checkout branch"
65+
type: string
66+
required: false
67+
6368
outputs:
6469
success:
6570
value: ${{ steps.build.outputs.status }}
@@ -271,8 +276,18 @@ runs:
271276
--cache-size 2TB --force-build-depends
272277
)
273278
279+
echo "inputs.custom_branch_name = ${{ inputs.custom_branch_name }}"
280+
echo "GITHUB_REF_NAME = $GITHUB_REF_NAME"
281+
282+
if [ -z "${{ inputs.custom_branch_name }}" ]; then
283+
BRANCH_NAME="${GITHUB_REF_NAME}"
284+
else
285+
BRANCH_NAME="${{ inputs.custom_branch_name }}"
286+
fi
287+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
288+
echo "BRANCH_NAME is set to $BRANCH_NAME"
274289
275-
TESTMO_BRANCH_TAG="$GITHUB_REF_NAME"
290+
TESTMO_BRANCH_TAG="$BRANCH_NAME"
276291
TESTMO_ARCH="${{ runner.arch == 'X64' && 'x86-64' || runner.arch == 'ARM64' && 'arm64' || 'unknown' }}"
277292
TESTMO_PR_NUMBER=${{ github.event.number }}
278293
@@ -470,7 +485,7 @@ runs:
470485
471486
# upload tests results to YDB
472487
ydb_upload_run_name="${TESTMO_RUN_NAME// /"_"}"
473-
result=`.github/scripts/analytics/upload_tests_results.py --test-results-file ${CURRENT_JUNIT_XML_PATH} --run-timestamp $(date +%s) --commit $(git rev-parse HEAD) --build-type ${BUILD_PRESET} --pull $ydb_upload_run_name --job-name "${{ github.workflow }}" --job-id "${{ github.run_id }}" --branch ${GITHUB_REF_NAME}`
488+
result=`.github/scripts/analytics/upload_tests_results.py --test-results-file ${CURRENT_JUNIT_XML_PATH} --run-timestamp $(date +%s) --commit $(git rev-parse HEAD) --build-type ${BUILD_PRESET} --pull $ydb_upload_run_name --job-name "${{ github.workflow }}" --job-id "${{ github.run_id }}" --branch "${BRANCH_NAME}"`
474489
475490
if [ ${{ inputs.testman_token }} ]; then
476491
# finish testme session
@@ -573,7 +588,7 @@ runs:
573588
echo file ${file_to_check} NOT changed
574589
else
575590
echo file ${file_to_check} changed
576-
.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}"
591+
.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 "${BRANCH_NAME}"
577592
FILE_PATH=$PUBLIC_DIR/mute_info/2_new_muted_tests.txt
578593
SEPARATOR=""
579594
if [ -f "$FILE_PATH" ]; then
@@ -633,7 +648,7 @@ runs:
633648
run: |
634649
set -x
635650
export build_preset="${{ inputs.build_preset }}"
636-
export branch_to_compare="$GITHUB_REF_NAME"
651+
export branch_to_compare="$BRANCH_NAME"
637652
export yellow_treshold=102400
638653
export red_treshold=2097152
639654
export commit_git_sha="$(git rev-parse HEAD)"

.github/workflows/regression_run.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ name: Regression-run
22

33
on:
44
schedule:
5-
- cron: "0 23 * * *" # At 23:00 every day
5+
- cron: "55 23 * * *" # At 23:55 every day
66
workflow_dispatch:
7+
inputs:
8+
use_default_branches:
9+
description: 'If true, start main and all current stable branches. If false, start only the selected branch.'
10+
type: boolean
11+
required: false
12+
default: true
713

814
jobs:
915
main:
@@ -13,8 +19,8 @@ jobs:
1319
strategy:
1420
fail-fast: false
1521
matrix:
16-
build_preset: ["relwithdebinfo", "release-asan", "release-tsan", "release-msan"]
22+
build_preset: ["relwithdebinfo", "release-asan", "release-tsan", "release-msan"]
1723
with:
1824
test_targets: ydb/
19-
build_preset: ${{ matrix.build_preset }}
20-
25+
branches: ${{ inputs.use_default_branches == true && '["main", "stable-25-1", "stable-25-1-1", "stable-25-1-analytics"]' || github.ref_name }}
26+
build_preset: ${{ matrix.build_preset }}

.github/workflows/regression_run_compatibility.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
schedule:
55
- cron: "0 23 * * *" # At 23:00 every day
66
workflow_dispatch:
7+
inputs:
8+
use_default_branches:
9+
description: 'If true, start main and all current stable branches. If false, start only the selected branch.'
10+
type: boolean
11+
required: false
12+
default: true
713

814
jobs:
915
main:
@@ -13,8 +19,8 @@ jobs:
1319
strategy:
1420
fail-fast: false
1521
matrix:
16-
build_preset: ["relwithdebinfo", "release-asan", "release-tsan", "release-msan"]
22+
build_preset: ["relwithdebinfo", "release-asan", "release-tsan", "release-msan"]
1723
with:
1824
test_targets: ydb/tests/functional/compatibility/
19-
build_preset: ${{ matrix.build_preset }}
20-
25+
branches: ${{ inputs.use_default_branches == true && '["main", "stable-25-1", "stable-25-1-1"]' || github.ref_name }}
26+
build_preset: ${{ matrix.build_preset }}

.github/workflows/regression_run_large.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ name: Regression-run_Large
22

33
on:
44
schedule:
5-
- cron: "0 23 * * *" # At 23:00 every day
5+
- cron: "30 23 * * *" # At 23:30 every day
66
workflow_dispatch:
7+
inputs:
8+
use_default_branches:
9+
description: 'If true, start main and all current stable branches. If false, start only the selected branch.'
10+
type: boolean
11+
required: false
12+
default: true
713

814
jobs:
915
main:
@@ -13,9 +19,9 @@ jobs:
1319
strategy:
1420
fail-fast: false
1521
matrix:
16-
build_preset: ["relwithdebinfo", "release-asan", "release-tsan", "release-msan"]
22+
build_preset: ["relwithdebinfo", "release-asan", "release-tsan", "release-msan"]
1723
with:
1824
test_targets: ydb/
1925
test_size: large
26+
branches: ${{ inputs.use_default_branches == true && '["main", "stable-25-1", "stable-25-1-1"]' || github.ref_name }}
2027
build_preset: ${{ matrix.build_preset }}
21-

.github/workflows/regression_run_small_medium.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ name: Regression-run_Small_and_Medium
22

33
on:
44
schedule:
5-
- cron: "0 23 * * *" # At 23:00 every day
5+
- cron: "30 23 * * *" # At 23:30 every day
66
workflow_dispatch:
7+
inputs:
8+
use_default_branches:
9+
description: 'If true, start main and all current stable branches. If false, start only the selected branch.'
10+
type: boolean
11+
required: false
12+
default: true
713

814
jobs:
915
main:
@@ -13,9 +19,9 @@ jobs:
1319
strategy:
1420
fail-fast: false
1521
matrix:
16-
build_preset: ["relwithdebinfo", "release-asan", "release-tsan", "release-msan"]
22+
build_preset: ["relwithdebinfo", "release-asan", "release-tsan", "release-msan"]
1723
with:
1824
test_targets: ydb/
1925
test_size: small,medium
26+
branches: ${{ inputs.use_default_branches== true && '["main", "stable-25-1", "stable-25-1-1"]' || github.ref_name }}
2027
build_preset: ${{ matrix.build_preset }}
21-

.github/workflows/regression_whitelist_run.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
schedule:
55
- cron: "0 23 * * *" # At 23:00 every day
66
workflow_dispatch:
7+
inputs:
8+
use_default_branches:
9+
description: 'If true, start main and all current stable branches. If false, start only the selected branch.'
10+
type: boolean
11+
required: false
12+
default: true
713

814
jobs:
915
main:
@@ -12,9 +18,9 @@ jobs:
1218
secrets: inherit
1319
strategy:
1420
fail-fast: false
15-
matrix:
16-
build_preset: ["relwithdebinfo", "release-asan", "release-tsan", "release-msan"]
21+
matrix:
22+
build_preset: ["relwithdebinfo", "release-asan", "release-tsan", "release-msan"]
1723
with:
1824
test_targets: ydb/tests/sql/ ydb/tests/stress ydb/tests/functional/tpc ydb/tests/functional/benchmarks_init
19-
build_preset: ${{ matrix.build_preset }}
20-
25+
branches: ${{ inputs.use_default_branches == true && '["main", "stable-25-1", "stable-25-1-1", "stable-25-1-analytics"]' || github.ref_name }}
26+
build_preset: ${{ matrix.build_preset }}

.github/workflows/run_tests.yml

Lines changed: 87 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,108 @@ on:
99
type: string
1010
default: self-hosted
1111
test_targets:
12-
description: 'Пути запуска'
12+
description: 'Paths to tests for run ,example : ydb/ ydb/tests/func/suite'
1313
required: true
1414
type: string
1515
default: ydb/
1616
test_type:
17-
description: 'Тип тестов'
17+
description: 'Test type (unittest,py3test,py2test,pytest)'
1818
required: false
1919
type: string
2020
default: unittest,py3test,py2test,pytest
2121
test_size:
22-
description: 'Размер тестов'
22+
description: 'Test size (small,medium,large)'
2323
required: false
2424
type: string
2525
default: small,medium,large
2626
additional_ya_make_args:
27-
description: 'Дополнительные аргументы для ya make'
27+
description: 'additional args for ya make'
2828
required: false
2929
type: string
30-
default: -DDEBUGINFO_LINES_ONLY
30+
default: ''
3131
build_preset:
3232
description: 'Build preset type'
3333
required: true
3434
type: string
35-
35+
branches:
36+
description: 'Branches to test (JSON array or single branch)'
37+
required: false
38+
type: string
39+
default: '["main"]'
40+
41+
workflow_dispatch:
42+
inputs:
43+
runner_label:
44+
description: 'Label of the runner to be used'
45+
required: false
46+
default: self-hosted
47+
test_targets:
48+
description: 'Paths to tests for run ,example : ydb/ ydb/tests/func/suite'
49+
required: true
50+
default: ydb/
51+
test_type:
52+
description: 'Test type (unittest,py3test,py2test,pytest)'
53+
required: false
54+
default: unittest,py3test,py2test,pytest
55+
test_size:
56+
description: 'Test size (small,medium,large)'
57+
required: false
58+
type: choice
59+
default: small,medium,large
60+
options:
61+
- small
62+
- medium,
63+
- large
64+
- small,medium
65+
- small,medium,large
66+
additional_ya_make_args:
67+
description: 'additional args for ya make'
68+
required: false
69+
default: ''
70+
build_preset:
71+
description: 'Build preset type (relwithdebinfo, release-asan, release-msan, release-tsan)'
72+
required: true
73+
type: choice
74+
options:
75+
- relwithdebinfo
76+
- release-asan
77+
- release-msan
78+
- release-tsan
79+
default: relwithdebinfo
80+
branches:
81+
description: 'Branches to test (JSON array or single branch name)'
82+
required: false
83+
default: '["main"]'
84+
3685
jobs:
86+
prepare:
87+
runs-on: ubuntu-latest
88+
outputs:
89+
branch_array: ${{ steps.set-branches.outputs.branch_array }}
90+
steps:
91+
- name: Set branches
92+
id: set-branches
93+
run: |
94+
INPUT_BRANCHES='${{ inputs.branches }}'
95+
# Check if input is a JSON array
96+
if [[ $INPUT_BRANCHES == \[* ]]; then
97+
echo "branch_array=$INPUT_BRANCHES" >> $GITHUB_OUTPUT
98+
else
99+
# If it's a single branch, create a JSON array with one element
100+
echo "branch_array=[\"$INPUT_BRANCHES\"]" >> $GITHUB_OUTPUT
101+
fi
102+
103+
echo "Using branches: $(cat $GITHUB_OUTPUT | grep branch_array | cut -d= -f2)"
104+
37105
run_tests:
38-
name: Test ${{ github.ref_name }}:${{ inputs.build_preset }}
106+
needs: prepare
107+
name: ${{ matrix.branch }}:${{ inputs.build_preset }}
39108
timeout-minutes: 1200
40109
runs-on: ${{ inputs.runner_label }}
110+
strategy:
111+
fail-fast: false
112+
matrix:
113+
branch: ${{ fromJson(needs.prepare.outputs.branch_array) }}
41114
steps:
42115
- name: Set variables based on build_preset
43116
id: set-vars
@@ -59,11 +132,11 @@ jobs:
59132
exit 1
60133
fi
61134
62-
- name: Checkout
135+
- name: Checkout ${{ matrix.branch }}
63136
uses: actions/checkout@v4
64137
with:
65-
ref: ${{ github.ref_name }}
66-
138+
ref: ${{ matrix.branch }}
139+
67140
- name: Setup ssh key for slice
68141
uses: webfactory/ssh-agent@v0.9.0
69142
with:
@@ -74,7 +147,7 @@ jobs:
74147
with:
75148
ci_ydb_service_account_key_file_credentials: ${{ secrets.CI_YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS }}
76149

77-
- name: Run YDB Tests ${{ github.ref_name }}
150+
- name: Run YDB Tests
78151
timeout-minutes: ${{ fromJson(env.timeout) }}
79152
uses: ./.github/actions/build_and_test_ya
80153
with:
@@ -87,9 +160,10 @@ jobs:
87160
test_size: ${{ inputs.test_size }}
88161
test_type: ${{ inputs.test_type }}
89162
test_threads: ${{ fromJson(env.threads_count) }}
163+
custom_branch_name: ${{ matrix.branch }}
90164
put_build_results_to_cache: true
91-
additional_ya_make_args: ${{ inputs.additional_ya_make_args }}
165+
additional_ya_make_args: -DDEBUGINFO_LINES_ONLY ${{ inputs.additional_ya_make_args }}
92166
secs: ${{ format('{{"TESTMO_TOKEN2":"{0}","AWS_KEY_ID":"{1}","AWS_KEY_VALUE":"{2}","REMOTE_CACHE_USERNAME":"{3}","REMOTE_CACHE_PASSWORD":"{4}"}}',
93167
secrets.TESTMO_TOKEN2, secrets.AWS_KEY_ID, secrets.AWS_KEY_VALUE, secrets.REMOTE_CACHE_USERNAME, secrets.REMOTE_CACHE_PASSWORD ) }}
94168
vars: ${{ format('{{"AWS_BUCKET":"{0}","AWS_ENDPOINT":"{1}","REMOTE_CACHE_URL":"{2}","TESTMO_URL":"{3}","TESTMO_PROJECT_ID":"{4}"}}',
95-
vars.AWS_BUCKET, vars.AWS_ENDPOINT, vars.REMOTE_CACHE_URL_YA, vars.TESTMO_URL, vars.TESTMO_PROJECT_ID ) }}
169+
vars.AWS_BUCKET, vars.AWS_ENDPOINT, vars.REMOTE_CACHE_URL_YA, vars.TESTMO_URL, vars.TESTMO_PROJECT_ID ) }}

0 commit comments

Comments
 (0)