-
Notifications
You must be signed in to change notification settings - Fork 13
253 lines (212 loc) · 7.58 KB
/
frontend-ci.yml
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
name: CI for frontend
on:
pull_request:
push:
branches:
- master
schedule:
- cron: "0 0 * * *"
jobs:
lint-type-check:
defaults:
run:
working-directory: web
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16 # TODO: use latest version when we update to Vue 3
- name: Install Vue app
run: yarn install
- name: Lint Vue app
run: yarn run lint --no-fix
- name: Type-check Vue app
run: yarn run type-check
- name: Build Vue app
run: yarn run build
test-e2e-puppeteer:
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: django
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
rabbitmq:
image: rabbitmq:management
ports:
- 5672:5672
minio:
# This image does not require any command arguments (which GitHub Actions don't support)
image: bitnami/minio:latest
env:
MINIO_ROOT_USER: minioAccessKey
MINIO_ROOT_PASSWORD: minioSecretKey
ports:
- 9000:9000
env:
# API server env vars
DJANGO_DATABASE_URL: postgres://postgres:postgres@localhost:5432/django
DJANGO_MINIO_STORAGE_ENDPOINT: localhost:9000
DJANGO_MINIO_STORAGE_ACCESS_KEY: minioAccessKey
DJANGO_MINIO_STORAGE_SECRET_KEY: minioSecretKey
DJANGO_STORAGE_BUCKET_NAME: dandi-bucket
DJANGO_DANDI_DANDISETS_BUCKET_NAME: dandi-bucket
DJANGO_DANDI_DANDISETS_LOG_BUCKET_NAME: dandiapi-dandisets-logs
DJANGO_DANDI_DANDISETS_EMBARGO_LOG_BUCKET_NAME: dandiapi-embargo-dandisets-logs
DJANGO_DANDI_WEB_APP_URL: http://localhost:8085
DJANGO_DANDI_API_URL: http://localhost:8000
DJANGO_DANDI_JUPYTERHUB_URL: https://hub.dandiarchive.org/
DJANGO_DANDI_DEV_EMAIL: [email protected]
DANDI_ALLOW_LOCALHOST_URLS: 1
# Web client env vars
VITE_APP_DANDI_API_ROOT: http://localhost:8000/api/
VITE_APP_OAUTH_API_ROOT: http://localhost:8000/oauth/
VITE_APP_OAUTH_CLIENT_ID: Dk0zosgt1GAAKfN8LT4STJmLJXwMDPbYWYzfNtAl
# E2E tests env vars
CLIENT_URL: http://localhost:8085
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'yarn'
cache-dependency-path: web/yarn.lock
- name: Install web app
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --prefer-offline
working-directory: web
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install latest version of pip
run: pip install --upgrade pip
- uses: actions/cache@v4
id: pip-cache
with:
path: ${{ env.pythonLocation}}/lib/python3.11/site-packages/*
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('setup.py') }}
- name: Install dandi-api dependencies
run: pip install --upgrade --upgrade-strategy eager -e .[dev]
- name: Apply migrations to API server
run: python manage.py migrate
- name: Create any cache tables
run: python manage.py createcachetable
# Populate the database with a dandiset for FileBrowser tests
- name: Create a superuser
run: python manage.py createsuperuser --noinput --email [email protected]
- name: Create Dandiset
run: python manage.py create_dev_dandiset --owner [email protected]
- name: Install E2E tests
run: yarn install --frozen-lockfile
working-directory: e2e/puppeteer
- name: Lint E2E tests
run: yarn run lint --no-fix --max-warnings=0
working-directory: e2e/puppeteer
- name: Run E2E tests
run: |
# start vue dev server and wait for it to start
yarn --cwd ../../web/ run dev 2> /dev/null &
while ! nc -z localhost 8085; do
sleep 3
done
# start the dandi-api server
python ../../manage.py runserver &
# run the E2E tests
yarn run test
working-directory: e2e/puppeteer
test-e2e-playwright:
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: django
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
rabbitmq:
image: rabbitmq:management
ports:
- 5672:5672
minio:
# This image does not require any command arguments (which GitHub Actions don't support)
image: bitnami/minio:latest
env:
MINIO_ROOT_USER: minioAccessKey
MINIO_ROOT_PASSWORD: minioSecretKey
ports:
- 9000:9000
env:
# API server env vars
DJANGO_DATABASE_URL: postgres://postgres:postgres@localhost:5432/django
DJANGO_MINIO_STORAGE_ENDPOINT: localhost:9000
DJANGO_MINIO_STORAGE_ACCESS_KEY: minioAccessKey
DJANGO_MINIO_STORAGE_SECRET_KEY: minioSecretKey
DJANGO_STORAGE_BUCKET_NAME: dandi-bucket
DJANGO_DANDI_DANDISETS_BUCKET_NAME: dandi-bucket
DJANGO_DANDI_DANDISETS_LOG_BUCKET_NAME: dandiapi-dandisets-logs
DJANGO_DANDI_DANDISETS_EMBARGO_LOG_BUCKET_NAME: dandiapi-embargo-dandisets-logs
DJANGO_DANDI_WEB_APP_URL: http://localhost:8085
DJANGO_DANDI_API_URL: http://localhost:8000
DJANGO_DANDI_JUPYTERHUB_URL: https://hub.dandiarchive.org/
DJANGO_DANDI_DEV_EMAIL: [email protected]
DANDI_ALLOW_LOCALHOST_URLS: 1
# Web client env vars
VITE_APP_DANDI_API_ROOT: http://localhost:8000/api/
VITE_APP_OAUTH_API_ROOT: http://localhost:8000/oauth/
VITE_APP_OAUTH_CLIENT_ID: Dk0zosgt1GAAKfN8LT4STJmLJXwMDPbYWYzfNtAl
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install web app
run: yarn install --frozen-lockfile
working-directory: web
- name: Install latest version of pip
run: pip install --upgrade pip
- uses: actions/cache@v4
id: pip-cache
with:
path: ${{ env.pythonLocation}}/lib/python3.11/site-packages/*
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('setup.py') }}
- name: Install dandi-api dependencies
run: pip install --upgrade --upgrade-strategy eager -e .[dev]
- name: Apply migrations to API server
run: python manage.py migrate
- name: Create any cache tables
run: python manage.py createcachetable
- name: Install test data
run: python manage.py loaddata playwright
- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: e2e/playwright
- name: Install Playwright Browsers
run: npx playwright install --with-deps
working-directory: e2e/playwright
- name: Run Playwright tests
run: |
# start vue dev server
yarn --cwd ../../web/ run dev 2> /dev/null &
while ! nc -z localhost 8085; do
sleep 3
done
# start the dandi-api server
python ../../manage.py runserver &
# run the tests
npx playwright test
working-directory: e2e/playwright
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: e2e/playwright/playwright-report/
retention-days: 30