Build and test NBS on demand using cmake #4
Workflow file for this run
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 using cmake | |
on: | |
workflow_dispatch: | |
inputs: | |
build_preset: | |
type: choice | |
default: "relwithdebinfo" | |
description: "Build preset" | |
options: | |
- debug | |
- relwithdebinfo | |
- release-asan | |
- release-tsan | |
run_build: | |
type: boolean | |
default: true | |
description: "run build" | |
run_tests: | |
type: boolean | |
default: true | |
description: "run tests" | |
sleep_after_tests: | |
type: string | |
default: "0" | |
description: "Amount of seconds to sleep after tests" | |
workflow_call: | |
inputs: | |
build_preset: | |
type: string | |
default: "relwithdebinfo" | |
run_build: | |
type: boolean | |
default: true | |
run_tests: | |
type: boolean | |
default: true | |
sleep_after_tests: | |
type: string | |
default: "0" | |
description: "Amount of seconds to sleep after tests" | |
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] | |
timeout-minutes: 60 | |
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 | |
user: github | |
ssh-public-key: ${{ secrets.RUNNER_PUBLIC_KEY }} | |
prepare-vm: | |
name: Prepare runner | |
needs: provide-runner | |
runs-on: [ self-hosted, "${{ needs.provide-runner.outputs.label }}" ] | |
outputs: | |
runner_ipv4: ${{ steps.configure-ncp.outputs.runner_ipv4 }} | |
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 == '' | |
- id: configure-ncp | |
name: Configure NCP | |
uses: ./.github/actions/ncp | |
with: | |
instance_id: ${{ needs.provide-runner.outputs.instance-id }} | |
sa_json: ${{ secrets.NEBIUS_GITHUB_USER_SA_JSON}} | |
- id: configure-authorized-keys | |
name: Configure authorized_keys | |
uses: ./.github/actions/ssh_keys | |
with: | |
org: ydb-platform | |
team: nbs | |
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
- name: Prepare VM | |
uses: ./.github/actions/prepare | |
build-and-test: | |
name: Build and test NBS [id=${{ needs.provide-runner.outputs.instance-id }} ip=${{ needs.prepare-vm.outputs.runner_ipv4 }}] | |
uses: ./.github/workflows/build_and_test_cmake.yaml | |
needs: | |
- provide-runner | |
- prepare-vm | |
with: | |
runner_kind: self-hosted | |
runner_label: ${{ needs.provide-runner.outputs.label }} | |
runner_instance_id: ${{ needs.provide-runner.outputs.instance-id }} | |
runner_ipv4: ${{ needs.prepare-vm.outputs.runner_ipv4 }} | |
build_preset: ${{ inputs.build_preset }} | |
run_build: ${{ inputs.run_build }} | |
run_tests: ${{ inputs.run_tests }} | |
sleep_after_tests: ${{ inputs.sleep_after_tests }} | |
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: Sleep ${{ needs.build-and-test.outputs.sleep_after_tests || '0' }}s if build failed | |
shell: bash | |
if: ${{ needs.build-and-test.outputs.sleep_after_tests && needs.build-and-test.outputs.sleep_after_tests != '0' }} | |
run: sleep ${{ needs.build-and-test.outputs.sleep_after_tests }} | |
- name: Stop YC runner | |
uses: librarian/[email protected] | |
if: always() | |
timeout-minutes: 60 | |
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 |