forked from apache/airflow
-
Notifications
You must be signed in to change notification settings - Fork 18
190 lines (190 loc) · 7.65 KB
/
run-unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
---
name: Unit tests
on: # yamllint disable-line rule:truthy
workflow_call:
inputs:
runs-on-as-json-default:
description: "The array of labels (in json form) determining default runner used for the build."
required: true
type: string
test-groups:
description: "The json representing list of test test groups to run"
required: true
type: string
backend:
description: "The backend to run the tests on"
required: true
type: string
test-scope:
description: "The scope of the test to run: ('DB', 'Non-DB', 'All', 'ARM collection')"
required: true
type: string
test-name:
description: "The name of the test to run"
required: true
type: string
test-name-separator:
description: "The separator to use after the test name"
required: false
default: ":"
type: string
python-versions:
description: "The list of python versions (stringified JSON array) to run the tests on."
required: true
type: string
backend-versions:
description: "The list of backend versions (stringified JSON array) to run the tests on."
required: true
type: string
excluded-providers-as-string:
description: "Excluded providers (per Python version) as json string"
required: true
type: string
excludes:
description: "Excluded combos (stringified JSON array of python-version/backend-version dicts)"
required: true
type: string
core-test-types-list-as-string:
description: "The list of core test types to run separated by spaces"
required: true
type: string
providers-test-types-list-as-string:
description: "The list of providers test types to run separated by spaces"
required: true
type: string
run-migration-tests:
description: "Whether to run migration tests or not (true/false)"
required: false
default: "false"
type: string
run-coverage:
description: "Whether to run coverage or not (true/false)"
required: true
type: string
debug-resources:
description: "Whether to debug resources or not (true/false)"
required: true
type: string
include-success-outputs:
description: "Whether to include success outputs or not (true/false)"
required: false
default: "false"
type: string
downgrade-sqlalchemy:
description: "Whether to downgrade SQLAlchemy or not (true/false)"
required: false
default: "false"
type: string
upgrade-boto:
description: "Whether to upgrade boto or not (true/false)"
required: false
default: "false"
type: string
downgrade-pendulum:
description: "Whether to downgrade pendulum or not (true/false)"
required: false
default: "false"
type: string
force-lowest-dependencies:
description: "Whether to force lowest dependencies for the tests or not (true/false)"
required: false
default: "false"
type: string
monitor-delay-time-in-seconds:
description: "How much time to wait between printing parallel monitor summary"
required: false
default: 20
type: number
use-uv:
description: "Whether to use uv"
required: true
type: string
jobs:
tests:
timeout-minutes: 120
name: "\
${{ inputs.test-scope }}-${{ matrix.test-group }}:\
${{ inputs.test-name }}${{ inputs.test-name-separator }}${{ matrix.backend-version }}:\
${{matrix.python-version}}"
runs-on: ${{ fromJSON(inputs.runs-on-as-json-default) }}
strategy:
fail-fast: false
matrix:
python-version: "${{fromJSON(inputs.python-versions)}}"
backend-version: "${{fromJSON(inputs.backend-versions)}}"
exclude: "${{fromJSON(inputs.excludes)}}"
test-group: "${{fromJSON(inputs.test-groups)}}"
env:
BACKEND: "${{ inputs.backend }}"
BACKEND_VERSION: "${{ matrix.backend-version }}"
DB_RESET: "true"
DEBUG_RESOURCES: "${{ inputs.debug-resources }}"
DOWNGRADE_SQLALCHEMY: "${{ inputs.downgrade-sqlalchemy }}"
DOWNGRADE_PENDULUM: "${{ inputs.downgrade-pendulum }}"
ENABLE_COVERAGE: "${{ inputs.run-coverage }}"
EXCLUDED_PROVIDERS: "${{ inputs.excluded-providers-as-string }}"
FORCE_LOWEST_DEPENDENCIES: "${{ inputs.force-lowest-dependencies }}"
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
INCLUDE_SUCCESS_OUTPUTS: ${{ inputs.include-success-outputs }}
# yamllint disable rule:line-length
JOB_ID: "${{ matrix.test-group }}-${{ inputs.test-scope }}-${{ inputs.test-name }}-${{inputs.backend}}-${{ matrix.backend-version }}-${{ matrix.python-version }}"
MOUNT_SOURCES: "skip"
# yamllint disable rule:line-length
PARALLEL_TEST_TYPES: ${{ matrix.test-group == 'core' && inputs.core-test-types-list-as-string || inputs.providers-test-types-list-as-string }}
PYTHON_MAJOR_MINOR_VERSION: "${{ matrix.python-version }}"
UPGRADE_BOTO: "${{ inputs.upgrade-boto }}"
AIRFLOW_MONITOR_DELAY_TIME_IN_SECONDS: "${{inputs.monitor-delay-time-in-seconds}}"
VERBOSE: "true"
steps:
- name: "Cleanup repo"
shell: bash
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v4
with:
persist-credentials: false
- name: "Prepare breeze & CI image: ${{ matrix.python-version }}"
uses: ./.github/actions/prepare_breeze_and_image
with:
platform: "linux/amd64"
python: ${{ matrix.python-version }}
use-uv: ${{ inputs.use-uv }}
- name: >
Migration Tests: ${{ matrix.python-version }}:${{ env.PARALLEL_TEST_TYPES }}
uses: ./.github/actions/migration_tests
if: inputs.run-migration-tests == 'true' && matrix.test-group == 'core'
- name: >
${{ matrix.test-group}}:${{ inputs.test-scope }} Tests ${{ inputs.test-name }} ${{ matrix.backend-version }}
Py${{ matrix.python-version }}:${{ env.PARALLEL_TEST_TYPES }}
env:
TEST_GROUP: "${{ matrix.test-group }}"
TEST_SCOPE: "${{ inputs.test-scope }}"
run: ./scripts/ci/testing/run_unit_tests.sh "${TEST_GROUP}" "${TEST_SCOPE}"
- name: "Post Tests success"
uses: ./.github/actions/post_tests_success
with:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
python-version: ${{ matrix.python-version }}
if: success()
- name: "Post Tests failure"
uses: ./.github/actions/post_tests_failure
if: failure() || cancelled()