Skip to content

Commit bad8514

Browse files
authored
CI: Workflow improvments (Nightly build + Run test) (#17515)
1 parent 368af82 commit bad8514

File tree

2 files changed

+44
-22
lines changed

2 files changed

+44
-22
lines changed

.github/workflows/nightly_build.yml

+26-10
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
11
name: Nightly-Build # workflow used to upload built binaries to s3
22
on:
3+
schedule:
4+
- cron: "0 3 * * *" # At 03:00 every day
35
workflow_dispatch:
46
inputs:
5-
runner_label:
6-
type: string
7-
default: "auto-provisioned"
8-
description: "runner label"
9-
commit_sha:
10-
type: string
11-
default: ""
7+
use_default_branches:
8+
description: 'If true, run on main and all current stable branches. If false, run only on the current branch.'
9+
type: boolean
10+
required: false
11+
default: true
12+
1213
jobs:
14+
determine_branches:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
branches: ${{ steps.set-branches.outputs.branches }}
18+
steps:
19+
- id: set-branches
20+
run: |
21+
if [[ "${{ github.event_name }}" == "schedule" || "${{ inputs.use_default_branches }}" == "true" ]]; then
22+
echo "branches=['main', 'stable-25-1', 'stable-24-4', 'stable-25-1-1', 'stable-25-1-analytics']" >> $GITHUB_OUTPUT
23+
else
24+
echo "branches=['${{ github.ref_name }}']" >> $GITHUB_OUTPUT
25+
fi
26+
1327
build_and_test:
28+
needs: determine_branches
1429
strategy:
1530
fail-fast: false
1631
matrix:
1732
build_preset: ["release", "relwithdebinfo", "release-asan"]
33+
branch: ${{ fromJSON(needs.determine_branches.outputs.branches) }}
1834
runs-on: [ self-hosted, auto-provisioned, "${{ format('build-preset-{0}', matrix.build_preset) }}" ]
19-
name: Build and test ${{ matrix.build_preset }}
35+
name: Build and test ${{ matrix.build_preset }} on ${{ matrix.branch }}
2036
steps:
2137
- name: Checkout
2238
uses: actions/checkout@v4
2339
with:
24-
ref: ${{ inputs.commit_sha }}
40+
ref: ${{ matrix.branch }}
2541
fetch-depth: 2
2642
- name: Setup ydb access
2743
uses: ./.github/actions/setup_ci_ydb_service_account_key_file_credentials
@@ -51,4 +67,4 @@ jobs:
5167
shell: bash
5268
run: |
5369
set -x
54-
s3cmd sync --follow-symlinks --acl-public --no-progress --stats --no-check-md5 "ydb/apps/ydbd/ydbd" "s3://ydb-builds/${{ github.ref_name }}/${{ matrix.build_preset }}/ydbd" -d
70+
s3cmd sync --follow-symlinks --acl-public --no-progress --stats --no-check-md5 "ydb/apps/ydbd/ydbd" "s3://ydb-builds/${{ matrix.branch }}/${{ matrix.build_preset }}/ydbd" -d

.github/workflows/run_tests.yml

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run tests
1+
name: Run-tests
22

33
on:
44
workflow_call:
@@ -68,10 +68,6 @@ on:
6868
- release-msan
6969
- release-tsan
7070
default: relwithdebinfo
71-
branches:
72-
description: 'Branches to test (JSON array or single branch name)'
73-
required: false
74-
default: '["main"]'
7571

7672
jobs:
7773
prepare:
@@ -81,17 +77,27 @@ jobs:
8177
steps:
8278
- name: Set branches
8379
id: set-branches
80+
env:
81+
CALLED_BRANCHES: '${{ inputs.branches }}'
8482
run: |
85-
INPUT_BRANCHES='${{ inputs.branches }}'
86-
# Check if input is a JSON array
87-
if [[ $INPUT_BRANCHES == \[* ]]; then
88-
echo "branch_array=$INPUT_BRANCHES" >> $GITHUB_OUTPUT
83+
# Проверяем, был ли передан параметр branches из вызывающего workflow
84+
if [[ -n "$CALLED_BRANCHES" ]]; then
85+
echo "Branches parameter provided from calling workflow: $CALLED_BRANCHES"
86+
87+
# Проверяем, является ли вход уже JSON-массивом
88+
if [[ $CALLED_BRANCHES == \[* ]]; then
89+
echo "branch_array=$CALLED_BRANCHES" >> $GITHUB_OUTPUT
90+
else
91+
# Если это одна ветка, создаем JSON-массив с одним элементом
92+
echo "branch_array=[\"$CALLED_BRANCHES\"]" >> $GITHUB_OUTPUT
93+
fi
8994
else
90-
# If it's a single branch, create a JSON array with one element
91-
echo "branch_array=[\"$INPUT_BRANCHES\"]" >> $GITHUB_OUTPUT
95+
# Если ветки не переданы, значит это прямой запуск workflow_dispatch
96+
echo "No branches specified, using current branch: ${{ github.ref_name }}"
97+
echo "branch_array=[\"${{ github.ref_name }}\"]" >> $GITHUB_OUTPUT
9298
fi
9399
94-
echo "Using branches: $(cat $GITHUB_OUTPUT | grep branch_array | cut -d= -f2)"
100+
echo "Final branches to use: $(cat $GITHUB_OUTPUT | grep branch_array | cut -d= -f2)"
95101
96102
run_tests:
97103
needs: prepare

0 commit comments

Comments
 (0)