-
Notifications
You must be signed in to change notification settings - Fork 22
170 lines (164 loc) · 6.13 KB
/
build_and_test_ya.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Build and test
on:
workflow_call:
inputs:
build_target:
type: string
default: "cloud/blockstore/apps/,cloud/filestore/apps/,cloud/disk_manager/,cloud/tasks/"
description: "limit build to specific target"
test_target:
type: string
default: "cloud/blockstore/,cloud/filestore/,cloud/disk_manager/,cloud/tasks/"
description: "limit test to specific target"
build_preset:
type: string
runner_kind:
type: string
required: true
description: "self-hosted or provisioned"
runner_label:
type: string
default: "linux"
description: "runner label"
runner_instance_id:
type: string
default: ""
description: "runner instance id"
runner_ipv4:
type: string
default: ""
description: "runner ipv4"
run_build:
type: boolean
default: true
description: "run build"
run_tests:
type: boolean
default: true
description: "run tests"
test_threads:
type: string
default: '64'
description: "Test threads count"
link_threads:
type: string
default: '32'
description: "link threads count"
sleep_after_tests:
type: string
default: "0"
description: "Amount of time to sleep after tests"
test_size:
type: string
default: "small,medium,large"
test_type:
type: string
default: "unittest,clang_tidy,gtest,py3test,py2test,pytest,flake8,black,py2_flake8,go_test,gofmt"
folder_prefix:
type: string
default: "nebius-"
cache_update_build:
type: boolean
default: false
description: "Update remote build cache"
cache_update_tests:
type: boolean
default: false
description: "Update remote build cache"
upload_ya_dir:
type: string
default: "no"
description: "Upload ya dir to s3"
clean_ya_dir:
type: string
default: "no"
description: "Clean ya dir from image before building"
use_network_cache:
type: string
default: "yes"
description: "Use network cache"
nebius:
type: string
default: "no"
description: "Run on nebius runners"
outputs:
sleep_after_tests:
description: "sleep_after_tests"
value: ${{ jobs.build-and-test.outputs.sleep_after_tests }}
jobs:
build-and-test:
name: Build and test ${{ inputs.build_preset }} [id=${{ inputs.runner_instance_id }} ip=${{ inputs.runner_ipv4 }}]
runs-on: [ self-hosted, "${{ inputs.runner_kind }}", "${{ inputs.runner_label }}" ]
outputs:
sleep_after_tests: ${{ steps.failure.outputs.sleep_after_tests }}
timeout-minutes: 1440
steps:
- name: Checkout PR
uses: actions/checkout@v4
if: github.event.pull_request.head.sha != ''
with:
submodules: true
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ !contains(github.event.pull_request.labels.*.name, 'rebase') && 1 || 0 }}
- name: Rebase PR
if: ${{ github.event.pull_request.head.sha != '' && contains(github.event.pull_request.labels.*.name, 'rebase') }}
shell: bash
run: |
git config user.email "[email protected]"
git config user.name "Rebase Robotovich"
git fetch origin ${{ github.event.pull_request.base.ref }}
git rebase origin/${{ github.event.pull_request.base.ref }}
- name: Checkout
uses: actions/checkout@v4
if: github.event.pull_request.head.sha == ''
with:
submodules: true
- name: Prepare s3cmd
uses: ./.github/actions/s3cmd
with:
s3_bucket: ${{ vars.AWS_BUCKET }}
s3_endpoint: ${{ inputs.nebius == 'yes' && vars.NEBIUS_AWS_ENDPOINT || vars.AWS_ENDPOINT }}
s3_website_suffix: ${{ inputs.nebius == 'yes' && vars.NEBIUS_AWS_WEBSITE_SUFFIX || vars.AWS_WEBSITE_SUFFIX }}
s3_key_id: ${{ inputs.nebius == 'yes' && secrets.NEBIUS_AWS_ACCESS_KEY_ID || secrets.AWS_ACCESS_KEY_ID }}
s3_key_secret: ${{ inputs.nebius == 'yes' && secrets.NEBIUS_AWS_SECRET_ACCESS_KEY || secrets.AWS_SECRET_ACCESS_KEY }}
folder_prefix: nebius-
build_preset: ${{ inputs.build_preset }}
install: false
- name: Build
uses: ./.github/actions/build
if: inputs.run_build
with:
build_target: ${{ inputs.build_target }}
build_preset: ${{ inputs.build_preset }}
cache_update: ${{ inputs.cache_update_build }}
bazel_remote_uri: ${{ inputs.nebius == 'yes' && vars.NEBIUS_BAZEL_REMOTE_CACHE_URL || vars.REMOTE_CACHE_URL_YA }}
bazel_remote_username: ${{ secrets.REMOTE_CACHE_USERNAME }}
bazel_remote_password: ${{ secrets.REMOTE_CACHE_PASSWORD }}
link_threads: ${{ inputs.link_threads }}
clean_ya_dir: ${{ inputs.clean_ya_dir }}
use_network_cache: ${{ inputs.use_network_cache }}
- name: Run tests
uses: ./.github/actions/test
if: inputs.run_tests
with:
test_target: ${{ inputs.test_target }}
build_preset: ${{ inputs.build_preset }}
test_size: ${{ inputs.test_size }}
test_type: ${{ inputs.test_type }}
cache_update: ${{ inputs.cache_update_tests }}
bazel_remote_uri: ${{ inputs.nebius == 'yes' && vars.NEBIUS_BAZEL_REMOTE_CACHE_URL || vars.REMOTE_CACHE_URL_YA }}
bazel_remote_username: ${{ secrets.REMOTE_CACHE_USERNAME }}
bazel_remote_password: ${{ secrets.REMOTE_CACHE_PASSWORD }}
link_threads: ${{ inputs.link_threads }}
test_threads: ${{ inputs.test_threads }}
sync_to_s3: ${{ vars.SYNC_TO_S3 }}
upload_ya_dir: ${{ inputs.upload_ya_dir }}
clean_ya_dir: ${{ inputs.run_build && 'no' || inputs.clean_ya_dir }}
use_network_cache: ${{ inputs.use_network_cache }}
nebius: ${{ inputs.nebius }}
- id: failure
name: set sleep_after_tests in case of failure
if: failure()
uses: ./.github/actions/sleep
with:
sleep_after_tests: ${{ inputs.sleep_after_tests != '0' && inputs.sleep_after_tests || '7200' }}