-
Notifications
You must be signed in to change notification settings - Fork 44
125 lines (112 loc) · 3.73 KB
/
cypress-testing.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
name: Integration Testing
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
glific:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14 # postgres image for test database.
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: glific_dev
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
matrix: # build matrix for the job
elixir: [1.15.4-otp-26]
otp: [26.0.2]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# frontend setup
- name: Setup frontend
uses: actions/checkout@v3
- name: Use latest Node.js
uses: actions/setup-node@v3
- name: Setup elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Setup frontend
run: |
echo copy env file.
cp .env.example .env
echo done.
cat /proc/sys/fs/inotify/max_user_watches
echo set watchers
sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl -p
cat /proc/sys/fs/inotify/max_user_watches
echo start yarn setup.
yarn setup
echo done.
# backend setup
- name: Setup backend
run: |
echo '127.0.0.1 glific.test' | sudo tee -a /etc/hosts
echo '127.0.0.1 postgres' | sudo tee -a /etc/hosts
echo '127.0.0.1 api.glific.test' | sudo tee -a /etc/hosts
cd ../
echo clone glific repo
git clone https://github.com/glific/glific.git
echo done. go to dir.
cd glific
echo done. start dev.secret.exs config
cd priv
mkdir cert
cd cert
echo "${{ secrets.TEST_CERTIFICATE }}" > glific.test+1.pem
echo "${{ secrets.TEST_CERTIFICATE_KEY }}" > glific.test+1-key.pem
cd ../../
cd config
cp dev.secret.exs.txt dev.secret.exs
cp .env.dev.txt .env.dev
sed -i 's/:max_rate_limit_request, 60/:max_rate_limit_request, 300/g' config.exs
echo copy done. start setup
cd ../
echo install mix dependencies if not Cached
mix local.rebar --force
mix local.hex --force
mix hex.repo add oban https://getoban.pro/repo --fetch-public-key ${{ secrets.OBAN_PUBLIC_KEY }} --auth-key ${{ secrets.OBAN_PRO_KEY }}
mix deps.get
echo start mix setup
echo done. start installing inotify-tools
sudo apt-get install inotify-tools
mix setup
cd ../glific-frontend/
# cypress setup
- name: Setup cypress
run: |
echo clone cypress repo
git clone https://github.com/glific/cypress-testing.git
echo done. go to dir.
cd cypress-testing
git checkout main
cd ..
cp -r cypress-testing/cypress cypress
yarn add [email protected]
echo Create cypress.config.ts from example
cp cypress-testing/cypress.config.ts.example cypress.config.ts
# Run frontend
- name: Run glific frontend
run: |
yarn dev &
# Run backend
- name: Run glific backend
run: |
cd ../glific/
mix phx.server &
cd ../glific-frontend/
- name: Wait for some time for the frontend to start
run: |
sleep 3m
# Run cypress
- name: Cypress run
run: |
yarn run cypress run --record --key ${{ secrets.CYPRESS_DASHBOARD_KEY }}