ClickHouse
98 строк · 3.5 Кб
1### For the pure soul wishes to move it to another place
2# https://github.com/orgs/community/discussions/9050
3
4env:5# Force the stdout and stderr streams to be unbuffered6PYTHONUNBUFFERED: 17
8name: Build ClickHouse9'on':10workflow_call:11inputs:12build_name:13description: the value of build type from tests/ci/ci_config.py14required: true15type: string16checkout_depth:17description: the value of the git shallow checkout18required: false19type: number20default: 121runner_type:22description: the label of runner to use23default: builder24type: string25data:26description: json ci data27type: string28required: true29force:30description: disallow job skipping31type: boolean32default: false33additional_envs:34description: additional ENV variables to setup the job35type: string36
37jobs:38Build:39name: Build-${{inputs.build_name}}40if: ${{ contains(fromJson(inputs.data).jobs_data.jobs_to_do, inputs.build_name) || inputs.force }}41env:42GITHUB_JOB_OVERRIDDEN: Build-${{inputs.build_name}}43runs-on: [self-hosted, '${{inputs.runner_type}}']44steps:45- name: Check out repository code46uses: ClickHouse/checkout@v147with:48clear-repository: true49ref: ${{ fromJson(inputs.data).git_ref }}50submodules: true51fetch-depth: ${{inputs.checkout_depth}}52filter: tree:053- name: Set build envs54run: |55cat >> "$GITHUB_ENV" << 'EOF'
56${{inputs.additional_envs}}
57DOCKER_TAG<<DOCKER_JSON
58${{ toJson(fromJson(inputs.data).docker_data.images) }}
59DOCKER_JSON
60EOF
61python3 "$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 build63# This step is done in GITHUB_WORKSPACE,64# because it's broken in REPO_COPY for some reason65# See also update-submodules.sh66if: ${{ env.BUILD_SPARSE_CHECKOUT == 'true' }}67run: |68rm -rf "$GITHUB_WORKSPACE/contrib" && echo 'removed'
69git -C "$GITHUB_WORKSPACE" checkout . && echo 'restored'
70"$GITHUB_WORKSPACE/contrib/update-submodules.sh" && echo 'OK'
71du -hs "$GITHUB_WORKSPACE/contrib" ||:
72find "$GITHUB_WORKSPACE/contrib" -type f | wc -l ||:
73- name: Common setup74uses: ./.github/actions/common_setup75with:76job_type: build_check77- name: Pre78run: |79python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(inputs.data) }} --pre --job-name '${{inputs.build_name}}'
80- name: Run81run: |82python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" \
83--infile ${{ toJson(inputs.data) }} \
84--job-name "$BUILD_NAME" \
85--run \
86${{ inputs.force && '--force' || '' }}
87- name: Post88# it still be build report to upload for failed build job89if: ${{ !cancelled() }}90run: |91python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(inputs.data) }} --post --job-name '${{inputs.build_name}}'
92- name: Mark as done93if: ${{ !cancelled() }}94run: |95python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(inputs.data) }} --mark-success --job-name '${{inputs.build_name}}'
96- name: Clean97if: always()98uses: ./.github/actions/clean99