prewarm-ccache.yml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. name: Prewarm-Ccache
  2. on:
  3. schedule:
  4. - cron: "0 4 * * *"
  5. workflow_dispatch:
  6. jobs:
  7. provide-runner:
  8. name: Start self-hosted YC runner
  9. timeout-minutes: 5
  10. runs-on: ubuntu-latest
  11. outputs:
  12. label: ${{ steps.start-yc-runner.outputs.label }}
  13. instance-id: ${{ steps.start-yc-runner.outputs.instance-id }}
  14. steps:
  15. - name: Start YC runner
  16. id: start-yc-runner
  17. uses: yc-actions/yc-github-runner@v1
  18. with:
  19. mode: start
  20. yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
  21. github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
  22. folder-id: ${{ secrets.YC_FOLDER }}
  23. image-id: fd8earpjmhevh8h6ug5o # TODO: create constant
  24. disk-size: ${{ vars.DISK_SIZE && vars.DISK_SIZE || '279GB' }}
  25. disk-type: network-ssd-nonreplicated
  26. cores: 32
  27. memory: 64GB
  28. core-fraction: 100
  29. zone-id: ru-central1-b
  30. subnet-id: ${{ secrets.YC_SUBNET }}
  31. prepare-vm:
  32. name: Prepare runner
  33. needs: provide-runner
  34. runs-on: "${{ needs.provide-runner.outputs.label }}"
  35. steps:
  36. - name: install docker
  37. run: |
  38. apt-get update
  39. apt-get install -y --no-install-recommends docker.io
  40. build:
  41. needs:
  42. - provide-runner
  43. - prepare-vm
  44. runs-on: "${{ needs.provide-runner.outputs.label }}"
  45. # runs-on: linux
  46. strategy:
  47. fail-fast: false
  48. max-parallel: 1
  49. matrix:
  50. version: ["ubuntu-2204", "ubuntu-2004", "ubuntu-1804"]
  51. steps:
  52. - name: Checkout
  53. uses: actions/checkout@v3
  54. - name: build
  55. shell: bash
  56. run: |
  57. echo "::group::docker-build"
  58. docker build -f .github/prewarm/${{ matrix.version }}.dockerfile -t $IMG .
  59. echo "::endgroup::"
  60. docker run --rm -v `pwd`:/ydbwork/ydb \
  61. -e CCACHE_REMOTE_STORAGE="${CCACHE_REMOTE_STORAGE}" \
  62. $IMG \
  63. bash /ydbwork/ydb/.github/prewarm/build.sh
  64. env:
  65. IMG: runner-${{ matrix.version }}
  66. CCACHE_REMOTE_STORAGE: ${{ vars.REMOTE_CACHE_URL && format('http://{0}{1}', secrets.REMOTE_CACHE_AUTH, vars.REMOTE_CACHE_URL) || ''}}
  67. release-runner:
  68. name: Release self-hosted YC runner if provided on-demand
  69. needs:
  70. - provide-runner
  71. - build
  72. runs-on: ubuntu-latest
  73. if: always()
  74. steps:
  75. - name: Stop YC runner
  76. uses: yc-actions/yc-github-runner@v1
  77. with:
  78. mode: stop
  79. yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
  80. github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
  81. label: ${{ needs.provide-runner.outputs.label }}
  82. instance-id: ${{ needs.provide-runner.outputs.instance-id }}