-
Notifications
You must be signed in to change notification settings - Fork 1.7k
235 lines (216 loc) · 8.53 KB
/
integration-tests.yaml
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
name: Integration tests
on:
pull_request:
paths:
- .github/workflows/integration-tests.yaml
- "src/prefect/**/*.py"
- requirements.txt
- requirements-client.txt
- requirements-dev.txt
- ui/**
- .nvmrc
- Dockerfile
- flows/
push:
branches:
- 2.x
paths:
- .github/workflows/integration-tests.yaml
- "**/*.py"
- requirements.txt
- requirements-client.txt
- requirements-dev.txt
- ui/**
- .nvmrc
- Dockerfile
jobs:
compatibility-tests:
name: "Check compatibility with Prefect ${{ matrix.prefect-version }}"
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
prefect-version:
# These versions correspond to Prefect image tags, the patch version is
# excluded to always pull the latest patch of each minor version.
- "2.0"
- "2.1"
- "2.2"
- "2.3"
- "2.4"
- "2.5"
- "2.6"
- "2.7"
- "2.8"
- "2.9"
- "2.10"
- "2.11"
- "2.12"
- "2.13"
- "2.14"
- "2.15"
- "2.16"
- "2.17"
- "2.18"
- "2.19"
# We can include the following to always test against the last release
# but the value is not particularly clear and we can just append the
# last minor version at each release time
# - "2"
include:
# While old clients should always be supported by new servers, a new
# client may send data that an old server does not support. These
# incompatibilities are allowed.
# All servers prior to 2.6.0 will not accept 2.6.0+ result types
# All servers prior to 2.16.0 will not accept `Deployment.schedules`
- prefect-version: "2.0"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.1"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.2"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.3"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.4"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.5"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.6"
server-incompatible: true
server-disable-csrf: true
# 2.6 containers have a bad version of httpcore installed
extra_docker_run_options: '--env EXTRA_PIP_PACKAGES="httpcore>=0.16.2"'
- prefect-version: "2.7"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.8"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.9"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.10"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.11"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.12"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.13"
server-incompatible: true
server-disable-csrf: true
extra_docker_run_options: '--env EXTRA_PIP_PACKAGES="prefect-kubernetes<0.4"'
- prefect-version: "2.14"
server-incompatible: true
server-disable-csrf: true
extra_docker_run_options: '--env EXTRA_PIP_PACKAGES="prefect-kubernetes<0.4"'
- prefect-version: "2.15"
server-incompatible: true
server-disable-csrf: true
extra_docker_run_options: '--env EXTRA_PIP_PACKAGES="prefect-kubernetes<0.4"'
- prefect-version: "2.16"
server-incompatible: false
extra_docker_run_options: '--env EXTRA_PIP_PACKAGES="prefect-kubernetes<0.4"'
- prefect-version: "2.17"
server-incompatible: false
extra_docker_run_options: '--env EXTRA_PIP_PACKAGES="prefect-kubernetes<0.4"'
- prefect-version: "2.18"
server-incompatible: false
extra_docker_run_options: '--env EXTRA_PIP_PACKAGES="prefect-kubernetes<0.4"'
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v5
id: setup_python
with:
python-version: "3.10"
- name: UV Cache
# Manually cache the uv cache directory
# until setup-python supports it:
# https://github.com/actions/setup-python/issues/822
uses: actions/cache@v4
id: cache-uv
with:
path: ~/.cache/uv
key: uvcache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements-client.txt', 'requirements.txt', 'requirements-dev.txt') }}
- name: Install python packages
run: |
python -m pip install -U uv
uv pip install --upgrade --system .
- name: Start server@${{ matrix.prefect-version }}
if: ${{ ! matrix.server-incompatible }}
env:
PREFECT_EXPERIMENTAL_EVENTS: True
PREFECT_API_URL: http://127.0.0.1:4200/api
run: >
docker run
--name "prefect-server-${{ matrix.prefect-version }}"
--detach
--publish 4200:4200
${{ matrix.extra_docker_run_options }}
--env PREFECT_EXPERIMENTAL_EVENTS=True
--env PREFECT_LOGGING_SERVER_LEVEL=DEBUG
prefecthq/prefect:${{ matrix.prefect-version }}-python3.10
${{ matrix.server_command || 'prefect server start --analytics-off' }} --host 0.0.0.0
./scripts/wait-for-server.py
# TODO: Replace `wait-for-server` with dedicated command
# https://github.com/PrefectHQ/prefect/issues/6990
- name: Run integration flows with client@dev, server@${{ matrix.prefect-version }}
if: ${{ ! matrix.server-incompatible }}
env:
PREFECT_API_URL: http://127.0.0.1:4200/api
PREFECT_EXPERIMENTAL_EVENTS: True
run: >
TEST_SERVER_VERSION=${{ matrix.prefect-version }}
TEST_CLIENT_VERSION=$(python -c 'import prefect; print(prefect.__version__)')
./scripts/run-integration-flows.py flows/
- name: Show server@${{ matrix.prefect-version }} logs
if: always()
run: |
docker logs "prefect-server-${{ matrix.prefect-version }}" || echo "No logs available"
- name: Turn off CSRF protection for older clients.
if: ${{ matrix.server-disable-csrf }}
run: |
echo "PREFECT_SERVER_CSRF_PROTECTION_ENABLED=0" >> $GITHUB_ENV
- name: Start server@dev
env:
PREFECT_API_URL: http://127.0.0.1:4200/api
PREFECT_EXPERIMENTAL_EVENTS: True
PREFECT_LOGGING_SERVER_LEVEL: DEBUG
run: |
# First, we must stop the server container if it exists
# TODO: Once we have `prefect server stop` we can run these tests first and the
# optional tests above second
# https://github.com/PrefectHQ/prefect/issues/6989
docker stop "prefect-server-${{ matrix.prefect-version }}" || echo "That's okay!"
prefect server start --port 4201 --analytics-off > server-logs.txt 2>&1 &
./scripts/wait-for-server.py
- name: Run integration flows with client@${{ matrix.prefect-version }}, server@dev
run: >
docker run
--env TEST_SERVER_VERSION=$(python -c 'import prefect; print(prefect.__version__)')
--env TEST_CLIENT_VERSION=${{ matrix.client_version }}
--env PREFECT_API_URL="http://127.0.0.1:4201/api"
--env PREFECT_EXPERIMENTAL_EVENTS=True
--volume $(pwd)/flows:/opt/prefect/integration/flows
--volume $(pwd)/scripts:/opt/prefect/integration/scripts
--network host
${{ matrix.extra_docker_run_options }}
prefecthq/prefect:${{ matrix.prefect-version }}-python3.10
/opt/prefect/integration/scripts/run-integration-flows.py /opt/prefect/integration/flows
- name: Show server@dev logs
if: always()
run: |
cat server-logs.txt || echo "No logs available"