name: Ya-Build-and-Test-On-demand on: workflow_dispatch: inputs: image: type: string default: fd8earpjmhevh8h6ug5o description: "VM image" build_target: type: string default: "ydb/" description: "limit build and test to specific target" sanitizer: type: choice default: "none" description: "sanitizer type" options: - none - address - memory - thread - undefined - leak run_build: type: boolean default: true description: "run build" run_tests: type: boolean default: true description: "run tests" jobs: provide-runner: name: Start self-hosted YC 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: yc-actions/yc-github-runner@v1 with: mode: start yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }} github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} folder-id: ${{ secrets.YC_FOLDER }} image-id: ${{ inputs.image }} disk-size: ${{ vars.DISK_SIZE && vars.DISK_SIZE || '1023GB' }} disk-type: network-ssd-nonreplicated cores: 32 memory: 256GB core-fraction: 100 zone-id: ru-central1-b subnet-id: ${{ secrets.YC_SUBNET }} 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_vm main: uses: ./.github/workflows/build_and_test_ya.yml needs: - provide-runner - prepare-vm with: runner_kind: self-hosted runner_label: ${{ needs.provide-runner.outputs.label }} build_target: ${{ inputs.build_target }} sanitizer: ${{ inputs.sanitizer }} run_build: ${{ inputs.run_build }} run_tests: ${{ inputs.run_tests }} log_suffix: ya-x86-64${{ inputs.sanitizer != 'none' && format('-{1}', inputs.sanitizer) || '' }} secrets: inherit release-runner: name: Release self-hosted YC runner if provided on-demand needs: - provide-runner # required to get output from the start-runner job - main # required to wait when the main job is done runs-on: ubuntu-latest if: always() steps: - name: Stop YC runner uses: yc-actions/yc-github-runner@v1 with: mode: stop yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }} github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} label: ${{ needs.provide-runner.outputs.label }} instance-id: ${{ needs.provide-runner.outputs.instance-id }}