2023-11-06 17:59:13 +00:00
|
|
|
### For the pure soul wishes to move it to another place
|
|
|
|
# https://github.com/orgs/community/discussions/9050
|
|
|
|
|
2023-11-13 10:06:03 +00:00
|
|
|
env:
|
|
|
|
# Force the stdout and stderr streams to be unbuffered
|
|
|
|
PYTHONUNBUFFERED: 1
|
|
|
|
|
2023-11-06 17:59:13 +00:00
|
|
|
name: Build ClickHouse
|
|
|
|
'on':
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
build_name:
|
|
|
|
description: the value of build type from tests/ci/ci_config.py
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
checkout_depth:
|
|
|
|
description: the value of the git shallow checkout
|
|
|
|
required: false
|
|
|
|
type: number
|
|
|
|
default: 1
|
|
|
|
runner_type:
|
|
|
|
description: the label of runner to use
|
|
|
|
default: builder
|
|
|
|
type: string
|
2023-12-18 08:07:22 +00:00
|
|
|
data:
|
|
|
|
description: json ci data
|
|
|
|
type: string
|
|
|
|
required: true
|
2024-02-09 12:21:11 +00:00
|
|
|
force:
|
|
|
|
description: disallow job skipping
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2023-11-06 17:59:13 +00:00
|
|
|
additional_envs:
|
|
|
|
description: additional ENV variables to setup the job
|
|
|
|
type: string
|
2024-05-24 15:30:36 +00:00
|
|
|
secrets:
|
|
|
|
secret_envs:
|
|
|
|
description: if given, it's passed to the environments
|
|
|
|
required: false
|
2023-11-06 17:59:13 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
Build:
|
|
|
|
name: Build-${{inputs.build_name}}
|
2024-02-09 12:21:11 +00:00
|
|
|
if: ${{ contains(fromJson(inputs.data).jobs_data.jobs_to_do, inputs.build_name) || inputs.force }}
|
2023-11-10 16:47:40 +00:00
|
|
|
env:
|
|
|
|
GITHUB_JOB_OVERRIDDEN: Build-${{inputs.build_name}}
|
2023-11-06 17:59:13 +00:00
|
|
|
runs-on: [self-hosted, '${{inputs.runner_type}}']
|
|
|
|
steps:
|
|
|
|
- name: Check out repository code
|
2024-03-15 12:46:15 +00:00
|
|
|
uses: ClickHouse/checkout@v1
|
2023-11-06 17:59:13 +00:00
|
|
|
with:
|
|
|
|
clear-repository: true
|
2023-12-18 08:07:22 +00:00
|
|
|
ref: ${{ fromJson(inputs.data).git_ref }}
|
2023-11-06 17:59:13 +00:00
|
|
|
submodules: true
|
|
|
|
fetch-depth: ${{inputs.checkout_depth}}
|
|
|
|
filter: tree:0
|
|
|
|
- name: Set build envs
|
|
|
|
run: |
|
|
|
|
cat >> "$GITHUB_ENV" << 'EOF'
|
|
|
|
${{inputs.additional_envs}}
|
2024-05-24 15:30:36 +00:00
|
|
|
${{secrets.secret_envs}}
|
2023-12-18 08:07:22 +00:00
|
|
|
DOCKER_TAG<<DOCKER_JSON
|
|
|
|
${{ toJson(fromJson(inputs.data).docker_data.images) }}
|
|
|
|
DOCKER_JSON
|
2023-11-06 17:59:13 +00:00
|
|
|
EOF
|
2023-11-08 11:52:19 +00:00
|
|
|
python3 "$GITHUB_WORKSPACE"/tests/ci/ci_config.py --build-name "${{inputs.build_name}}" >> "$GITHUB_ENV"
|
|
|
|
- name: Apply sparse checkout for contrib # in order to check that it doesn't break build
|
|
|
|
# This step is done in GITHUB_WORKSPACE,
|
|
|
|
# because it's broken in REPO_COPY for some reason
|
2024-01-18 18:21:26 +00:00
|
|
|
# See also update-submodules.sh
|
2023-11-08 11:52:19 +00:00
|
|
|
if: ${{ env.BUILD_SPARSE_CHECKOUT == 'true' }}
|
|
|
|
run: |
|
|
|
|
rm -rf "$GITHUB_WORKSPACE/contrib" && echo 'removed'
|
|
|
|
git -C "$GITHUB_WORKSPACE" checkout . && echo 'restored'
|
|
|
|
"$GITHUB_WORKSPACE/contrib/update-submodules.sh" && echo 'OK'
|
|
|
|
du -hs "$GITHUB_WORKSPACE/contrib" ||:
|
|
|
|
find "$GITHUB_WORKSPACE/contrib" -type f | wc -l ||:
|
2023-11-06 17:59:13 +00:00
|
|
|
- name: Common setup
|
|
|
|
uses: ./.github/actions/common_setup
|
|
|
|
with:
|
|
|
|
job_type: build_check
|
2023-12-18 08:07:22 +00:00
|
|
|
- name: Pre
|
|
|
|
run: |
|
|
|
|
python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(inputs.data) }} --pre --job-name '${{inputs.build_name}}'
|
2024-01-04 15:35:09 +00:00
|
|
|
- name: Run
|
2023-11-06 17:59:13 +00:00
|
|
|
run: |
|
2024-01-04 15:35:09 +00:00
|
|
|
python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" \
|
|
|
|
--infile ${{ toJson(inputs.data) }} \
|
|
|
|
--job-name "$BUILD_NAME" \
|
2024-02-09 12:21:11 +00:00
|
|
|
--run \
|
|
|
|
${{ inputs.force && '--force' || '' }}
|
2023-12-18 08:07:22 +00:00
|
|
|
- name: Post
|
2023-12-21 20:30:40 +00:00
|
|
|
# it still be build report to upload for failed build job
|
2024-01-04 15:35:09 +00:00
|
|
|
if: ${{ !cancelled() }}
|
2023-12-18 08:07:22 +00:00
|
|
|
run: |
|
|
|
|
python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(inputs.data) }} --post --job-name '${{inputs.build_name}}'
|
|
|
|
- name: Mark as done
|
2024-02-04 19:12:37 +00:00
|
|
|
if: ${{ !cancelled() }}
|
2023-12-18 08:07:22 +00:00
|
|
|
run: |
|
|
|
|
python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ toJson(inputs.data) }} --mark-success --job-name '${{inputs.build_name}}'
|
2023-11-06 17:59:13 +00:00
|
|
|
- name: Clean
|
2023-11-13 06:41:17 +00:00
|
|
|
if: always()
|
2023-11-06 17:59:13 +00:00
|
|
|
uses: ./.github/actions/clean
|