ClickHouse/.github/workflows/pull_request.yml

213 lines
8.3 KiB
YAML
Raw Normal View History

# yamllint disable rule:comments-indentation
name: PullRequestCI
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
# 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:
RunConfig:
runs-on: [self-hosted, style-checker-aarch64]
outputs:
data: ${{ steps.runconfig.outputs.CI_DATA }}
2021-09-15 12:10:19 +00:00
steps:
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
with:
clear-repository: true # to ensure correct digests
2024-05-24 08:53:19 +00:00
fetch-depth: 0 # to get a version
filter: tree:0
2024-09-13 15:20:49 +00:00
- name: Debug Info
uses: ./.github/actions/debug
- name: Set pending Sync status
run: |
python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --set-pending-status
2021-09-15 12:10:19 +00:00
- name: Labels check
2021-10-25 14:36:21 +00:00
run: |
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"
echo "Testing the main ci directory"
python3 -m unittest discover -s . -p 'test_*.py'
- name: PrepareRunConfig
id: runconfig
run: |
python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --configure --outfile ${{ runner.temp }}/ci_run_data.json
echo "::group::CI configuration"
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: |
python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ runner.temp }}/ci_run_data.json --update-gh-statuses
BuildDockers:
needs: [RunConfig]
if: ${{ !failure() && !cancelled() && toJson(fromJson(needs.RunConfig.outputs.data).docker_data.missing_multi) != '[]' }}
2024-07-14 19:07:41 +00:00
uses: ./.github/workflows/docker_test_images.yml
with:
data: ${{ needs.RunConfig.outputs.data }}
2021-12-14 12:46:19 +00:00
StyleCheck:
needs: [RunConfig, BuildDockers]
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'Style check')}}
uses: ./.github/workflows/reusable_test.yml
with:
test_name: Style check
2024-05-24 08:53:19 +00:00
runner_type: style-checker-aarch64
run_command: |
2021-12-14 12:46:19 +00:00
python3 style_check.py
data: ${{ needs.RunConfig.outputs.data }}
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]
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'Fast test') }}
uses: ./.github/workflows/reusable_test.yml
with:
2024-01-30 17:29:55 +00:00
test_name: Fast test
runner_type: builder
data: ${{ needs.RunConfig.outputs.data }}
run_command: |
python3 fast_test_check.py
2024-05-24 08:53:19 +00:00
################################# Main stages #################################
# for main CI chain
#
Builds_1:
2024-04-17 20:37:27 +00:00
needs: [RunConfig, StyleCheck, FastTest]
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Builds_1') }}
2024-05-24 08:53:19 +00:00
# using callable wf (reusable_stage.yml) allows grouping all nested jobs under a tab
uses: ./.github/workflows/reusable_build_stage.yml
with:
stage: Builds_1
data: ${{ needs.RunConfig.outputs.data }}
Tests_1:
needs: [RunConfig, Builds_1]
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_1') }}
uses: ./.github/workflows/reusable_test_stage.yml
with:
stage: Tests_1
data: ${{ needs.RunConfig.outputs.data }}
Builds_2:
needs: [RunConfig, Builds_1]
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Builds_2') }}
uses: ./.github/workflows/reusable_build_stage.yml
with:
stage: Builds_2
data: ${{ needs.RunConfig.outputs.data }}
# stage for running non-required checks without being blocked by required checks (Test_1) if corresponding settings is selected
2024-07-25 10:12:37 +00:00
Tests_2_ww:
needs: [RunConfig, Builds_1]
2024-07-25 10:12:37 +00:00
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_2_ww') }}
uses: ./.github/workflows/reusable_test_stage.yml
with:
2024-07-25 10:12:37 +00:00
stage: Tests_2_ww
data: ${{ needs.RunConfig.outputs.data }}
2024-07-25 10:12:37 +00:00
Tests_2:
2024-06-19 10:21:26 +00:00
needs: [RunConfig, Builds_1, Tests_1]
2024-07-25 10:12:37 +00:00
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_2') }}
2024-05-18 16:00:32 +00:00
uses: ./.github/workflows/reusable_test_stage.yml
with:
2024-07-25 10:12:37 +00:00
stage: Tests_2
2024-05-18 16:00:32 +00:00
data: ${{ needs.RunConfig.outputs.data }}
################################# Reports #################################
2024-06-10 09:18:03 +00:00
# Reports should run even if Builds_1/2 fail - run them separately (not in Tests_1/2/3)
Builds_Report:
# run report check for failed builds to indicate the CI error
2024-08-01 09:57:54 +00:00
if: ${{ !cancelled()
&& needs.RunConfig.result == 'success'
&& needs.StyleCheck.result != 'failure'
&& needs.FastTest.result != 'failure'
&& needs.BuildDockers.result != 'failure'
&& contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'Builds') }}
needs: [RunConfig, BuildDockers, StyleCheck, FastTest, Builds_1, Builds_2]
uses: ./.github/workflows/reusable_test.yml
with:
test_name: Builds
runner_type: style-checker-aarch64
data: ${{ needs.RunConfig.outputs.data }}
2024-05-18 16:00:32 +00:00
CheckReadyForMerge:
if: ${{ !cancelled() }}
# Test_2 or Test_3 do not have the jobs required for Mergeable check,
# however, set them as "needs" to get all checks results before the automatic merge occurs.
2024-07-25 10:12:37 +00:00
needs: [RunConfig, BuildDockers, StyleCheck, FastTest, Builds_1, Builds_2, Builds_Report, Tests_1, Tests_2_ww, Tests_2]
2024-05-18 16:00:32 +00:00
runs-on: [self-hosted, style-checker-aarch64]
steps:
- name: Check out repository code
uses: ClickHouse/checkout@v1
with:
filter: tree:0
- name: Check and set merge status
if: ${{ needs.StyleCheck.result == 'success' }}
2024-05-18 16:00:32 +00:00
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
2024-07-25 09:32:59 +00:00
export WORKFLOW_RESULT_FILE="/tmp/workflow_results.json"
cat > "$WORKFLOW_RESULT_FILE" << 'EOF'
${{ toJson(needs) }}
EOF
python3 merge_pr.py --set-ci-status
- name: Check Workflow results
2024-08-02 07:23:40 +00:00
uses: ./.github/actions/check_workflow
with:
needs: ${{ toJson(needs) }}
2024-05-18 16:00:32 +00:00
################################# Stage Final #################################
#
2021-12-14 12:46:19 +00:00
FinishCheck:
if: ${{ !failure() && !cancelled() }}
2024-07-25 10:12:37 +00:00
needs: [RunConfig, BuildDockers, StyleCheck, FastTest, Builds_1, Builds_2, Builds_Report, Tests_1, Tests_2_ww, Tests_2]
2024-05-24 08:53:19 +00:00
runs-on: [self-hosted, style-checker-aarch64]
2021-12-14 12:46:19 +00:00
steps:
- name: Check out repository code
2022-12-23 16:54:19 +00:00
uses: ClickHouse/checkout@v1
2024-05-18 16:00:32 +00:00
with:
filter: tree:0
2021-12-14 12:46:19 +00:00
- name: Finish label
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
2024-06-13 20:15:39 +00:00
python3 finish_check.py --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
2023-11-11 00:20:02 +00:00
#############################################################################################
###################################### JEPSEN TESTS #########################################
#############################################################################################
# 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:
# we need concurrency as the job uses dedicated instances in the cloud
concurrency:
group: jepsen
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'ClickHouse Keeper Jepsen') }}
2024-06-19 10:21:26 +00:00
needs: [RunConfig, Builds_1]
uses: ./.github/workflows/reusable_test.yml
with:
test_name: ClickHouse Keeper Jepsen
2024-05-24 08:53:19 +00:00
runner_type: style-checker-aarch64
data: ${{ needs.RunConfig.outputs.data }}