-
Notifications
You must be signed in to change notification settings - Fork 22
103 lines (97 loc) · 3.58 KB
/
build_and_test_cmake.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Build and test using cmake
on:
workflow_call:
inputs:
build_preset:
type: string
runner_kind:
type: string
required: true
description: "self-hosted or provisioned"
runner_label:
type: string
default: "linux"
description: "runner label"
runner_instance_id:
type: string
default: ""
description: "runner instance id"
runner_ipv4:
type: string
default: ""
description: "runner ipv4"
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 time to sleep after tests"
nebius:
type: string
default: "no"
description: "Run on nebius runners"
outputs:
sleep_after_tests:
description: "sleep_after_tests"
value: ${{ jobs.build-and-test.outputs.sleep_after_tests }}
jobs:
build-and-test:
name: Build and test ${{ inputs.build_preset }} [id=${{ inputs.runner_instance_id }} ip=${{ inputs.runner_ipv4 }}]
runs-on: [ self-hosted, "${{ inputs.runner_kind }}", "${{ inputs.runner_label }}" ]
outputs:
sleep_after_tests: ${{ steps.failure.outputs.sleep_after_tests }}
timeout-minutes: 1440
steps:
- name: Checkout PR
uses: actions/checkout@v4
if: github.event.pull_request.head.sha != ''
with:
submodules: true
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ !contains(github.event.pull_request.labels.*.name, 'rebase') && 1 || 0 }}
- name: Rebase PR
if: ${{ github.event.pull_request.head.sha != '' && contains(github.event.pull_request.labels.*.name, 'rebase') }}
shell: bash
run: |
git config user.email "[email protected]"
git config user.name "Rebase Robotovich"
git fetch origin ${{ github.event.pull_request.base.ref }}
git rebase origin/${{ github.event.pull_request.base.ref }}
- name: Checkout
uses: actions/checkout@v4
if: github.event.pull_request.head.sha == ''
with:
submodules: true
- name: Prepare s3cmd
uses: ./.github/actions/s3cmd
with:
s3_bucket: ${{ vars.AWS_BUCKET }}
s3_endpoint: ${{ inputs.nebius == 'yes' && vars.NEBIUS_AWS_ENDPOINT || vars.AWS_ENDPOINT }}
s3_website_suffix: ${{ inputs.nebius == 'yes' && vars.NEBIUS_AWS_WEBSITE_SUFFIX || vars.AWS_WEBSITE_SUFFIX }}
s3_key_id: ${{ inputs.nebius == 'yes' && secrets.NEBIUS_AWS_ACCESS_KEY_ID || secrets.AWS_ACCESS_KEY_ID }}
s3_key_secret: ${{ inputs.nebius == 'yes' && secrets.NEBIUS_AWS_SECRET_ACCESS_KEY || secrets.AWS_SECRET_ACCESS_KEY }}
folder_prefix: nebius-
build_preset: ${{ inputs.build_preset }}
install: false
- name: Build
uses: ./.github/actions/build_cmake
if: inputs.run_build
with:
bazel_remote_uri: ${{ inputs.nebius == 'yes' && vars.NEBIUS_BAZEL_REMOTE_CACHE_URL || vars.REMOTE_CACHE_URL_YA }}
bazel_remote_username: ${{ secrets.REMOTE_CACHE_USERNAME }}
bazel_remote_password: ${{ secrets.REMOTE_CACHE_PASSWORD }}
- name: Run tests
uses: ./.github/actions/test_cmake
if: inputs.run_tests
- id: failure
name: set sleep_after_tests in case of failure
if: failure()
uses: ./.github/actions/sleep
with:
sleep_after_tests: ${{ inputs.sleep_after_tests != '0' && inputs.sleep_after_tests || '7200' }}