123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- name: Build-and-Test-On-demand
- on:
- workflow_call:
- inputs:
- sanitizer:
- required: false
- type: string
- test_label_regexp:
- required: false
- type: string
- image:
- type: string
- required: false
- default: fd8earpjmhevh8h6ug5o
- run_unit_tests:
- type: boolean
- default: true
- run_functional_tests:
- type: boolean
- default: true
- workflow_dispatch:
- inputs:
- sanitizer:
- required: false
- type: string
- test_label_regexp:
- required: false
- type: string
- image:
- type: string
- required: false
- default: fd8earpjmhevh8h6ug5o
- run_unit_tests:
- type: boolean
- default: true
- run_functional_tests:
- type: boolean
- default: true
-
- 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: 128GB
- 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:
- name: Build and test
- needs:
- - provide-runner
- - prepare-vm
- 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: Build
- id: build
- uses: ./.github/actions/build
- with:
- sanitizer: ${{ inputs.sanitizer }}
- ccache_remote_path: ${{ vars.REMOTE_CACHE_URL && format('http://{0}{1}', secrets.REMOTE_CACHE_AUTH, vars.REMOTE_CACHE_URL) || ''}}
- - name: Run tests
- uses: ./.github/actions/test
- with:
- log_suffix: ${{format('{0}{1}', 'X64', inputs.sanitizer)}}
- test_label_regexp: ${{ inputs.test_label_regexp }}
- aws_key_id: ${{secrets.AWS_KEY_ID}}
- aws_key_value: ${{secrets.AWS_KEY_VALUE}}
- aws_bucket: ${{vars.AWS_BUCKET}}
- aws_endpoint: ${{vars.AWS_ENDPOINT}}
- testman_token: ${{secrets.TESTMO_TOKEN}}
- testman_url: ${{vars.TESTMO_URL}}
- testman_project_id: ${{vars.TESTMO_PROJECT_ID}}
- run_unit_tests: ${{inputs.run_unit_tests}}
- run_functional_tests: ${{inputs.run_functional_tests}}
- 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 }}
-
|