forked from apache/airflow
-
Notifications
You must be signed in to change notification settings - Fork 18
246 lines (245 loc) · 10.4 KB
/
test-provider-packages.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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# 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: Provider 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
canary-run:
description: "Whether this is a canary run"
required: true
type: string
default-python-version:
description: "Which version of python should be used by default"
required: true
type: string
upgrade-to-newer-dependencies:
description: "Whether to upgrade to newer dependencies"
required: true
type: string
selected-providers-list-as-string:
description: "List of affected providers as string"
required: false
type: string
providers-compatibility-tests-matrix:
description: >
JSON-formatted array of providers compatibility tests in the form of array of dicts
(airflow-version, python-versions, remove-providers, run-tests)
required: true
type: string
providers-test-types-list-as-string:
description: "List of parallel provider test types as string"
required: true
type: string
skip-providers-tests:
description: "Whether to skip provider tests (true/false)"
required: true
type: string
python-versions:
description: "JSON-formatted array of Python versions to build images from"
required: true
type: string
use-uv:
description: "Whether to use uv"
required: true
type: string
jobs:
prepare-install-verify-provider-packages:
timeout-minutes: 80
name: "Providers ${{ matrix.package-format }} tests"
runs-on: ${{ fromJSON(inputs.runs-on-as-json-default) }}
strategy:
fail-fast: false
matrix:
package-format: ["wheel", "sdist"]
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
INCLUDE_NOT_READY_PROVIDERS: "true"
PYTHON_MAJOR_MINOR_VERSION: "${{ inputs.default-python-version }}"
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: ${{ inputs.default-python-version }}"
uses: ./.github/actions/prepare_breeze_and_image
with:
platform: "linux/amd64"
python: ${{ inputs.default-python-version }}
use-uv: ${{ inputs.use-uv }}
- name: "Cleanup dist files"
run: rm -fv ./dist/*
- name: "Prepare provider documentation"
run: >
breeze release-management prepare-provider-documentation --include-not-ready-providers
--non-interactive
if: matrix.package-format == 'wheel'
- name: "Prepare provider packages: ${{ matrix.package-format }}"
run: >
breeze release-management prepare-provider-packages --include-not-ready-providers
--version-suffix-for-pypi dev0 --package-format ${{ matrix.package-format }}
- name: "Prepare airflow package: ${{ matrix.package-format }}"
run: >
breeze release-management prepare-airflow-package --version-suffix-for-pypi dev0
--package-format ${{ matrix.package-format }}
- name: "Verify ${{ matrix.package-format }} packages with twine"
run: |
uv tool uninstall twine || true
uv tool install twine && twine check dist/*
- name: "Test providers issue generation automatically"
run: >
breeze release-management generate-issue-content-providers
--only-available-in-dist --disable-progress
if: matrix.package-format == 'wheel'
- name: Remove Python 3.9-incompatible provider packages
run: |
echo "Removing Python 3.9-incompatible provider: cloudant"
rm -vf dist/*cloudant*
- name: "Generate source constraints from CI image"
shell: bash
run: >
breeze release-management generate-constraints
--airflow-constraints-mode constraints-source-providers --answer yes
- name: "Install and verify wheel provider packages"
env:
PACKAGE_FORMAT: ${{ matrix.package-format }}
PYTHON_MAJOR_MINOR_VERSION: ${env.PYTHON_MAJOR_MINOR_VERSION}
AIRFLOW_SKIP_CONSTRAINTS: "${{ inputs.upgrade-to-newer-dependencies }}"
run: >
breeze release-management verify-provider-packages
--use-packages-from-dist
--package-format "${PACKAGE_FORMAT}"
--use-airflow-version "${PACKAGE_FORMAT}"
--airflow-constraints-reference default
--providers-constraints-location
/files/constraints-${PYTHON_MAJOR_MINOR_VERSION}/constraints-source-providers-${PYTHON_MAJOR_MINOR_VERSION}.txt
if: matrix.package-format == 'wheel'
- name: "Install all sdist provider packages and airflow"
env:
PACKAGE_FORMAT: ${{ matrix.package-format }}
PYTHON_MAJOR_MINOR_VERSION: ${{ env.PYTHON_MAJOR_MINOR_VERSION }}
run: >
breeze release-management install-provider-packages
--use-packages-from-dist
--package-format "${PACKAGE_FORMAT}"
--use-airflow-version ${PACKAGE_FORMAT}
--airflow-constraints-reference default
--providers-constraints-location
/files/constraints-${PYTHON_MAJOR_MINOR_VERSION}/constraints-source-providers-${PYTHON_MAJOR_MINOR_VERSION}.txt
--run-in-parallel
if: matrix.package-format == 'sdist'
# All matrix parameters are passed as JSON string in the input variable providers-compatibility-tests-matrix
providers-compatibility-tests-matrix:
timeout-minutes: 80
name: Compat ${{ matrix.airflow-version }}:P${{ matrix.python-version }} providers test
runs-on: ${{ fromJSON(inputs.runs-on-as-json-default) }}
strategy:
fail-fast: false
matrix:
include: ${{fromJSON(inputs.providers-compatibility-tests-matrix)}}
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
INCLUDE_NOT_READY_PROVIDERS: "true"
PYTHON_MAJOR_MINOR_VERSION: "${{ matrix.python-version }}"
VERSION_SUFFIX_FOR_PYPI: "dev0"
VERBOSE: "true"
CLEAN_AIRFLOW_INSTALLATION: "${{ inputs.canary-run }}"
if: inputs.skip-providers-tests != '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: "Cleanup dist files"
run: rm -fv ./dist/*
- name: "Prepare provider packages: wheel"
run: >
breeze release-management prepare-provider-packages --include-not-ready-providers
--package-format wheel
- name: >
Remove incompatible Airflow
${{ matrix.airflow-version }}:Python ${{ matrix.python-version }} provider packages
env:
REMOVE_PROVIDERS: ${{ matrix.remove-providers }}
run: |
for provider in ${REMOVE_PROVIDERS}; do
echo "Removing incompatible provider: ${provider}"
rm -vf dist/apache_airflow_providers_${provider/./_}*
done
if: matrix.remove-providers != ''
- name: "Download airflow package: wheel"
run: |
pip download "apache-airflow==${{ matrix.airflow-version }}" -d dist --no-deps
- name: >
Install and verify all provider packages and airflow on
Airflow ${{ matrix.airflow-version }}:Python ${{ matrix.python-version }}
# We do not need to run import check if we run tests, the tests should cover all the import checks
# automatically
if: matrix.run-tests != 'true'
env:
AIRFLOW_VERSION: "${{ matrix.airflow-version }}"
run: >
breeze release-management verify-provider-packages
--use-packages-from-dist
--package-format wheel
--use-airflow-version wheel
--airflow-constraints-reference constraints-${AIRFLOW_VERSION}
--providers-skip-constraints
--install-airflow-with-constraints
- name: Check amount of disk space available
run: df -H
shell: bash
- name: >
Run provider unit tests on
Airflow ${{ matrix.airflow-version }}:Python ${{ matrix.python-version }}
if: matrix.run-tests == 'true'
env:
PROVIDERS_TEST_TYPES: "${{ inputs.providers-test-types-list-as-string }}"
AIRFLOW_VERSION: "${{ matrix.airflow-version }}"
REMOVE_PROVIDERS: "${{ matrix.remove-providers }}"
run: >
breeze testing providers-tests --run-in-parallel
--parallel-test-types "${PROVIDERS_TEST_TYPES}"
--use-packages-from-dist
--package-format wheel
--use-airflow-version "${AIRFLOW_VERSION}"
--airflow-constraints-reference constraints-${AIRFLOW_VERSION}
--install-airflow-with-constraints
--providers-skip-constraints
--skip-providers "${REMOVE_PROVIDERS}"