Build and test NBS on demand #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test NBS on demand | |
on: | |
workflow_dispatch: | |
inputs: | |
build_target: | |
type: string | |
default: "cloud/blockstore/apps/" | |
description: "limit build to specific target" | |
test_target: | |
type: string | |
default: "cloud/blockstore/" | |
description: "limit test to specific target" | |
build_preset: | |
type: choice | |
default: "relwithdebinfo" | |
description: "Build preset" | |
options: | |
- debug | |
- relwithdebinfo | |
- release-asan | |
- release-tsan | |
update_bazel_cache: | |
type: boolean | |
default: false | |
description: "Update remote cache" | |
test_size: | |
type: choice | |
default: "small" | |
description: "test size to run" | |
options: | |
- small | |
- small,medium | |
- small,medium,large | |
test_type: | |
type: choice | |
default: "unittest" | |
description: "type of tests to run" | |
options: | |
- unittest | |
- py3test,py2test,pytest | |
- unittest,py3test,py2test,pytest | |
test_threads: | |
type: string | |
default: "64" | |
description: "Test threads count" | |
link_threads: | |
type: string | |
default: "16" | |
description: "link threads count" | |
run_build: | |
type: boolean | |
default: true | |
description: "run build" | |
run_tests: | |
type: boolean | |
default: true | |
description: "run tests" | |
workflow_call: | |
inputs: | |
build_target: | |
type: string | |
default: "cloud/blockstore/apps/" | |
description: "limit build to specific target" | |
test_target: | |
type: string | |
default: "cloud/blockstore/" | |
description: "limit test to specific target" | |
build_preset: | |
type: string | |
default: "relwithdebinfo" | |
test_size: | |
type: string | |
default: "small,medium,large" | |
test_type: | |
type: string | |
default: "unittest,py3test,py2test,pytest" | |
run_build: | |
type: boolean | |
default: true | |
run_tests: | |
type: boolean | |
default: true | |
test_threads: | |
type: string | |
default: '28' | |
description: "Test threads count" | |
link_threads: | |
type: string | |
default: '8' | |
description: "link threads count" | |
update_bazel_cache: | |
type: boolean | |
default: false | |
description: "Update remote cache" | |
jobs: | |
provide-runner: | |
name: Start self-hosted runner | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
outputs: | |
label: ${{ steps.start-yc-runner.outputs.label }} | |
instance-id: ${{ steps.start-yc-runner.outputs.instance-id }} | |
steps: | |
- name: Start YC runner | |
id: start-yc-runner | |
uses: librarian/[email protected] | |
with: | |
mode: start | |
yc-sa-json-credentials: ${{ secrets.NEBIUS_SA_JSON_CREDENTIALS }} | |
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
folder-id: bjeuq5o166dq4ukv3eec | |
image-id: ${{ vars.IMAGE_ID_2204 }} | |
disk-size: '1023GB' | |
disk-type: network-ssd-nonreplicated | |
platform-id: standard-v2 | |
cores: 60 | |
memory: 120GB | |
core-fraction: 100 | |
zone-id: eu-north1-c | |
subnet-id: f8uh0ml4rhb45nde9p75 | |
filesystem-id: dp753obk26e8ldmptot1 | |
filesystem-name: ccache | |
prepare-vm: | |
name: Prepare runner | |
needs: provide-runner | |
runs-on: [ self-hosted, "${{ needs.provide-runner.outputs.label }}" ] | |
steps: | |
- name: Checkout PR | |
uses: actions/checkout@v3 | |
if: github.event.pull_request.head.sha != '' | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
if: github.event.pull_request.head.sha == '' | |
- name: Prepare VM | |
uses: ./.github/actions/prepare | |
build-and-test: | |
name: Build and test NBS | |
uses: ./.github/workflows/build_and_test_ya.yaml | |
needs: | |
- provide-runner | |
- prepare-vm | |
with: | |
runner_kind: self-hosted | |
runner_label: ${{ needs.provide-runner.outputs.label }} | |
build_target: ${{ inputs.build_target }} | |
test_target: ${{ inputs.test_target }} | |
build_preset: ${{ inputs.build_preset }} | |
run_build: ${{ inputs.run_build }} | |
run_tests: ${{ inputs.run_tests }} | |
test_size: ${{ inputs.test_size }} | |
test_type: ${{ inputs.test_type }} | |
link_threads: ${{ inputs.link_threads }} | |
test_threads: ${{ inputs.test_threads }} | |
update_bazel_cache: ${{ inputs.update_bazel_cache }} | |
secrets: inherit | |
release-runner: | |
name: Release self-hosted runner | |
needs: | |
- provide-runner # required to get output from the start-runner job | |
- build-and-test # required to wait when the main job is done | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: Stop YC runner | |
uses: librarian/[email protected] | |
with: | |
mode: stop | |
yc-sa-json-credentials: ${{ secrets.NEBIUS_SA_JSON_CREDENTIALS }} | |
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
label: ${{ needs.provide-runner.outputs.label }} | |
instance-id: ${{ needs.provide-runner.outputs.instance-id }} | |
folder-id: bjeuq5o166dq4ukv3eec | |
subnet-id: f8uh0ml4rhb45nde9p75 |