summaryrefslogtreecommitdiffstats
path: root/.github/actions/build_and_test_ya/action.yml
blob: 38022f8ca02e8547b080811af20d9a69fe5cda60 (plain) (blame)
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Ya-Build-and-Test
inputs:
  build_target:
    type: string
    default: "ydb/"
    description: "limit build and test to specific target"
  build_preset:
    type: string
  run_build:
    type: boolean
    default: true
    description: "run build"
  run_tests:
    type: boolean
    default: true
    description: "run tests"
  test_threads:
    type: string
    default: 28
    description: "Test threads count"
  link_threads:
    type: string
    default: 12
    description: "link threads count"
  test_size:
    type: string
    default: "small,medium,large"
  test_type:
    type: string
    default: ""
    description: "run only specific test types (or all by default)"
  increment:
    type: boolean
    required: true
    description: If true, compares build graphs between the current and previous commits to find a list of test suites to run. Otherwise, runs all tests.
  folder_prefix:
    type: string
    default: "ya-"
  put_build_results_to_cache:
    type: boolean
    default: true
  additional_ya_make_args:
    type: string
    default: ""
  test_retry_count:
    default: ""
    description: "how many times to retry failed tests"
  secs:
    type: string
    default: ""
  vars:
    type: string
    default: ""
  custom_branch_name:
    description: "Custom branch name required when workflow branch != checkout branch"
    type: string
    required: false
  add_vcs_info:
    type: boolean
    default: false
    description: "add ya make vars with git info"
  collect_coredumps:
    type: boolean
    default: false
    description: "Collect coredumps via enabling ulimit -c unlimited"
  pull_number:
    type: string
    required: false
    description: "Pull request number (for workflow_call events)"
defaults:
  run:
    shell: bash
runs:
  using: "composite"
  steps:
    - name: Prepare folder prefix
      id: prepare_prefix
      shell: bash
      run: |
        # Check if custom_branch_name is set and not empty
        if [ -n "${{ inputs.custom_branch_name }}" ]; then
          # Extract and sanitize custom_branch_name
          CUSTOM_BRANCH_NAME="${{ inputs.custom_branch_name }}"
          # Replace all unsupported characters with hyphens
          SANITIZED_NAME="${CUSTOM_BRANCH_NAME//[^a-zA-Z0-9-]/-}"
          # Optionally limit the length to, say, 50 characters
          SANITIZED_NAME="${SANITIZED_NAME:0:50}"
          # Assign the sanitized name to the folder_prefix
          FOLDER_PREFIX="ya-${SANITIZED_NAME}-"
        else
          # If the branch name is not provided, use a default prefix
          FOLDER_PREFIX='ya-'
        fi
        # Output the folder_prefix for use in subsequent steps
        echo "folder_prefix=${FOLDER_PREFIX}" >> $GITHUB_ENV

    - name: Prepare s3cmd
      uses: ./.github/actions/s3cmd
      with:
        s3_bucket: ${{ fromJSON( inputs.vars ).AWS_BUCKET }}
        s3_endpoint: ${{ fromJSON( inputs.vars ).AWS_ENDPOINT }}
        s3_key_id: ${{ fromJSON( inputs.secs ).AWS_KEY_ID }}
        s3_key_secret: ${{ fromJSON( inputs.secs ).AWS_KEY_VALUE }}
        folder_prefix: ${{ env.folder_prefix }}
        build_preset: ${{ inputs.build_preset }}

    - name: Run build and tests
      id: build
      uses: ./.github/actions/test_ya
      with:
        build_target: ${{ inputs.build_target }}
        build_preset: ${{ inputs.build_preset }}
        test_size: ${{ inputs.test_size }}
        test_type: ${{ inputs.test_type }}
        run_tests: ${{ inputs.run_tests }}
        increment: ${{ inputs.increment }}
        link_threads: ${{ inputs.link_threads }}
        additional_ya_make_args: ${{ inputs.additional_ya_make_args }}
        test_threads: ${{ inputs.test_threads }}
        bazel_remote_uri: ${{  fromJSON( inputs.vars ).REMOTE_CACHE_URL || '' }}
        bazel_remote_username: ${{ fromJSON( inputs.secs ).REMOTE_CACHE_USERNAME || '' }}
        bazel_remote_password: ${{ fromJSON( inputs.secs ).REMOTE_CACHE_PASSWORD || '' }}
        put_build_results_to_cache: ${{ inputs.put_build_results_to_cache }}
        test_retry_count: ${{ inputs.test_retry_count }}
        custom_branch_name: ${{ inputs.custom_branch_name }}
        add_vcs_info: ${{ inputs.add_vcs_info }}
        telegram_ydbot_token:  ${{ fromJSON( inputs.secs ).YDBOT_TELEGRAM_BOT_TOKEN || '' }}
        telegram_alert_logins: ${{ fromJSON( inputs.vars ).GH_ALERTS_TG_LOGINS || '' }}
        telegram_alert_chat: ${{ fromJSON( inputs.vars ).GH_ALERTS_TG_CHAT || '' }}
        collect_coredumps: ${{ inputs.collect_coredumps }}
        pull_number: ${{ inputs.pull_number }}