forked from PrefectHQ/prefect
-
Notifications
You must be signed in to change notification settings - Fork 0
191 lines (175 loc) · 6.69 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
name: Integration tests
on:
pull_request:
paths:
- .github/workflows/integration-tests.yaml
- "**/*.py"
- requirements.txt
- requirements-client.txt
- requirements-dev.txt
- ui/**
- .nvmrc
- Dockerfile
push:
branches:
- main
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"
# 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
- prefect-version: "2.14"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.15"
server-incompatible: true
server-disable-csrf: true
- prefect-version: "2.16"
server-incompatible: false
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: "requirements*.txt"
- name: Install python packages
run: |
python -m pip install --upgrade pip
pip install --upgrade --upgrade-strategy eager -e .[dev]
- name: Start server@${{ matrix.prefect-version }}
if: ${{ ! matrix.server-incompatible }}
run: >
docker run
--name "prefect-server-${{ matrix.prefect-version }}"
--detach
--publish 4200:4200
${{ matrix.extra_docker_run_options }}
prefecthq/prefect:${{ matrix.prefect-version }}-python3.10
${{ matrix.server_command || 'prefect server start --analytics-off' }} --host 0.0.0.0
PREFECT_API_URL="http://127.0.0.1:4200/api"
./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 }}
run: >
TEST_SERVER_VERSION=${{ matrix.prefect-version }}
PREFECT_API_URL="http://127.0.0.1:4200/api"
TEST_CLIENT_VERSION=$(python -c 'import prefect; print(prefect.__version__)')
./scripts/run-integration-flows.py
- 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
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 --analytics-off&
PREFECT_API_URL="http://127.0.0.1:4200/api" ./scripts/wait-for-server.py
- name: Run integration flows with client@${{ matrix.prefect-version }}, server@dev
run: >
docker run
--env PREFECT_API_URL="http://127.0.0.1:4200/api"
--env TEST_SERVER_VERSION=$(python -c 'import prefect; print(prefect.__version__)')
--env TEST_CLIENT_VERSION=${{ matrix.client_version }}
--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