Skip to content

Commit 19203c4

Browse files
Merge b012059 into 3d1ee2a
2 parents 3d1ee2a + b012059 commit 19203c4

File tree

3 files changed

+140
-31
lines changed

3 files changed

+140
-31
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Ya-Build-and-Test
2+
inputs:
3+
build_target:
4+
type: string
5+
default: "ydb/"
6+
description: "limit build and test to specific target"
7+
build_preset:
8+
type: string
9+
run_build:
10+
type: boolean
11+
default: true
12+
description: "run build"
13+
run_tests:
14+
type: boolean
15+
default: true
16+
description: "run tests"
17+
test_threads:
18+
type: string
19+
default: 28
20+
description: "Test threads count"
21+
link_threads:
22+
type: string
23+
default: 8
24+
description: "link threads count"
25+
test_size:
26+
type: string
27+
default: "small,medium,large"
28+
test_type:
29+
type: string
30+
default: "unittest,py3test,py2test,pytest"
31+
folder_prefix:
32+
type: string
33+
default: "ya-"
34+
cache_tests:
35+
type: boolean
36+
default: false
37+
description: "Use cache for tests"
38+
put_build_results_to_cache:
39+
type: boolean
40+
default: true
41+
commit_sha:
42+
type: string
43+
default: ""
44+
secs:
45+
type: string
46+
default: ""
47+
vars:
48+
type: string
49+
default: ""
50+
defaults:
51+
run:
52+
shell: bash
53+
runs:
54+
using: "composite"
55+
steps:
56+
- name: comment-build-start
57+
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
58+
shell: bash
59+
env:
60+
BUILD_PRESET: ${{ inputs.build_preset }}
61+
GITHUB_TOKEN: ${{ github.token }}
62+
run: |
63+
jobs_url="https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs"
64+
# tricky: we are searching job with name that contains build_preset
65+
check_url=$(curl -s $jobs_url | jq --arg n "$BUILD_PRESET" -r '.jobs[] | select(.name | contains($n)) | .html_url')
66+
67+
echo "Pre-commit [check]($check_url) for ${{ inputs.commit_sha }} has started." | .github/scripts/tests/comment-pr.py --rewrite
68+
69+
- name: Prepare s3cmd
70+
uses: ./.github/actions/s3cmd
71+
with:
72+
s3_bucket: ${{ fromJSON( inputs.vars ).AWS_BUCKET }}
73+
s3_endpoint: ${{ fromJSON( inputs.vars ).AWS_ENDPOINT }}
74+
s3_key_id: ${{ fromJSON( inputs.secs ).AWS_KEY_ID }}
75+
s3_key_secret: ${{ fromJSON( inputs.secs ).AWS_KEY_VALUE }}
76+
folder_prefix: ya-
77+
build_preset: ${{ inputs.build_preset }}
78+
79+
- name: Build
80+
uses: ./.github/actions/build_ya
81+
if: ${{ inputs.run_build == 'true' }}
82+
with:
83+
build_target: ${{ inputs.build_target }}
84+
build_preset: ${{ inputs.build_preset }}
85+
bazel_remote_uri: ${{ fromJSON( inputs.vars ).REMOTE_CACHE_URL || '' }}
86+
bazel_remote_username: ${{ inputs.put_build_results_to_cache && fromJSON( inputs.secs ).REMOTE_CACHE_USERNAME || '' }}
87+
bazel_remote_password: ${{ inputs.put_build_results_to_cache && fromJSON( inputs.secs ).REMOTE_CACHE_PASSWORD || '' }}
88+
link_threads: ${{ inputs.link_threads }}
89+
90+
- name: debug1
91+
shell: bash
92+
run: echo "Run tests? ${{ inputs.run_tests }}"
93+
94+
- name: Run tests
95+
uses: ./.github/actions/test_ya
96+
if: ${{ inputs.run_tests == 'true' }}
97+
with:
98+
build_target: ${{ inputs.build_target }}
99+
build_preset: ${{ inputs.build_preset }}
100+
test_size: ${{ inputs.test_size }}
101+
test_type: ${{ inputs.test_type }}
102+
testman_token: ${{ fromJSON( inputs.secs ).TESTMO_TOKEN }}
103+
testman_url: ${{ fromJSON( inputs.vars ).TESTMO_URL }}
104+
testman_project_id: ${{ fromJSON( inputs.vars ).TESTMO_PROJECT_ID }}
105+
bazel_remote_uri: ${{ fromJSON( inputs.vars ).REMOTE_CACHE_URL || '' }}
106+
bazel_remote_username: ${{ inputs.put_build_results_to_cache && fromJSON( inputs.secs ).REMOTE_CACHE_USERNAME || '' }}
107+
bazel_remote_password: ${{ inputs.put_build_results_to_cache && fromJSON( inputs.secs ).REMOTE_CACHE_PASSWORD || '' }}
108+
link_threads: ${{ inputs.link_threads }}
109+
test_threads: ${{ inputs.test_threads }}
110+
111+
- name: comment-if-cancel
112+
shell: bash
113+
if: cancelled() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target')
114+
env:
115+
BUILD_PRESET: ${{ inputs.build_preset }}
116+
GITHUB_TOKEN: ${{ github.token }}
117+
run: echo "Check cancelled" | .github/scripts/tests/comment-pr.py --color black

