-
-
Notifications
You must be signed in to change notification settings - Fork 244
276 lines (244 loc) · 8.36 KB
/
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
name: Tests
on:
pull_request:
push:
branches:
- master
- develop
paths:
- 'src/**'
- 'test/**'
- 'package.json'
- 'package-lock.json'
- 'webpack*'
- 'gulpfile.js'
env:
APP_NAME: bookmarks
concurrency:
group: floccus-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
init:
runs-on: ubuntu-latest
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
node-version: [ 20.x ]
npm-version: [ 10.x ]
steps:
- name: Checkout floccus
uses: actions/checkout@v2
with:
path: floccus
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Set up npm ${{ matrix.npm-version }}
run: npm i -g npm@"${{ matrix.npm-version }}"
- name: Cache node modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies & build
working-directory: floccus
run: |
npm ci
npm run build-release --if-present
- name: Save context
uses: buildjet/cache/save@v3
with:
key: selenium-context-${{ github.run_id }}
path: ./
selenium:
runs-on: ubuntu-latest
needs: init
env:
SELENIUM_HUB_HOST: hub
TEST_HOST: nextcloud
SERVER_BRANCH: ${{ matrix.server-version }}
NC_APP_VERSION: ${{ matrix.app-version }}
MYSQL_PASSWORD: root
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
node-version: [20.x]
npm-version: [10.x]
server-version: ['30']
app-version: ['stable']
floccus-adapter:
- fake
- nextcloud-bookmarks
- webdav-xbel
- webdav-html
- webdav-html-encrypted
- webdav-xbel-encrypted
- git-xbel
- git-html
- google-drive
- google-drive-encrypted
- linkwarden
test-name:
- test
browsers:
- firefox
- chrome
include:
- app-version: master
server-version: 30
floccus-adapter: nextcloud-bookmarks
test-name: test
browsers: firefox
node-version: 14.x
npm-version: 7.x
- app-version: master
server-version: 30
floccus-adapter: nextcloud-bookmarks
test-name: benchmark root
browsers: firefox
node-version: 14.x
npm-version: 7.x
- app-version: stable
server-version: 28
floccus-adapter: fake-noCache
test-name: test
browsers: firefox
node-version: 14.x
npm-version: 7.x
name: ${{ matrix.browsers == 'firefox' && '🦊' || '🔵' }} ${{matrix.floccus-adapter}}:${{ matrix.test-name}} ⭐${{ matrix.app-version }}
services:
hub:
image: selenium/hub:4.20.0-20240425
ports:
- 4442:4442
- 4443:4443
- 4444:4444
firefox:
image: selenium/node-firefox:4.20.0-20240425
env:
SE_EVENT_BUS_HOST: hub
SE_EVENT_BUS_PUBLISH_PORT: 4442
SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
options: --shm-size="2g"
chrome:
image: selenium/node-chrome:4.20.0-20240425
env:
SE_EVENT_BUS_HOST: hub
SE_EVENT_BUS_PUBLISH_PORT: 4442
SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
options: --shm-size="2g"
nextcloud:
image: nextcloud:${{ matrix.server-version }}
env:
NEXTCLOUD_ADMIN_USER: admin
NEXTCLOUD_ADMIN_PASSWORD: admin
MYSQL_DATABASE: nextcloud
MYSQL_USER: root
MYSQL_PASSWORD: ${{env.MYSQL_PASSWORD}}
MYSQL_HOST: mysql
NEXTCLOUD_TRUSTED_DOMAINS: nextcloud
volumes:
- /home/runner/work/floccus/floccus/apps:/var/www/html/custom_apps
options: --name nextcloud
mysql:
image: mariadb:10.5 # see https://github.com/nextcloud/docker/issues/1536
env:
MYSQL_ROOT_PASSWORD: ${{env.MYSQL_PASSWORD}}
steps:
- name: Restore context
uses: buildjet/cache/restore@v3
with:
fail-on-cache-miss: true
key: selenium-context-${{ github.run_id }}
path: ./
- name: Checkout bookmarks app
uses: actions/checkout@v2
with:
repository: nextcloud/${{ env.APP_NAME }}
ref: ${{ matrix.app-version }}
path: ${{ env.APP_NAME }}
if: matrix.floccus-adapter == 'nextcloud-bookmarks' || matrix.floccus-adapter == 'nextcloud-bookmarks-old'
- name: Install bookmarks app
shell: bash
run: |
cd ${{ env.APP_NAME }}
composer install --ignore-platform-req=php --no-dev
if: matrix.floccus-adapter == 'nextcloud-bookmarks' || matrix.floccus-adapter == 'nextcloud-bookmarks-old'
- name: Enable bookmarks app
shell: bash
run: |
sudo cp -R ${{env.APP_NAME}} apps/
NEXT_WAIT_TIME=0
until [ $NEXT_WAIT_TIME -eq 25 ] || docker exec --user www-data nextcloud php occ app:enable ${{ env.APP_NAME }}; do
sleep $(( NEXT_WAIT_TIME++ ))
done
[ $NEXT_WAIT_TIME -lt 25 ]
if: matrix.floccus-adapter == 'nextcloud-bookmarks' || matrix.floccus-adapter == 'nextcloud-bookmarks-old'
- name: Enable APCu
run: |
NEXT_WAIT_TIME=0
until [ $NEXT_WAIT_TIME -eq 25 ] || docker exec --user www-data nextcloud php occ config:system:set --value "\\OC\\Memcache\\APCu" memcache.local; do
sleep $(( NEXT_WAIT_TIME++ ))
done
[ $NEXT_WAIT_TIME -lt 25 ]
if: matrix.floccus-adapter != 'fake'
- name: Wait for Selenium
run: |
sudo apt install -y jq
while ! curl -sSL "http://localhost:4444/wd/hub/status" 2>&1 \
| jq -r '.value.ready' 2>&1 | grep "true" >/dev/null; do
echo 'Waiting for the Grid'
sleep 1
done
echo "Selenium Grid is up - executing tests"
- name: Setup git http server
run: |
mkdir __fixtures__
cd __fixtures__
git init --bare test.git -b main
npx git-http-server &
npx htpasswd -cb test.git/.htpasswd admin admin
if: matrix.floccus-adapter == 'git-xbel' || matrix.floccus-adapter == 'git-html'
- name: Run git adapter tests
working-directory: floccus
env:
SELENIUM_BROWSER: ${{ matrix.browsers }}
FLOCCUS_TEST: ${{matrix.floccus-adapter}} ${{ matrix.test-name}}
FLOCCUS_TEST_SEED: ${{ github.sha }}
TEST_HOST: 172.17.0.1:8174
run: |
npm run test
if: matrix.floccus-adapter == 'git-xbel' || matrix.floccus-adapter == 'git-html'
- name: Run tests
working-directory: floccus
env:
SELENIUM_BROWSER: ${{ matrix.browsers }}
FLOCCUS_TEST: ${{matrix.floccus-adapter}} ${{ matrix.test-name}}
FLOCCUS_TEST_SEED: ${{ github.sha }}
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
GOOGLE_API_REFRESH_TOKEN: ${{ secrets.GOOGLE_API_REFRESH_TOKEN }}
LINKWARDEN_TOKEN: ${{ secrets.LINKWARDEN_TOKEN }}
APP_VERSION: ${{ matrix.app-version }}
run: |
npm run test
if: matrix.floccus-adapter != 'git-xbel' && matrix.floccus-adapter != 'git-html'
- name: Cancelling parallel jobs
if: failure() && matrix.floccus-adapter == 'fake' && matrix.test-name == 'test'
uses: andymckay/cancel-action@0.2
summary:
runs-on: ubuntu-latest
needs: [ init, selenium ]
if: always()
name: selenium-summary
steps:
- name: Summary status
run: if ${{ needs.init.result != 'success' || ( needs.selenium.result != 'success' && needs.selenium.result != 'skipped' ) }}; then exit 1; fi