ClickHouse
96 строк · 2.9 Кб
1### For the pure soul wishes to move it to another place
2# https://github.com/orgs/community/discussions/9050
3
4name: Simple job
5'on':
6workflow_call:
7inputs:
8test_name:
9description: the value of test type from tests/ci/ci_config.py, ends up as $CHECK_NAME ENV
10required: true
11type: string
12runner_type:
13description: the label of runner to use
14required: true
15type: string
16run_command:
17description: the command to launch the check
18default: ""
19required: false
20type: string
21checkout_depth:
22description: the value of the git shallow checkout
23required: false
24type: number
25default: 1
26submodules:
27description: if the submodules should be checked out
28required: false
29type: boolean
30default: false
31additional_envs:
32description: additional ENV variables to setup the job
33type: string
34working-directory:
35description: sets custom working directory
36type: string
37default: "$GITHUB_WORKSPACE/tests/ci"
38git_ref:
39description: commit to use, merge commit for pr or head
40required: false
41type: string
42default: ${{ github.event.after }} # no merge commit
43report_required:
44description: set to true if job report with the commit status required
45type: boolean
46default: false
47secrets:
48secret_envs:
49description: if given, it's passed to the environments
50required: false
51
52
53env:
54# Force the stdout and stderr streams to be unbuffered
55PYTHONUNBUFFERED: 1
56CHECK_NAME: ${{inputs.test_name}}
57
58jobs:
59Test:
60runs-on: [self-hosted, '${{inputs.runner_type}}']
61name: ${{inputs.test_name}}
62env:
63GITHUB_JOB_OVERRIDDEN: ${{inputs.test_name}}
64steps:
65- name: DebugInfo
66uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a
67- name: Check out repository code
68uses: ClickHouse/checkout@v1
69with:
70clear-repository: true
71ref: ${{ inputs.git_ref }}
72submodules: ${{inputs.submodules}}
73fetch-depth: ${{inputs.checkout_depth}}
74filter: tree:0
75- name: Set build envs
76run: |
77cat >> "$GITHUB_ENV" << 'EOF'
78CHECK_NAME=${{ inputs.test_name }}
79${{inputs.additional_envs}}
80${{secrets.secret_envs}}
81EOF
82- name: Common setup
83uses: ./.github/actions/common_setup
84with:
85job_type: test
86- name: Run
87run: |
88cd "${{ inputs.working-directory }}"
89${{ inputs.run_command }}
90- name: Post
91if: ${{ inputs.report_required }}
92run: |
93python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --post --job-name '${{inputs.test_name}}'
94- name: Clean
95if: always()
96uses: ./.github/actions/clean
97