-
Notifications
You must be signed in to change notification settings - Fork 1.6k
144 lines (127 loc) · 4.5 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
# TODO: Replace `wait-for-server` with dedicated command
# https://github.com/PrefectHQ/prefect/issues/6990
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:
- main
paths:
- .github/workflows/integration-tests.yaml
- "**/*.py"
- requirements.txt
- requirements-client.txt
- requirements-dev.txt
- ui/**
- .nvmrc
- Dockerfile
jobs:
compatibility-tests:
name: Integration tests @${{ matrix.server-version.version }}
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
server-version: [
# These versions correspond to Prefect image tags, the patch version is
# excluded to always pull the latest patch of each minor version. The ref
# should generally be set to the latest patch release for that version.
{ version: "main", ref: "main" },
]
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.server-version.version }}
if: ${{ matrix.server-version.version != 'main' }}
env:
PREFECT_API_URL: http://127.0.0.1:4200/api
PREFECT_SERVER_LOGGING_LEVEL: DEBUG
PREFECT_EXPERIMENTAL_EVENTS: "true"
run: >
docker run \
--name "prefect-server" \
-d \
-p 4200:4200 \
-e PREFECT_API_URL=${{ env.PREFECT_API_URL }} \
-e PREFECT_SERVER_LOGGING_LEVEL=${{ env.PREFECT_SERVER_LOGGING_LEVEL }} \
${{ matrix.server-version.image }} \
prefect server start --analytics-off --host 0.0.0.0
./scripts/wait-for-server.py
- name: Start server
if: ${{ matrix.server-version.version == 'main' }}
env:
PREFECT_API_URL: http://127.0.0.1:4200/api
PREFECT_SERVER_LOGGING_LEVEL: DEBUG
run: >
prefect server start --analytics-off --host 0.0.0.0 2>&1 > server.log &
./scripts/wait-for-server.py
- name: Run integration flows
env:
PREFECT_API_URL: http://127.0.0.1:4200/api
SERVER_VERSION: ${{ matrix.server-version.version }}
run: >
./scripts/run-integration-flows.py flows/
- name: Show server logs
if: always()
run: |
cat server.log || echo "No logs available"
docker logs prefect-server || echo "No logs available"
sqlite-3-24-0:
name: Test SQLite 3.24.0 Compatibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Test with SQLite 3.24.0
run: >
docker build -t prefect-server-old-sqlite \
--build-arg SQLITE_VERSION=3240000 \
--build-arg SQLITE_YEAR=2018 \
-f old-sqlite.Dockerfile . &&
docker run prefect-server-old-sqlite sh -c "prefect server database downgrade --yes -r base && prefect server database upgrade --yes"
sqlite-3-31-1:
name: Test SQLite 3.31.1 Compatibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Test with SQLite 3.31.1
run: >
docker build -t prefect-server-new-sqlite \
--build-arg SQLITE_VERSION=3310100 \
--build-arg SQLITE_YEAR=2020 \
-f old-sqlite.Dockerfile . &&
docker run prefect-server-new-sqlite sh -c "prefect server database downgrade --yes -r base && prefect server database upgrade --yes"