-
Notifications
You must be signed in to change notification settings - Fork 29
143 lines (117 loc) · 4.55 KB
/
e2e-playright.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
# End-to-end testing that deploys and tests Supabase, API, UI, and VLLM
name: e2e-playright
on:
pull_request:
types:
- ready_for_review
- review_requested
- synchronize
- milestoned
paths:
# Catch-all
- "**"
# Ignore updates to the .github directory, unless it's this current file
- "!.github/**"
- ".github/workflows/e2e-playright.yaml"
# Ignore docs and website things
- "!**.md"
- "!docs/**"
- "!adr/**"
- "!website/**"
- "!netlify.toml"
# Ignore updates to generic github metadata files
- "!CODEOWNERS"
- "!.gitignore"
- "!LICENSE"
# Ignore local development files
- "!.pre-commit-config.yaml"
# Ignore non e2e tests changes
- "!tests/pytest/**"
# Ignore changes to unrelated packages
- "!packages/k3d-gpu/**"
- "!packages/llama-cpp-python/**"
- "!packages/repeater/**"
- "!packages/text-embeddings/**"
- "!packages/vllm/**"
- "!packages/whisper/**"
concurrency:
group: e2e-playright-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e_playright:
runs-on: ai-ubuntu-big-boy-8-core
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Checkout Repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c #v5.0.0
with:
python-version-file: 'pyproject.toml'
- name: Install Python Deps
run: python -m pip install "."
- name: Setup Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: 'src/leapfrogai_ui/package.json'
- name: Install UI/Playwright Dependencies
run: |
npm --prefix src/leapfrogai_ui ci
npx --prefix src/leapfrogai_ui playwright install
- name: Setup UDS Environment
uses: defenseunicorns/uds-common/.github/actions/setup@05f42bb3117b66ebef8c72ae050b34bce19385f5
with:
username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
- name: Create UDS Cluster
run: |
uds deploy k3d-core-slim-dev:0.22.2 --confirm
##########
# Supabase
##########
- name: Deploy Supabase
run: |
make build-supabase LOCAL_VERSION=e2e-test
docker image prune -af
uds zarf tools kubectl create namespace leapfrogai
uds zarf package deploy packages/supabase/zarf-package-supabase-amd64-e2e-test.tar.zst --confirm
rm packages/supabase/zarf-package-supabase-amd64-e2e-test.tar.zst
- name: Set environment variable
id: set-env-var
run: |
echo "ANON_KEY=$(uds zarf tools kubectl get secret supabase-bootstrap-jwt -n leapfrogai -o jsonpath='{.data.anon-key}' | base64 -d)" >> "$GITHUB_ENV"
- name: Test Supabase
run: |
python -m pip install requests
python -m pytest ./tests/e2e/test_supabase.py -v
##########
# UI
##########
- name: Deploy LFAI-UI
run: |
make build-ui LOCAL_VERSION=e2e-test
docker image prune -af
uds zarf package deploy packages/ui/zarf-package-leapfrogai-ui-amd64-e2e-test.tar.zst --confirm
rm packages/ui/zarf-package-leapfrogai-ui-amd64-e2e-test.tar.zst
##########
# API
##########
- name: Deploy LFAI-API
run: |
make build-api LOCAL_VERSION=e2e-test
docker image prune -af
uds zarf package deploy packages/api/zarf-package-leapfrogai-api-amd64-e2e-test.tar.zst --confirm
rm packages/api/zarf-package-leapfrogai-api-amd64-e2e-test.tar.zst
- name: Test API
run: |
python -m pip install requests
python -m pytest ./tests/e2e/test_api.py -v
# Run the playwright UI tests using the deployed Supabase endpoint
- name: UI/API/Supabase E2E Playwright Tests
run: |
cp src/leapfrogai_ui/.env.example src/leapfrogai_ui/.env
TEST_ENV=CI PUBLIC_DISABLE_KEYCLOAK=true PUBLIC_SUPABASE_ANON_KEY=$ANON_KEY npm --prefix src/leapfrogai_ui run test:integration:ci
# The UI can be removed after the Playwright tests are finished
- name: Cleanup UI
run: |
uds zarf package remove leapfrogai-ui --confirm