-
-
Notifications
You must be signed in to change notification settings - Fork 17
282 lines (280 loc) · 11.5 KB
/
tests.yml
File metadata and controls
282 lines (280 loc) · 11.5 KB
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
name: nightly tests
on:
workflow_dispatch:
inputs:
core:
type: boolean
description: "core"
default: 'true'
required: false
servers:
type: boolean
description: "servers"
default: 'true'
required: false
exports:
type: boolean
description: "exports"
default: 'true'
required: false
api:
type: boolean
description: "api"
default: 'true'
required: false
views:
type: boolean
description: "views"
default: 'true'
required: false
schedule:
- cron: '0 3 * * *'
jobs:
build:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:8
ports:
- 27017:27017
redis:
image: redis:6-alpine
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- name: install nodejs
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
check-latest: false
- name: install nvm
run: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash
echo -n 'nvm "$@" && echo $NVM_BIN >> $GITHUB_PATH' >> ~/.nvm/nvm.sh
sudo cp ~/.nvm/nvm.sh /usr/local/bin/nvm
sudo chmod +x /usr/local/bin/nvm
- name: checkout api
uses: actions/checkout@v4
with:
repository: "undev-studio/cables_api"
ref: develop
token: ${{ secrets.undev_token }}
path: "cables_api/"
fetch-depth: 0
- name: checkout asset library
uses: actions/checkout@v4
with:
repository: "cables-gl/cables-asset-library"
ref: master
token: ${{ secrets.undev_token }}
path: "cables_api/public/assets/library"
fetch-depth: 0
- name: setup repos
run: |
./install_local.sh https --community
- name: configure mochajs for github
run: |
echo '{"reporter": "mocha-ctrf-json-reporter"}' > ./.mocharc.json
- name: core tests
if: ${{ !contains(inputs.core, 'false') }}
timeout-minutes: 10
continue-on-error: true
run: |
cd cables/
npm run test
- name: checkout docs
uses: actions/checkout@v4
with:
repository: "cables-gl/cables_docs"
ref: develop
token: ${{ secrets.undev_token }}
path: "cables_docs/"
fetch-depth: 0
- name: build api
run: |
cd cables_api/
npm install --no-save
touch scss/svgicons.scss
npm run build
- name: Server dev/live Tests
if: ${{ !contains(inputs.servers, 'false') }}
timeout-minutes: 10
continue-on-error: true
run: |
cd cables_api/
npm run test:servers
env:
CABLES_USER_APIKEY: ${{ secrets.cables_user_apikey }}
- name: Store dev/live Tests Summary Results
if: ${{ !contains(inputs.servers, 'false') }}
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './cables_api/ctrf/*.json'
github-report: true
summary-delta-report: true
insights-report: true
flaky-rate-report: true
fail-rate-report: true
slowest-report: true
upload-artifact: true
suite-folded-report: true
artifact-name: "devlive-report"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish dev/live Tests Results on discord
if: ${{ !contains(inputs.servers, 'false') }}
continue-on-error: true
run: |
cd cables_api/
node hooks/discord_testresults.js ctrf/ctrf-report.json
env:
CABLES_TEST_TITLE: "HTTP dev/live Tests"
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_TESTRESULTS_WEBHOOK }}
- name: checkout electron for exe export
if: ${{ !contains(inputs.exports, 'false') }}
uses: actions/checkout@v4
with:
repository: "cables-gl/cables-exe-export"
ref: develop
token: ${{ secrets.undev_token }}
path: "electron"
fetch-depth: 0
- name: create exe-export LFS file list
if: ${{ !contains(inputs.exports, 'false') }}
run: |
cd electron/
git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
- name: restore exe-export LFS cache
if: ${{ !contains(inputs.exports, 'false') }}
uses: actions/cache@v4
id: exe-export-lfs-cache
with:
path: electron/.git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('electron/.lfs-assets-id') }}-v1
- name: pull exe-export LFS files
if: ${{ !contains(inputs.exports, 'false') }}
run: |
cd electron/
git lfs pull
- name: Export Tests
if: ${{ !contains(inputs.exports, 'false') }}
timeout-minutes: 10
continue-on-error: true
run: |
cd cables_api/
npm run test:export
- name: Store Export Tests Summary Results
if: ${{ !contains(inputs.exports, 'false') }}
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './cables_api/ctrf/*.json'
github-report: true
summary-delta-report: true
insights-report: true
flaky-rate-report: true
fail-rate-report: true
slowest-report: true
upload-artifact: true
suite-folded-report: true
artifact-name: "export-report"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Export Tests Results on discord
if: ${{ !contains(inputs.exports, 'false') }}
continue-on-error: true
run: |
cd cables_api/
node hooks/discord_testresults.js ctrf/ctrf-report.json
env:
CABLES_TEST_TITLE: "Export Tests"
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_TESTRESULTS_WEBHOOK }}
- name: Install PM2 locally
run: npm install pm2@6.0.13 -g
- name: Run PM2
run: |
npm run pm2:test &
shell: bash
- name: Wait for Express on port 5711
run: |
echo "Waiting for tcp:5711..."
time npx wait-on http://localhost:5711/login --timeout 30000 -v
echo "Port 5711 is up!"
echo "Waiting for tcp:5713..."
time npx wait-on http://localhost:5713/api/ops/code --timeout 30000 -v
echo "Port 5713 is up!"
- name: Check what listens on 5711
run: |
echo "Listening on 5711:"
ss -tlnp | grep 5711 || netstat -tlnp | grep 5711
- name: Try HTTP hit
run: |
echo "curl GET http://127.0.0.1:5711/login"
curl -v http://127.0.0.1:5711/login
- name: API Tests
if: ${{ !contains(inputs.api, 'false') }}
timeout-minutes: 10
continue-on-error: true
run: |
cd cables_api/
npm run test:api
- name: Store API Tests Summary Results
if: ${{ !contains(inputs.api, 'false') }}
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './cables_api/ctrf/*.json'
github-report: true
summary-delta-report: true
insights-report: true
flaky-rate-report: true
fail-rate-report: true
slowest-report: true
upload-artifact: true
suite-folded-report: true
artifact-name: "api-report"
- name: Publish API Tests Results on discord
if: ${{ !contains(inputs.api, 'false') }}
continue-on-error: true
run: |
cd cables_api/
node hooks/discord_testresults.js ctrf/ctrf-report.json
env:
CABLES_TEST_TITLE: "API Tests"
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_TESTRESULTS_WEBHOOK }}
- name: Views Tests
if: ${{ !contains(inputs.views, 'false') }}
timeout-minutes: 10
continue-on-error: true
run: |
cd cables_api/
npm run test:views
- name: Store Views Tests Summary Results
if: ${{ !contains(inputs.views, 'false') }}
uses: ctrf-io/github-test-reporter@v1
with:
report-path: './cables_api/ctrf/*.json'
github-report: true
summary-delta-report: true
insights-report: true
flaky-rate-report: true
fail-rate-report: true
slowest-report: true
upload-artifact: true
suite-folded-report: true
artifact-name: "views-report"
- name: Publish Views Tests Results on discord
if: ${{ !contains(inputs.views, 'false') }}
continue-on-error: true
run: |
cd cables_api/
node hooks/discord_testresults.js ctrf/ctrf-report.json
env:
CABLES_TEST_TITLE: "Views Tests"
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_TESTRESULTS_WEBHOOK }}
- name: Upload PM2 logs
uses: actions/upload-artifact@v4
with:
name: pm2-logs
path: |
~/.pm2/logs/*.log
if-no-files-found: warn