.github/actions/build_ya/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ runs:
7070
release)
7171
build_type=release
7272
;;
73-
release-cmake14)
73+
release-clang14)
7474
build_type=release
7575
extra_params+=(--target-platform="CLANG14-LINUX-X86_64")
7676
extra_params+=(-DLLD_VERSION=16)

.github/workflows/pr_check.yml

+22-30
Original file line numberDiff line numberDiff line change
@@ -196,34 +196,26 @@ jobs:
196196
strategy:
197197
fail-fast: false
198198
matrix:
199-
build_preset: ["relwithdebinfo", "release-asan"]
199+
build_preset: ["relwithdebinfo", "release-asan", "release-clang14"]
200+
runs-on: [ self-hosted, auto-provisioned, "${{ format('build-preset-{0}', matrix.build_preset) }}" ]
200201
name: Build and test ${{ matrix.build_preset }}
201-
uses: ./.github/workflows/build_and_test_ya_provisioned.yml
202-
with:
203-
build_preset: ${{ matrix.build_preset }}
204-
build_target: "ydb/"
205-
test_size: "small,medium"
206-
test_type: "unittest,py3test,py2test,pytest"
207-
test_threads: 52
208-
runner_label: auto-provisioned
209-
put_build_results_to_cache: true
210-
commit_sha: ${{ needs.check-running-allowed.outputs.commit_sha }}
211-
secrets: inherit
212-
build:
213-
needs:
214-
- check-running-allowed
215-
if: needs.check-running-allowed.outputs.result == 'true' && needs.check-running-allowed.outputs.commit_sha != ''
216-
strategy:
217-
fail-fast: false
218-
matrix:
219-
build_preset: ["release-cmake14"]
220-
name: Build and test ${{ matrix.build_preset }}
221-
uses: ./.github/workflows/build_and_test_ya_provisioned.yml
222-
with:
223-
build_preset: ${{ matrix.build_preset }}
224-
build_target: "ydb/"
225-
run_tests: false
226-
runner_label: auto-provisioned
227-
put_build_results_to_cache: true
228-
commit_sha: ${{ needs.check-running-allowed.outputs.commit_sha }}
229-
secrets: inherit
202+
steps:
203+
- name: Checkout
204+
uses: actions/checkout@v3
205+
with:
206+
ref: ${{ needs.check-running-allowed.outputs.commit_sha }}
207+
- name: Build and test
208+
uses: ./.github/actions/build_and_test_ya
209+
with:
210+
build_preset: ${{ matrix.build_preset }}
211+
build_target: "ydb/"
212+
run_tests: ${{ contains(fromJSON('["relwithdebinfo", "release-asan"]'), matrix.build_preset) }}
213+
test_size: "small,medium"
214+
test_type: "unittest,py3test,py2test,pytest"
215+
test_threads: 52
216+
put_build_results_to_cache: true
217+
commit_sha: ${{ needs.check-running-allowed.outputs.commit_sha }}
218+
secs: ${{ format('{{"TESTMO_TOKEN":"{0}","AWS_KEY_ID":"{1}","AWS_KEY_VALUE":"{2}","REMOTE_CACHE_USERNAME":"{3}","REMOTE_CACHE_PASSWORD":"{4}"}}',
219+
secrets.TESTMO_TOKEN, secrets.AWS_KEY_ID, secrets.AWS_KEY_VALUE, secrets.REMOTE_CACHE_USERNAME, secrets.REMOTE_CACHE_PASSWORD ) }}
220+
vars: ${{ format('{{"AWS_BUCKET":"{0}","AWS_ENDPOINT":"{1}","REMOTE_CACHE_URL":"{2}","TESTMO_URL":"{3}","TESTMO_PROJECT_ID":"{4}"}}',
221+
vars.AWS_BUCKET, vars.AWS_ENDPOINT, vars.REMOTE_CACHE_URL_YA, vars.TESTMO_URL, vars.TESTMO_PROJECT_ID ) }}

0 commit comments

Comments
 (0)