Merge pull request #75791 from ClickHouse/play-minor-adjustmend #43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # yamllint disable rule:comments-indentation | |
| name: MasterCI | |
| env: | |
| # Force the stdout and stderr streams to be unbuffered | |
| PYTHONUNBUFFERED: 1 | |
| on: # yamllint disable-line rule:truthy | |
| push: | |
| branches: | |
| - 'master' | |
| jobs: | |
| RunConfig: | |
| runs-on: [self-hosted, style-checker-aarch64] | |
| outputs: | |
| data: ${{ steps.runconfig.outputs.CI_DATA }} | |
| steps: | |
| - name: Check out repository code | |
| uses: ClickHouse/checkout@v1 | |
| with: | |
| clear-repository: true # to ensure correct digests | |
| fetch-depth: 0 # to get version | |
| filter: tree:0 | |
| - name: Debug Info | |
| uses: ./.github/actions/debug | |
| - name: Merge sync PR | |
| run: | | |
| cd "$GITHUB_WORKSPACE/tests/ci" | |
| python3 sync_pr.py --merge || : | |
| - 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 | |
| run: | | |
| python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ runner.temp }}/ci_run_data.json --update-gh-statuses | |
| Builds_0: | |
| needs: [RunConfig] | |
| if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Builds_0') }} | |
| uses: ./.github/workflows/reusable_build_stage.yml | |
| with: | |
| stage: Builds_0 | |
| data: ${{ needs.RunConfig.outputs.data }} | |
| Builds_1: | |
| needs: [RunConfig] | |
| if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Builds_1') }} | |
| # 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 }} | |
| 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 }} | |
| Tests_0: | |
| needs: [RunConfig, Builds_0] | |
| if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_0') }} | |
| uses: ./.github/workflows/reusable_test_stage.yml | |
| with: | |
| stage: Tests_0 | |
| 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 }} | |
| Tests_2: | |
| needs: [RunConfig, Builds_1, Builds_0] | |
| if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_2') }} | |
| uses: ./.github/workflows/reusable_test_stage.yml | |
| with: | |
| stage: Tests_2 | |
| data: ${{ needs.RunConfig.outputs.data }} | |
| ################################# Reports ################################# | |
| # 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 | |
| if: ${{ !cancelled() && needs.RunConfig.result == 'success' && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'Builds') }} | |
| needs: [RunConfig, Builds_1, Builds_2, Builds_0] | |
| uses: ./.github/workflows/reusable_test.yml | |
| with: | |
| test_name: Builds | |
| runner_type: style-checker-aarch64 | |
| data: ${{ needs.RunConfig.outputs.data }} | |
| FinishCheck: | |
| if: ${{ !cancelled() }} | |
| needs: [RunConfig, Builds_0, Builds_1, Builds_2, Builds_Report, Tests_1, Tests_2] | |
| runs-on: [self-hosted, style-checker-aarch64] | |
| steps: | |
| - name: Check out repository code | |
| uses: ClickHouse/checkout@v1 | |
| - name: Finish label | |
| run: | | |
| cd "$GITHUB_WORKSPACE/tests/ci" | |
| python3 finish_check.py --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }} | |
| - name: Check Workflow results | |
| if: ${{ !cancelled() }} | |
| run: | | |
| export WORKFLOW_RESULT_FILE="/tmp/workflow_results.json" | |
| cat > "$WORKFLOW_RESULT_FILE" << 'EOF' | |
| ${{ toJson(needs) }} | |
| EOF | |
| python3 ./tests/ci/ci_buddy.py --check-wf-status |