mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
101 lines
3.2 KiB
YAML
101 lines
3.2 KiB
YAML
### For the pure soul wishes to move it to another place
|
|
# https://github.com/orgs/community/discussions/9050
|
|
|
|
name: Testing workflow
|
|
'on':
|
|
workflow_call:
|
|
inputs:
|
|
test_name:
|
|
description: the value of test type from tests/ci/ci_config.py, ends up as $CHECK_NAME ENV
|
|
required: true
|
|
type: string
|
|
runner_type:
|
|
description: the label of runner to use
|
|
required: true
|
|
type: string
|
|
run_command:
|
|
description: the command to launch the check. Usually starts with `cd '$REPO_COPY/tests/ci'`
|
|
required: true
|
|
type: string
|
|
batches:
|
|
description: how many batches for the test will be launched
|
|
default: 1
|
|
type: number
|
|
checkout_depth:
|
|
description: the value of the git shallow checkout
|
|
required: false
|
|
type: number
|
|
default: 1
|
|
submodules:
|
|
description: if the submodules should be checked out
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
additional_envs:
|
|
description: additional ENV variables to setup the job
|
|
type: string
|
|
secrets:
|
|
secret_envs:
|
|
description: if given, it's passed to the environments
|
|
required: false
|
|
|
|
env:
|
|
CHECK_NAME: ${{inputs.test_name}}
|
|
|
|
jobs:
|
|
PrepareStrategy:
|
|
if: ${{inputs.batches > 0}} # batches < 1 is misconfiguration
|
|
runs-on: [self-hosted, style-checker-aarch64]
|
|
outputs:
|
|
batches: ${{steps.batches.outputs.batches}}
|
|
steps:
|
|
- name: Calculate batches
|
|
id: batches
|
|
run: |
|
|
batches_output=$(python3 -c 'import json; print(json.dumps(list(range(${{inputs.batches}}))))')
|
|
echo "batches=${batches_output}" >> "$GITHUB_OUTPUT"
|
|
Test:
|
|
# Do not add `-0` to the end, if there's only one batch
|
|
name: ${{inputs.test_name}}${{ inputs.batches > 1 && format('-{0}',matrix.batch) || '' }}
|
|
env:
|
|
GITHUB_JOB_OVERRIDDEN: ${{inputs.test_name}}${{ inputs.batches > 1 && format('-{0}',matrix.batch) || '' }}
|
|
runs-on: [self-hosted, '${{inputs.runner_type}}']
|
|
needs: [PrepareStrategy]
|
|
strategy:
|
|
fail-fast: false # we always wait for entire matrix
|
|
matrix:
|
|
batch: ${{ fromJson(needs.PrepareStrategy.outputs.batches) }}
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: ClickHouse/checkout@v1
|
|
with:
|
|
clear-repository: true
|
|
submodules: ${{inputs.submodules}}
|
|
fetch-depth: ${{inputs.checkout_depth}}
|
|
filter: tree:0
|
|
- name: Set build envs
|
|
run: |
|
|
cat >> "$GITHUB_ENV" << 'EOF'
|
|
${{inputs.additional_envs}}
|
|
${{secrets.secret_envs}}
|
|
EOF
|
|
- name: Common setup
|
|
uses: ./.github/actions/common_setup
|
|
with:
|
|
job_type: test
|
|
- name: Download json reports
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: ${{ env.REPORTS_PATH }}
|
|
- name: Setup batch
|
|
if: ${{ inputs.batches > 1}}
|
|
run: |
|
|
cat >> "$GITHUB_ENV" << 'EOF'
|
|
RUN_BY_HASH_NUM=${{matrix.batch}}
|
|
RUN_BY_HASH_TOTAL=${{inputs.batches}}
|
|
EOF
|
|
- name: Run test
|
|
run: ${{inputs.run_command}}
|
|
- name: Clean
|
|
uses: ./.github/actions/clean
|