-
Notifications
You must be signed in to change notification settings - Fork 15
130 lines (109 loc) · 3.72 KB
/
cypress.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
name: End-to-end tests (Cypress)
on: workflow_dispatch
permissions:
contents: "read"
id-token: "write"
jobs:
cypress-run:
services:
postgres:
image: postgres
env:
POSTGRES_USER: neptyne
POSTGRES_PASSWORD: neptyne
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
fail-fast: false
matrix:
# run copies of the current job in parallel
containers: [1, 2, 3, 4, 5]
env:
ALEMBIC_DB_URL: postgresql+pg8000://neptyne:neptyne@localhost/neptyne
NEPTYNE_DB_PASSWORD: neptyne
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "16"
cache: "yarn"
cache-dependency-path: frontend/yarn.lock
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set up python kernel venv
run: |
python -m pip install virtualenv
python -m venv neptyne_kernel/venv
neptyne_kernel/venv/bin/python -m pip install -r neptyne_kernel/requirements.txt
- name: Split cypress tests
run: |
ls cypress/e2e/specs/*.ts | \
python cypress/e2e/spec_buckets.py ${{ strategy.job-index }} ${{ strategy.job-total }} \
>> $GITHUB_ENV
working-directory: frontend
- uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements-dev.txt') }}
- uses: actions/cache@v4
with:
path: frontend/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('frontend/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules
- name: Set up firebase emulation
run: |
curl -Lo ./firebase https://firebase.tools/bin/linux/v10.2.2
chmod +x ./firebase
./firebase emulators:start \
--only auth,firestore \
--project demo-neptyne \
--import testing/firebase_emulator_data &
- run: python -m pip install -r requirements-dev.txt
- name: Run migrations
run: alembic upgrade head
- name: Seed the database
run: python -m testing.seed_test_data
- name: Start the server
run: python -m server.application >server-logs.txt 2>&1 &
env:
PYTHONUNBUFFERED: true
# this will fail if it has a scheme
FIREBASE_AUTH_EMULATOR_HOST: "localhost:9099"
FIRESTORE_EMULATOR_HOST: "localhost:8080"
GOOGLE_CLOUD_PROJECT: "demo-neptyne"
- name: Install cypress binary
run: |
yarn cypress install
working-directory: frontend
- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: frontend
build: yarn install
start: yarn start-with-emulated-auth
wait-on: "http://localhost:3000/login"
wait-on-timeout: 600
spec: "${{ env.CY_SPEC }}"
env:
# this will fail if it does *not* have a scheme
FIREBASE_AUTH_EMULATOR_HOST: "http://localhost:9099"
GOOGLE_CLOUD_PROJECT: "demo-neptyne"
GOOGLE_APPLICATION_CREDENTIALS: ""
- uses: actions/upload-artifact@v4
if: always()
with:
name: server-logs-${{ strategy.job-index }}
path: server-logs.txt
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots-${{ strategy.job-index }}
path: frontend/cypress/screenshots