-
Notifications
You must be signed in to change notification settings - Fork 77
431 lines (377 loc) · 15 KB
/
cypress-end-to-end-tests.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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
name: cypress-end-to-end-tests
on:
pull_request:
paths-ignore:
- "**.md"
push:
branches: [main]
paths-ignore:
- "**.md"
jobs:
# This job is made to setup path filtering, learn more about it here: https://github.com/facebookresearch/Mephisto/pull/857
changes:
runs-on: ubuntu-latest
# Set job outputs to values from filters step below
outputs:
simple_static_task: ${{ steps.filter.outputs.simple_static_task }}
static_react_task: ${{ steps.filter.outputs.static_react_task }}
static_react_task_with_tips: ${{ steps.filter.outputs.static_react_task_with_tips }}
mnist: ${{ steps.filter.outputs.mnist }}
template: ${{ steps.filter.outputs.template }}
toxicity_detection: ${{ steps.filter.outputs.toxicity_detection }}
abstractions: ${{ steps.filter.outputs.abstractions }}
data_model: ${{ steps.filter.outputs.data_model }}
operations: ${{ steps.filter.outputs.operations }}
tools: ${{ steps.filter.outputs.tools }}
mephisto-task: ${{ steps.filter.outputs.mephisto-task }}
mephisto-worker-addons: ${{ steps.filter.outputs.mephisto-worker-addons }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
# Workaround to avoid Post Use step failures. See: https://github.com/actions/setup-node/issues/317
- run: mkdir -p /home/runner/work/Mephisto/Mephisto/.yarn/cache
continue-on-error: true
- uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 16
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
simple_static_task:
- 'examples/simple_static_task/**'
static_react_task:
- 'examples/static_react_task/**'
static_react_task_with_tips:
- 'examples/static_react_task_with_tips/**'
mnist:
- 'examples/remote_procedure/mnist/**'
template:
- 'examples/remote_procedure/template/**'
toxicity_detection:
- 'examples/remote_procedure/toxicity_detection/**'
abstractions:
- 'mephisto/abstractions/**'
data_model:
- 'mephisto/data_model/**'
operations:
- 'mephisto/operations/**'
tools:
- 'mephisto/tools/**'
mephisto-task:
- 'packages/mephisto-task/src/**'
mephisto-worker-addons:
- 'packages/mephisto-worker-addons/src/**'
# Learn more about this test here: https://github.com/facebookresearch/Mephisto/pull/881
simple_static_task:
needs: changes
if: ${{ (needs.changes.outputs.simple_static_task == 'true') || (needs.changes.outputs.mephisto-task == 'true') || (needs.changes.outputs.abstractions == 'true') || (needs.changes.outputs.data_model == 'true') || (needs.changes.outputs.operations == 'true') || (needs.changes.outputs.tools == 'true')}}
runs-on: ubuntu-latest
steps:
- name: 🔀 Checking out repo
uses: actions/checkout@v2
- name: 🐍 Installing python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: 🪨 Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.16.0
- name: 🤖 Install Mephisto
run: pip install -e .
- name: 🖋 Create data directory
run: mkdir -p ~/mephisto/data
- name: 📂 Set the data directory
run: mephisto config core.main_data_directory ~/mephisto/data
- name: 📦 Setting up mephisto-task package
run: |
cd packages/mephisto-task
yarn install
yarn build
npm link
- name: ⌛️ Running cypress tests
uses: cypress-io/[email protected]
with:
build: npm i -D cypress@11
install: false
browser: chrome
project: ./mephisto/abstractions/blueprints/static_html_task/source
config-file: ./cypress.config.js
start: python ./examples/simple_static_task/static_test_script.py
wait-on: "http://localhost:3000/?worker_id=x&assignment_id=1"
headless: true
# Learn more about this test here: https://github.com/facebookresearch/Mephisto/pull/795
static-react-task:
needs: changes
if: ${{ (needs.changes.outputs.static_react_task == 'true') || (needs.changes.outputs.mephisto-task == 'true') || (needs.changes.outputs.abstractions == 'true') || (needs.changes.outputs.data_model == 'true') || (needs.changes.outputs.operations == 'true') || (needs.changes.outputs.tools == 'true')}}
runs-on: ubuntu-latest
steps:
- name: 🔀 Checking out repo
uses: actions/checkout@v2
- name: 🐍 Installing python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: 🪨 Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.16.0
- name: 🤖 Install Mephisto
run: pip install -e .
- name: 🖋 Create data directory
run: mkdir -p ~/mephisto/data
- name: 📂 Set the data directory
run: mephisto config core.main_data_directory ~/mephisto/data
- name: 📦 Setting up mephisto-task package
run: |
cd packages/mephisto-task
yarn install
yarn build
npm link
- name: ⌛️ Running cypress tests
uses: cypress-io/[email protected]
with:
build: npm i -D cypress@11
install: false
browser: chrome
project: ./examples/static_react_task/webapp
config-file: ./cypress.config.js
start: python examples/static_react_task/run_task.py mephisto.task.post_install_script=link_mephisto_task.sh
wait-on: "http://localhost:3000/?worker_id=x&assignment_id=1"
headless: true
# Learn more about the remote_procedure_tests here: https://github.com/facebookresearch/Mephisto/pull/800
remote_procedure_template:
needs: changes
if: ${{ (needs.changes.outputs.template == 'true') || (needs.changes.outputs.mephisto-task == 'true') || (needs.changes.outputs.abstractions == 'true') || (needs.changes.outputs.data_model == 'true') || (needs.changes.outputs.operations == 'true') || (needs.changes.outputs.tools == 'true')}}
runs-on: ubuntu-latest
steps:
- name: 🔀 Checking out repo
uses: actions/checkout@v2
- name: 🐍 Installing python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: 🪨 Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.16.0
- name: 🤖 Install Mephisto
run: pip install -e .
- name: 🖋 Create data directory
run: mkdir -p ~/mephisto/data
- name: 📂 Set the data directory
run: mephisto config core.main_data_directory ~/mephisto/data
- name: 📦 Setting up mephisto-task package
run: |
cd packages/mephisto-task
yarn install
yarn build
npm link
- name: ⌛️ Running cypress tests
uses: cypress-io/[email protected]
with:
build: npm i -D cypress@11
install: false
browser: chrome
project: ./examples/remote_procedure/template/webapp
config-file: ./cypress.config.js
start: python examples/remote_procedure/template/run_task.py mephisto.task.post_install_script=link_mephisto_task.sh
wait-on: "http://localhost:3000/?worker_id=x&assignment_id=1"
headless: true
remote_procedure_mnist:
needs: changes
if: ${{ (needs.changes.outputs.mnist == 'true') || (needs.changes.outputs.mephisto-task == 'true') }}
runs-on: ubuntu-latest
steps:
- name: 🔀 Checking out repo
uses: actions/checkout@v2
- name: 🐍 Installing python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: 🪨 Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.16.0
- name: 🤖 Install Mephisto
run: |
pip install -e .
pip install torch pillow numpy
- name: 🖋 Create data directory
run: mkdir -p ~/mephisto/data
- name: 📂 Set the data directory
run: mephisto config core.main_data_directory ~/mephisto/data
- name: 📦 Setting up mephisto-task package
run: |
cd packages/mephisto-task
yarn install
yarn build
npm link
- name: ⌛️ Running cypress tests
uses: cypress-io/[email protected]
with:
build: npm i -D cypress@11
install: false
browser: chrome
project: ./examples/remote_procedure/mnist/webapp
config-file: ./cypress.config.js
start: python examples/remote_procedure/mnist/run_task.py mephisto.task.post_install_script=link_mephisto_task.sh
wait-on: "http://localhost:3000/?worker_id=x&assignment_id=1"
headless: true
remote_procedure_toxicity_detection:
needs: changes
if: ${{ (needs.changes.outputs.toxicity_detection == 'true') || (needs.changes.outputs.mephisto-task == 'true') }}
runs-on: ubuntu-latest
steps:
- name: 🔀 Checking out repo
uses: actions/checkout@v2
- name: 🐍 Installing python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: 🪨 Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.16.0
- name: 🤖 Install Mephisto
run: pip install -e .
- name: 🖋 Create data directory
run: mkdir -p ~/mephisto/data
- name: 📂 Set the data directory
run: mephisto config core.main_data_directory ~/mephisto/data
- name: 📦 Setting up mephisto-task package
run: |
cd packages/mephisto-task
yarn install
yarn build
npm link
- name: ⌛️ Running cypress tests
uses: cypress-io/[email protected]
with:
build: npm i -D cypress@11
install: false
browser: chrome
project: ./examples/remote_procedure/toxicity_detection/webapp
config-file: ./cypress.config.js
start: python examples/remote_procedure/toxicity_detection/run_task.py mephisto.task.post_install_script=link_mephisto_task.sh
wait-on: "http://localhost:3000/?worker_id=x&assignment_id=1"
headless: true
# Learn more about this test here: https://github.com/facebookresearch/Mephisto/pull/833
static_react_task_with_tips:
needs: changes
if: ${{ (needs.changes.outputs.static_react_task_with_tips == 'true') || (needs.changes.outputs.mephisto-task == 'true') || (needs.changes.outputs.mephisto-worker-addons == 'true') || (needs.changes.outputs.abstractions == 'true') || (needs.changes.outputs.data_model == 'true') || (needs.changes.outputs.operations == 'true') || (needs.changes.outputs.tools == 'true')}}
runs-on: ubuntu-latest
steps:
- name: 🔀 Checking out repo
uses: actions/checkout@v2
- name: 🐍 Installing python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: 🪨 Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.16.0
- name: 🤖 Install Mephisto
run: |
pip install -e .
yes | pip uninstall detoxify
- name: 🖋 Create data directory
run: mkdir -p ~/mephisto/data
- name: 📂 Set the data directory
run: mephisto config core.main_data_directory ~/mephisto/data
- name: 📦 Setting up mephisto-task package
run: |
cd packages/mephisto-task
yarn install
yarn build
npm link
- name: 📦 Setting up mephisto-worker-addons package
run: |
cd packages/mephisto-worker-addons
yarn install
yarn build
npm link
- name: ⌛️ Running pre-submission cypress tests
uses: cypress-io/[email protected]
with:
build: npm i -D cypress@11
install: false
browser: chrome
project: ./examples/static_react_task_with_tips/webapp
config-file: ./cypress.config.js
spec: ./examples/static_react_task_with_tips/webapp/cypress/e2e/pre_submission_tests/*
start: python examples/static_react_task_with_tips/run_task.py mephisto.task.force_rebuild=true mephisto.task.post_install_script=link_packages.sh
wait-on: "http://localhost:3000/?worker_id=x&assignment_id=1"
headless: true
- name: 🔪 Killing the web server
run: |
lsof -nPi :3000
lsof -i -P -n | grep LISTEN | grep python | awk '{print $2}'
kill -INT $(lsof -i -P -n | grep LISTEN | grep python | awk '{print $2}')
echo "killed 1"
sleep 0.5
kill -INT $(lsof -i -P -n | grep LISTEN | grep python | awk '{print $2}')
echo "killed 2"
lsof -i -P -n | grep LISTEN | grep node | awk '{print $2}'
kill -INT $(lsof -i -P -n | grep LISTEN | grep node | awk '{print $2}')
sleep 30
echo "30 seconds passed"
- name: 🥛 Expiring units
run: |
cd mephisto/scripts/local_db/gh_actions
python expire_all_units.py
- name: 📚 Accepting the first submitted tip, accepting the second submitted tip, and rejecting the last submitted tip
run: |
cd mephisto/scripts/local_db
python review_tips_for_task.py << EOF
react-static-task-with-tips
a
5
The tip is very informative
a
0
r
EOF
- name: 🔥 Removing the second accepted tip
run: |
cd mephisto/scripts/local_db
python remove_accepted_tip.py << EOF
react-static-task-with-tips
n
y
EOF
- name: 📖 Reviewing the accepted feedback
run: |
cd mephisto/scripts/local_db
python review_feedback_for_task.py << EOF
react-static-task-with-tips
0
n
u
y
y
EOF
python review_feedback_for_task.py << EOF
react-static-task-with-tips
1
n
u
y
n
EOF
- name: ⌛️ Running post-submission cypress tests
uses: cypress-io/[email protected]
with:
build: npm i -D cypress@11
install: false
project: ./examples/static_react_task_with_tips/webapp
config-file: cypress.config.js
spec: ./examples/static_react_task_with_tips/webapp/cypress/e2e/post_submission_tests/*
start: python examples/static_react_task_with_tips/run_task.py mephisto.task.post_install_script=link_packages.sh mephisto.task.force_rebuild=true
wait-on: "http://localhost:3000/?worker_id=x&assignment_id=1"
browser: chrome
headless: true