-
Notifications
You must be signed in to change notification settings - Fork 1.7k
86 lines (71 loc) · 2.54 KB
/
k8s-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
name: Kubernetes Integration Tests
on:
workflow_dispatch:
pull_request:
paths:
- "src/integrations/prefect-kubernetes/prefect_kubernetes/worker.py"
- "src/integrations/prefect-kubernetes/integration_tests/**"
push:
branches: [main]
paths:
- "src/integrations/prefect-kubernetes/prefect_kubernetes/worker.py"
- "src/integrations/prefect-kubernetes/integration_tests/**"
jobs:
integration-tests:
name: Run Kubernetes Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: "3.12"
cache-dependency-glob: "src/integrations/prefect-kubernetes/integration_tests/pyproject.toml"
- name: Install dependencies
run: cd src/integrations/prefect-kubernetes/integration_tests && uv sync --active
- name: Set up Kind cluster
uses: helm/[email protected]
with:
cluster_name: prefect-test
- name: Install kubectl
uses: azure/setup-kubectl@v4
with:
version: 'latest'
- name: Install krew
run: |
(
set -x; cd "$(mktemp -d)" &&
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
)
echo "${HOME}/.krew/bin" >> $GITHUB_PATH
- name: Install evict-pod
run: |
kubectl krew install evict-pod
- name: Start Prefect server
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 &
python ./scripts/wait-for-server.py
- name: Run integration tests
run: |
cd src/integrations/prefect-kubernetes/integration_tests
uv run pytest -s
env:
PREFECT_API_URL: http://127.0.0.1:4200/api
- name: Delete Kind cluster
if: always()
run: |
kind delete cluster --name prefect-test