2023-11-06 17:59:13 +00:00
|
|
|
# yamllint disable rule:comments-indentation
|
2021-12-17 13:15:56 +00:00
|
|
|
name: PullRequestCI
|
2021-12-15 19:47:08 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
# Force the stdout and stderr streams to be unbuffered
|
|
|
|
PYTHONUNBUFFERED: 1
|
|
|
|
|
2022-03-31 11:11:49 +00:00
|
|
|
on: # yamllint disable-line rule:truthy
|
2021-09-10 09:12:11 +00:00
|
|
|
pull_request:
|
2021-09-15 13:31:57 +00:00
|
|
|
types:
|
|
|
|
- synchronize
|
|
|
|
- reopened
|
|
|
|
- opened
|
2021-09-10 09:12:11 +00:00
|
|
|
branches:
|
|
|
|
- master
|
2024-02-26 14:52:05 +00:00
|
|
|
|
2024-05-14 11:07:17 +00:00
|
|
|
# Cancel the previous wf run in PRs.
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-11-15 14:41:15 +00:00
|
|
|
jobs:
|
2023-12-18 08:07:22 +00:00
|
|
|
RunConfig:
|
2024-02-21 16:59:41 +00:00
|
|
|
runs-on: [self-hosted, style-checker-aarch64]
|
2023-12-18 08:07:22 +00:00
|
|
|
outputs:
|
|
|
|
data: ${{ steps.runconfig.outputs.CI_DATA }}
|
2021-09-15 12:10:19 +00:00
|
|
|
steps:
|
2024-05-11 10:22:41 +00:00
|
|
|
- name: DebugInfo
|
|
|
|
uses: hmarr/debug-action@f7318c783045ac39ed9bb497e22ce835fdafbfe6
|
2021-09-15 13:02:09 +00:00
|
|
|
- name: Check out repository code
|
2022-12-23 16:54:19 +00:00
|
|
|
uses: ClickHouse/checkout@v1
|
2022-12-19 18:08:00 +00:00
|
|
|
with:
|
2023-12-18 08:07:22 +00:00
|
|
|
clear-repository: true # to ensure correct digests
|
|
|
|
fetch-depth: 0 # to get version
|
|
|
|
filter: tree:0
|
2021-09-15 12:10:19 +00:00
|
|
|
- name: Labels check
|
2021-10-25 14:36:21 +00:00
|
|
|
run: |
|
2022-01-13 18:06:35 +00:00
|
|
|
cd "$GITHUB_WORKSPACE/tests/ci"
|
2021-10-25 14:36:21 +00:00
|
|
|
python3 run_check.py
|
2022-01-18 21:33:53 +00:00
|
|
|
- name: Python unit tests
|
|
|
|
run: |
|
|
|
|
cd "$GITHUB_WORKSPACE/tests/ci"
|
2023-05-22 21:07:35 +00:00
|
|
|
echo "Testing the main ci directory"
|
2023-11-06 10:14:57 +00:00
|
|
|
python3 -m unittest discover -s . -p 'test_*.py'
|
2023-05-22 21:07:35 +00:00
|
|
|
for dir in *_lambda/; do
|
|
|
|
echo "Testing $dir"
|
2023-11-06 10:14:57 +00:00
|
|
|
python3 -m unittest discover -s "$dir" -p 'test_*.py'
|
2023-05-22 21:07:35 +00:00
|
|
|
done
|
2023-12-18 08:07:22 +00:00
|
|
|
- name: PrepareRunConfig
|
|
|
|
id: runconfig
|
2021-12-24 08:59:03 +00:00
|
|
|
run: |
|
2023-12-18 08:07:22 +00:00
|
|
|
python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --configure --outfile ${{ runner.temp }}/ci_run_data.json
|
|
|
|
|
2024-01-04 15:35:09 +00:00
|
|
|
echo "::group::CI configuration"
|
2023-12-18 08:07:22 +00:00
|
|
|
python3 -m json.tool ${{ runner.temp }}/ci_run_data.json
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
{
|
|
|
|
echo 'CI_DATA<<EOF'
|
|
|
|
cat ${{ runner.temp }}/ci_run_data.json
|
|
|
|
echo 'EOF'
|
|
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Re-create GH statuses for skipped jobs if any
|
2021-10-25 14:36:21 +00:00
|
|
|
run: |
|
2023-12-18 08:07:22 +00:00
|
|
|
python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ runner.temp }}/ci_run_data.json --update-gh-statuses
|
|
|
|
BuildDockers:
|
|
|
|
needs: [RunConfig]
|
2024-02-26 14:52:05 +00:00
|
|
|
if: ${{ !failure() && !cancelled() && toJson(fromJson(needs.RunConfig.outputs.data).docker_data.missing_multi) != '[]' }}
|
2023-12-18 08:07:22 +00:00
|
|
|
uses: ./.github/workflows/reusable_docker.yml
|
|
|
|
with:
|
|
|
|
data: ${{ needs.RunConfig.outputs.data }}
|
2021-12-14 12:46:19 +00:00
|
|
|
StyleCheck:
|
2023-12-18 08:07:22 +00:00
|
|
|
needs: [RunConfig, BuildDockers]
|
2024-02-26 14:52:05 +00:00
|
|
|
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'Style check')}}
|
2023-11-10 20:16:54 +00:00
|
|
|
uses: ./.github/workflows/reusable_test.yml
|
|
|
|
with:
|
|
|
|
test_name: Style check
|
|
|
|
runner_type: style-checker
|
|
|
|
run_command: |
|
2021-12-14 12:46:19 +00:00
|
|
|
python3 style_check.py
|
2023-12-18 08:07:22 +00:00
|
|
|
data: ${{ needs.RunConfig.outputs.data }}
|
2023-11-10 20:16:54 +00:00
|
|
|
secrets:
|
|
|
|
secret_envs: |
|
|
|
|
ROBOT_CLICKHOUSE_SSH_KEY<<RCSK
|
|
|
|
${{secrets.ROBOT_CLICKHOUSE_SSH_KEY}}
|
|
|
|
RCSK
|
2021-12-14 12:46:19 +00:00
|
|
|
FastTest:
|
2024-04-29 13:47:08 +00:00
|
|
|
needs: [RunConfig, BuildDockers, StyleCheck]
|
2024-02-26 14:52:05 +00:00
|
|
|
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'Fast test') }}
|
2023-11-10 23:16:22 +00:00
|
|
|
uses: ./.github/workflows/reusable_test.yml
|
|
|
|
with:
|
2024-01-30 17:29:55 +00:00
|
|
|
test_name: Fast test
|
2023-11-10 23:16:22 +00:00
|
|
|
runner_type: builder
|
2023-12-18 08:07:22 +00:00
|
|
|
data: ${{ needs.RunConfig.outputs.data }}
|
2023-11-10 23:16:22 +00:00
|
|
|
run_command: |
|
|
|
|
python3 fast_test_check.py
|
2024-02-26 14:52:05 +00:00
|
|
|
|
|
|
|
################################# Main statges #################################
|
|
|
|
# for main CI chain
|
|
|
|
#
|
|
|
|
Builds_1:
|
2024-04-17 20:37:27 +00:00
|
|
|
needs: [RunConfig, StyleCheck, FastTest]
|
2024-02-26 14:52:05 +00:00
|
|
|
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Builds_1') }}
|
|
|
|
# using callable wf (reusable_stage.yml) allows to group all nested jobs under a tab
|
|
|
|
uses: ./.github/workflows/reusable_build_stage.yml
|
2023-11-06 17:59:13 +00:00
|
|
|
with:
|
2024-02-26 14:52:05 +00:00
|
|
|
stage: Builds_1
|
2023-12-18 08:07:22 +00:00
|
|
|
data: ${{ needs.RunConfig.outputs.data }}
|
2024-02-26 14:52:05 +00:00
|
|
|
Tests_1:
|
|
|
|
needs: [RunConfig, Builds_1]
|
|
|
|
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_1') }}
|
|
|
|
# using callable wf (reusable_stage.yml) allows to group all nested jobs under a tab
|
|
|
|
uses: ./.github/workflows/reusable_test_stage.yml
|
2023-11-06 17:59:13 +00:00
|
|
|
with:
|
2024-02-26 14:52:05 +00:00
|
|
|
stage: Tests_1
|
2023-12-18 08:07:22 +00:00
|
|
|
data: ${{ needs.RunConfig.outputs.data }}
|
2024-02-26 14:52:05 +00:00
|
|
|
Builds_2:
|
|
|
|
needs: [RunConfig, Builds_1]
|
|
|
|
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Builds_2') }}
|
|
|
|
# using callable wf (reusable_stage.yml) allows to group all nested jobs under a tab
|
|
|
|
uses: ./.github/workflows/reusable_build_stage.yml
|
2023-12-18 08:07:22 +00:00
|
|
|
with:
|
2024-02-26 14:52:05 +00:00
|
|
|
stage: Builds_2
|
2023-12-18 08:07:22 +00:00
|
|
|
data: ${{ needs.RunConfig.outputs.data }}
|
2024-02-26 14:52:05 +00:00
|
|
|
Tests_2:
|
|
|
|
needs: [RunConfig, Builds_2]
|
|
|
|
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_2') }}
|
|
|
|
# using callable wf (reusable_stage.yml) allows to group all nested jobs under a tab
|
|
|
|
uses: ./.github/workflows/reusable_test_stage.yml
|
2024-01-30 17:56:49 +00:00
|
|
|
with:
|
2024-02-26 14:52:05 +00:00
|
|
|
stage: Tests_2
|
2024-01-30 17:56:49 +00:00
|
|
|
data: ${{ needs.RunConfig.outputs.data }}
|
2024-02-26 14:52:05 +00:00
|
|
|
|
|
|
|
################################# Reports #################################
|
|
|
|
# Reports should by run even if Builds_1/2 fail, so put them separatly in wf (not in Tests_1/2)
|
|
|
|
Builds_1_Report:
|
2023-12-21 20:30:40 +00:00
|
|
|
# run report check for failed builds to indicate the CI error
|
2024-02-26 14:52:05 +00:00
|
|
|
if: ${{ !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'ClickHouse build check') }}
|
2021-12-14 12:46:19 +00:00
|
|
|
needs:
|
2023-12-18 08:07:22 +00:00
|
|
|
- RunConfig
|
2024-02-26 14:52:05 +00:00
|
|
|
- Builds_1
|
2023-11-12 09:12:04 +00:00
|
|
|
uses: ./.github/workflows/reusable_test.yml
|
|
|
|
with:
|
|
|
|
test_name: ClickHouse build check
|
2024-02-26 14:52:05 +00:00
|
|
|
runner_type: style-checker-aarch64
|
2023-12-18 08:07:22 +00:00
|
|
|
data: ${{ needs.RunConfig.outputs.data }}
|
2024-02-26 14:52:05 +00:00
|
|
|
Builds_2_Report:
|
2023-12-21 20:30:40 +00:00
|
|
|
# run report check for failed builds to indicate the CI error
|
2024-02-26 14:52:05 +00:00
|
|
|
if: ${{ !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'ClickHouse special build check') }}
|
2021-12-14 12:46:19 +00:00
|
|
|
needs:
|
2023-12-18 08:07:22 +00:00
|
|
|
- RunConfig
|
2024-02-26 14:52:05 +00:00
|
|
|
- Builds_2
|
2023-11-12 09:12:04 +00:00
|
|
|
uses: ./.github/workflows/reusable_test.yml
|
|
|
|
with:
|
|
|
|
test_name: ClickHouse special build check
|
2023-11-09 09:59:29 +00:00
|
|
|
runner_type: style-checker-aarch64
|
2023-12-18 08:07:22 +00:00
|
|
|
data: ${{ needs.RunConfig.outputs.data }}
|
2024-02-26 14:52:05 +00:00
|
|
|
|
|
|
|
################################# Stage Final #################################
|
|
|
|
#
|
2021-12-14 12:46:19 +00:00
|
|
|
FinishCheck:
|
2024-04-11 11:58:44 +00:00
|
|
|
if: ${{ !failure() && !cancelled() }}
|
2024-04-25 11:28:06 +00:00
|
|
|
needs: [RunConfig, BuildDockers, StyleCheck, FastTest, Builds_1, Builds_2, Builds_1_Report, Builds_2_Report, Tests_1, Tests_2]
|
2021-12-14 12:46:19 +00:00
|
|
|
runs-on: [self-hosted, style-checker]
|
|
|
|
steps:
|
|
|
|
- name: Check out repository code
|
2022-12-23 16:54:19 +00:00
|
|
|
uses: ClickHouse/checkout@v1
|
2021-12-14 12:46:19 +00:00
|
|
|
- name: Finish label
|
|
|
|
run: |
|
2022-01-13 18:06:35 +00:00
|
|
|
cd "$GITHUB_WORKSPACE/tests/ci"
|
2024-04-29 13:47:08 +00:00
|
|
|
python3 finish_check.py
|
|
|
|
# FIXME: merge on approval does not work with MQ. Could be fixed by using defaul GH's automerge after some corrections in Mergeable Check status
|
|
|
|
# - name: Auto merge if approved
|
|
|
|
# if: ${{ github.event_name != 'merge_group' }}
|
|
|
|
# run: |
|
|
|
|
# cd "$GITHUB_WORKSPACE/tests/ci"
|
|
|
|
# python3 merge_pr.py --check-approved
|
2024-02-26 14:52:05 +00:00
|
|
|
|
|
|
|
|
2023-11-11 00:20:02 +00:00
|
|
|
#############################################################################################
|
|
|
|
###################################### JEPSEN TESTS #########################################
|
|
|
|
#############################################################################################
|
2024-01-16 18:12:09 +00:00
|
|
|
# This is special test NOT INCLUDED in FinishCheck
|
|
|
|
# When it's skipped, all dependent tasks will be skipped too.
|
|
|
|
# DO NOT add it there
|
2023-11-11 00:20:02 +00:00
|
|
|
Jepsen:
|
2024-01-16 18:12:09 +00:00
|
|
|
# we need concurrency as the job uses dedicated instances in the cloud
|
|
|
|
concurrency:
|
|
|
|
group: jepsen
|
2024-02-26 14:52:05 +00:00
|
|
|
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'ClickHouse Keeper Jepsen') }}
|
|
|
|
# jepsen needs binary_release build which is in Builds_2
|
|
|
|
needs: [RunConfig, Builds_2]
|
2024-01-16 18:12:09 +00:00
|
|
|
uses: ./.github/workflows/reusable_test.yml
|
|
|
|
with:
|
|
|
|
test_name: ClickHouse Keeper Jepsen
|
|
|
|
runner_type: style-checker
|
|
|
|
data: ${{ needs.RunConfig.outputs.data }}
|