ClickHouse

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

4
env:
5
  # Force the stdout and stderr streams to be unbuffered
6
  PYTHONUNBUFFERED: 1
7

8
name: Build ClickHouse
9
'on':
10
  workflow_call:
11
    inputs:
12
      build_name:
13
        description: the value of build type from tests/ci/ci_config.py
14
        required: true
15
        type: string
16
      checkout_depth:
17
        description: the value of the git shallow checkout
18
        required: false
19
        type: number
20
        default: 1
21
      runner_type:
22
        description: the label of runner to use
23
        default: builder
24
        type: string
25
      data:
26
        description: json ci data
27
        type: string
28
        required: true
29
      force:
30
        description: disallow job skipping
31
        type: boolean
32
        default: false
33
      additional_envs:
34
        description: additional ENV variables to setup the job
35
        type: string
36

37
jobs:
38
  Build:
39
    name: Build-${{inputs.build_name}}
40
    if: ${{ contains(fromJson(inputs.data).jobs_data.jobs_to_do, inputs.build_name) || inputs.force }}
41
    env:
42
      GITHUB_JOB_OVERRIDDEN: Build-${{inputs.build_name}}
43
    runs-on: [self-hosted, '${{inputs.runner_type}}']
44
    steps:
45
      - name: Check out repository code
46
        uses: ClickHouse/checkout@v1
47
        with:
48
          clear-repository: true
49
          ref: ${{ fromJson(inputs.data).git_ref }}
50
          submodules: true
51
          fetch-depth: ${{inputs.checkout_depth}}
52
          filter: tree:0
53
      - name: Set build envs
54
        run: |
55
          cat >> "$GITHUB_ENV" << 'EOF'
56
          ${{inputs.additional_envs}}
57
          DOCKER_TAG<<DOCKER_JSON
58
          ${{ toJson(fromJson(inputs.data).docker_data.images) }}
59
          DOCKER_JSON
60
          EOF
61
          python3 "$GITHUB_WORKSPACE"/tests/ci/ci_config.py --build-name "${{inputs.build_name}}" >> "$GITHUB_ENV"
62
      - name: Apply sparse checkout for contrib # in order to check that it doesn't break build
63
        # This step is done in GITHUB_WORKSPACE,
64
        # because it's broken in REPO_COPY for some reason
65
        # See also update-submodules.sh
66
        if: ${{ env.BUILD_SPARSE_CHECKOUT == 'true' }}
67
        run: |
68
          rm -rf "$GITHUB_WORKSPACE/contrib" && echo 'removed'
69
          git -C "$GITHUB_WORKSPACE" checkout .  && echo 'restored'
70
          "$GITHUB_WORKSPACE/contrib/update-submodules.sh" && echo 'OK'
71
          du -hs "$GITHUB_WORKSPACE/contrib" ||:
72
          find "$GITHUB_WORKSPACE/contrib" -type f | wc -l ||:
73
      - name: Common setup
74
        uses: ./.github/actions/common_setup
75
        with:
76
          job_type: build_check
77
      - name: Pre
78
        run: |
79
          python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(inputs.data) }} --pre --job-name '${{inputs.build_name}}'
80
      - name: Run
81
        run: |
82
          python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" \
83
            --infile ${{ toJson(inputs.data) }} \
84
            --job-name "$BUILD_NAME" \
85
            --run \
86
            ${{ inputs.force && '--force' || '' }}
87
      - name: Post
88
        # it still be build report to upload for failed build job
89
        if: ${{ !cancelled() }}
90
        run: |
91
          python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(inputs.data) }} --post --job-name '${{inputs.build_name}}'
92
      - name: Mark as done
93
        if: ${{ !cancelled() }}
94
        run: |
95
          python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(inputs.data) }} --mark-success --job-name '${{inputs.build_name}}'
96
      - name: Clean
97
        if: always()
98
        uses: ./.github/actions/clean
99

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

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

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

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