ClickHouse

Форк
0
/
reusable_simple_job.yml 
96 строк · 2.9 Кб
1
### For the pure soul wishes to move it to another place
2
# https://github.com/orgs/community/discussions/9050
3

4
name: Simple job
5
'on':
6
  workflow_call:
7
    inputs:
8
      test_name:
9
        description: the value of test type from tests/ci/ci_config.py, ends up as $CHECK_NAME ENV
10
        required: true
11
        type: string
12
      runner_type:
13
        description: the label of runner to use
14
        required: true
15
        type: string
16
      run_command:
17
        description: the command to launch the check
18
        default: ""
19
        required: false
20
        type: string
21
      checkout_depth:
22
        description: the value of the git shallow checkout
23
        required: false
24
        type: number
25
        default: 1
26
      submodules:
27
        description: if the submodules should be checked out
28
        required: false
29
        type: boolean
30
        default: false
31
      additional_envs:
32
        description: additional ENV variables to setup the job
33
        type: string
34
      working-directory:
35
        description: sets custom working directory
36
        type: string
37
        default: "$GITHUB_WORKSPACE/tests/ci"
38
      git_ref:
39
        description: commit to use, merge commit for pr or head
40
        required: false
41
        type: string
42
        default: ${{ github.event.after }} # no merge commit
43
      report_required:
44
        description: set to true if job report with the commit status required
45
        type: boolean
46
        default: false
47
    secrets:
48
      secret_envs:
49
        description: if given, it's passed to the environments
50
        required: false
51

52

53
env:
54
  # Force the stdout and stderr streams to be unbuffered
55
  PYTHONUNBUFFERED: 1
56
  CHECK_NAME: ${{inputs.test_name}}
57

58
jobs:
59
  Test:
60
    runs-on: [self-hosted, '${{inputs.runner_type}}']
61
    name: ${{inputs.test_name}}
62
    env:
63
      GITHUB_JOB_OVERRIDDEN: ${{inputs.test_name}}
64
    steps:
65
      - name: DebugInfo
66
        uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a
67
      - name: Check out repository code
68
        uses: ClickHouse/checkout@v1
69
        with:
70
          clear-repository: true
71
          ref: ${{ inputs.git_ref }}
72
          submodules: ${{inputs.submodules}}
73
          fetch-depth: ${{inputs.checkout_depth}}
74
          filter: tree:0
75
      - name: Set build envs
76
        run: |
77
          cat >> "$GITHUB_ENV" << 'EOF'
78
          CHECK_NAME=${{ inputs.test_name }}
79
          ${{inputs.additional_envs}}
80
          ${{secrets.secret_envs}}
81
          EOF
82
      - name: Common setup
83
        uses: ./.github/actions/common_setup
84
        with:
85
          job_type: test
86
      - name: Run
87
        run: |
88
          cd "${{ inputs.working-directory }}"
89
          ${{ inputs.run_command }}
90
      - name: Post
91
        if: ${{ inputs.report_required }}
92
        run: |
93
          python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --post --job-name '${{inputs.test_name}}'
94
      - name: Clean
95
        if: always()
96
        uses: ./.github/actions/clean
97

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.