-
Notifications
You must be signed in to change notification settings - Fork 0
305 lines (260 loc) · 9.68 KB
/
e2e-test.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
name: "E2E tests"
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '0 12 * * *'
jobs:
DynamicVersionMatrix:
name: Dynamic version matrix
runs-on: ubuntu-latest
outputs:
matrix: '[
{ tag: "develop", expected: "${{ steps.etherpad-version-cleaned.outputs.version }}" },
{ tag: "${{ steps.etherpad-version-cleaned.outputs.version }}", expected: "${{ steps.etherpad-version-cleaned.outputs.version }}" },
{ tag: "2.1.0", expected: "2.1.0" },
{ tag: "2.0.2", expected: "2.0.2" },
{ tag: "2.0.0", expected: "2.0.0" },
{ tag: "1.9.7", expected: "1.9.7" },
{ tag: "1.8.18", expected: "1.8.18" },
{ tag: "1.8.0", expected: "1.8.0" },
{ tag: "1.7.5", expected: "1.7.5" }
]'
version: ${{ steps.etherpad-version-cleaned.outputs.version }}
steps:
- id: etherpad
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ether/etherpad-lite
- id: etherpad-version-cleaned
run: |
LATEST_RELEASE=${{ steps.etherpad.outputs.release }}
CLEANED_VERSION="${LATEST_RELEASE//v/}"
echo "version=$CLEANED_VERSION" >> "$GITHUB_OUTPUT"
EtherpadWithNginxReverseProxy:
name: Docker [1.8.17] + Nginx (no websocket)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Start docker containers
run: |
EP_VERSION=1.8.17 docker compose -f ./tests/e2e/docker/docker-compose.no_websocket.yml up -d --wait
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Scan etherpad instance
uses: GuillaumeFalourd/assert-command-line-output@v2.4
with:
command_line: bin/console.php ether:scan -vvv http://localhost:8080 | grep -E "Package version|HTTP/1.1 400" | sed 's/ *$//'
assert_file_path: tests/e2e/fixture/reverse_proxy_no_websocket.txt
expected_result: PASSED
Etherpad2WithNginxReverseProxy:
name: Docker [${{ matrix.versions.tag }}] + Nginx (no websocket)
runs-on: ubuntu-latest
strategy:
matrix:
versions: [
{ tag: "2.2.2", expected: "2.2.2" },
{ tag: "2.0.2", expected: "2.0.2" },
{ tag: "2.0.0", expected: "2.0.0" },
]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Start docker containers
run: |
EP_VERSION=${{ matrix.versions.tag }} docker compose -f ./tests/e2e/docker/docker-compose.no_websocket.yml up -d --wait
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Scan etherpad instance
uses: GuillaumeFalourd/assert-command-line-output@v2.4
with:
command_line: bin/console.php ether:scan http://localhost:8080
contains: "Package version: ${{ matrix.versions.expected }}"
expected_result: PASSED
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
EtherpadWithNginxReverseProxyInSubPath:
name: Docker [${{ matrix.versions.tag }}] + Nginx (with subpath)
runs-on: ubuntu-latest
needs: DynamicVersionMatrix
strategy:
matrix:
versions: ${{ fromJSON(needs.DynamicVersionMatrix.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Start docker containers
run: |
EP_VERSION=${{ matrix.versions.tag }} docker compose -f ./tests/e2e/docker/docker-compose.subpath.yml up -d --wait
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Scan etherpad instance
uses: GuillaumeFalourd/assert-command-line-output@v2.4
with:
command_line: bin/console.php ether:scan http://localhost:8080/etherpad
contains: "Package version: ${{ matrix.versions.expected }}"
expected_result: PASSED
EtherpadWithNginxReverseProxyWithoutSubPath:
name: Docker [1.9.7] + Nginx (without subpath)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Start docker containers
run: |
EP_VERSION=1.9.7 docker compose -f ./tests/e2e/docker/docker-compose.reverse_proxy.yml up -d --wait
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Scan etherpad instance
uses: GuillaumeFalourd/assert-command-line-output@v2.4
with:
command_line: bin/console.php ether:scan http://localhost:8080/test
contains: "Package version: 1.9.7"
expected_result: PASSED
EtherpadWithPlugins:
name: Source [develop] with plugins
runs-on: ubuntu-latest
steps:
- name: Clone etherpad repository
uses: actions/checkout@v4
with:
repository: ether/etherpad-lite
path: etherpad
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: JarvusInnovations/background-action@v1
name: Start etherpad service
with:
run: |
npm install pnpm -g
bin/installDeps.sh
pnpm run plugins i ep_align ep_headings2 ep_table_of_contents ep_font_size ep_spellcheck ep_markdown
bin/run.sh &
wait-on: |
http://localhost:9001
log-output-if: failure
wait-for: 5m
working-directory: etherpad
- name: Checkout repository
uses: actions/checkout@v4
with:
path: app
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
working-directory: ./app
- name: Scan etherpad instance
uses: GuillaumeFalourd/assert-command-line-output@v2.4
with:
command_line: app/bin/console.php ether:scan http://localhost:9001 | sed 's/ *$//' | grep -vE "(Version is|Package version)" | grep -v "Server running since" | cut -d'@' -f1
assert_file_path: app/tests/e2e/fixture/master_with_plugins.txt
expected_result: PASSED
LatestEtherpad:
name: Docker [latest]
runs-on: ubuntu-latest
needs: DynamicVersionMatrix
services:
etherpad:
image: etherpad/etherpad:latest
ports:
- 9001:9001
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Create expected output file
run: |
cat tests/e2e/fixture/latest.txt | sed 's/$EP_VERSION/${{ needs.DynamicVersionMatrix.outputs.version }}/' > /tmp/latest.txt
- name: Scan etherpad instance
uses: GuillaumeFalourd/assert-command-line-output@v2.4
with:
command_line: bin/console.php ether:scan http://localhost:9001 | sed 's/ *$//' | grep -v "Server running since"
assert_file_path: /tmp/latest.txt
expected_result: PASSED
EtherpadDifferentVersion:
name: Docker [${{ matrix.versions.tag }}]
runs-on: ubuntu-latest
needs: DynamicVersionMatrix
services:
etherpad:
image: etherpad/etherpad:${{ matrix.versions.tag }}
ports:
- 9001:9001
strategy:
matrix:
versions: ${{ fromJSON(needs.DynamicVersionMatrix.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Scan etherpad instance
uses: GuillaumeFalourd/assert-command-line-output@v2.4
with:
command_line: bin/console.php ether:scan http://localhost:9001
contains: "Package version: ${{ matrix.versions.expected }}"
expected_result: PASSED