-
Notifications
You must be signed in to change notification settings - Fork 35
658 lines (560 loc) · 18.8 KB
/
build_and_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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
name: Build and test Wikibase and friends
on:
workflow_dispatch:
inputs:
env_file:
description: 'Environment file'
required: true
default: '.env' # only gets set on a "workflow_dispatch" run
debug_extra_env:
description: 'Lines to append to the environment file (for easy mass testing)'
required: false
default: ''
push:
branches:
- "main"
pull_request:
paths-ignore:
- 'docs/**'
- '**/*.md'
- '**/*.txt'
env:
env_file: ${{ github.event.inputs.env_file || 'versions/wmde12.env' }}
jobs:
build_wikibase:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Add extra DEBUG env vars
if: "${{ github.event.inputs.debug_extra_env != '' }}"
run: |
printf "${{ github.event.inputs.debug_extra_env }}" >> ${{ env.env_file }}
cat ${{ env.env_file }}
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: variables.env
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: ${{ env.env_file }}
- name: Cache composer
uses: actions/cache@v3
env:
cache-name: cache-wikibase-composer
with:
path: cache
key: cache-wikibase-composer
- name: Cache git_cache repos
uses: actions/cache@v3
env:
cache-name: cache-wikibase-git-repo
with:
path: git_cache
key: cache-wikibase-git-repo
- name: Build Tarball
run: bash build.sh wikibase ${{ env.env_file }}
- name: Archive metadata artifacts
uses: actions/upload-artifact@v3
with:
name: BuildMetadata
if-no-files-found: error
path: artifacts/build_metadata_wikibase.env
- name: Archive tar production artifacts
uses: actions/upload-artifact@v3
with:
name: BuildArtifacts
if-no-files-found: error
path: artifacts/Wikibase.tar.gz
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.ref == 'refs/heads/main'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Store release version docker image on GHCR
if: github.ref == 'refs/heads/main'
uses: wmde/tag-push-ghcr-action@v3
with:
image_name: ${{ env.WIKIBASE_IMAGE_NAME }}
tag: ${{ github.run_id }}
- name: Archive base docker production artifact
uses: actions/upload-artifact@v3
with:
name: BuildArtifacts
if-no-files-found: error
path: artifacts/wikibase.docker.tar.gz
- name: Scan image
uses: ./.github/actions/scan-image
continue-on-error: true
with:
image_name: ${{ env.WIKIBASE_IMAGE_NAME }}
image_tag: latest
build_wikibase_bundle:
runs-on: ubuntu-latest
timeout-minutes: 20
needs:
- build_wikibase
steps:
- uses: actions/checkout@v4
- name: Add extra DEBUG env vars
if: "${{ github.event.inputs.debug_extra_env != '' }}"
run: |
printf "${{ github.event.inputs.debug_extra_env }}" >> ${{ env.env_file }}
cat ${{ env.env_file }}
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: variables.env
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: ${{ env.env_file }}
- name: Cache composer
uses: actions/cache@v3
env:
cache-name: cache-wikibase-composer
with:
path: cache
key: cache-wikibase-composer
- name: Cache git_cache repos
uses: actions/cache@v3
env:
cache-name: cache-wikibase-git-repo
with:
path: git_cache
key: cache-wikibase-git-repo
- name: Get dependency build artifacts
uses: actions/download-artifact@v3
with:
name: BuildArtifacts
path: artifacts/
- name: Build Bundle Docker Image
run: bash build.sh wikibase_bundle ${{ env.env_file }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.ref == 'refs/heads/main'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Store release version docker image on GHCR
if: github.ref == 'refs/heads/main'
uses: wmde/tag-push-ghcr-action@v3
with:
image_name: ${{ env.WIKIBASE_BUNDLE_IMAGE_NAME }}
tag: ${{ github.run_id }}
- name: Archive bundle docker production artifacts
uses: actions/upload-artifact@v3
with:
name: BuildArtifacts
if-no-files-found: error
path: artifacts/wikibase-bundle.docker.tar.gz
- name: Archive metadata artifacts
uses: actions/upload-artifact@v3
with:
name: BuildMetadata
if-no-files-found: error
path: artifacts/build_metadata_*.env
- name: Scan image
uses: ./.github/actions/scan-image
continue-on-error: true
with:
image_name: ${{ env.WIKIBASE_BUNDLE_IMAGE_NAME }}
image_tag: latest
build_quickstatements:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Add extra DEBUG env vars
if: "${{ github.event.inputs.debug_extra_env != '' }}"
run: |
printf "${{ github.event.inputs.debug_extra_env }}" >> ${{ env.env_file }}
cat ${{ env.env_file }}
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: variables.env
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: ${{ env.env_file }}
- name: Build QuickStatements Image
id: download_step
run: bash build.sh quickstatements ${{ env.env_file }}
- name: Archive metadata artifacts
uses: actions/upload-artifact@v3
with:
name: BuildMetadata
if-no-files-found: error
path: artifacts/build_metadata_*.env
- name: Archive docker production artifacts
uses: actions/upload-artifact@v3
with:
name: BuildArtifacts
if-no-files-found: error
path: artifacts/quickstatements.docker.tar.gz
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.ref == 'refs/heads/main'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Store release version docker image on GHCR
if: github.ref == 'refs/heads/main'
uses: wmde/tag-push-ghcr-action@v3
with:
image_name: ${{ env.QUICKSTATEMENTS_IMAGE_NAME }}
tag: ${{ github.run_id }}
- name: Scan image
uses: ./.github/actions/scan-image
continue-on-error: true
with:
image_name: ${{ env.QUICKSTATEMENTS_IMAGE_NAME }}
image_tag: latest
build_wdqs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Add extra DEBUG env vars
if: "${{ github.event.inputs.debug_extra_env != '' }}"
run: |
printf "${{ github.event.inputs.debug_extra_env }}" >> ${{ env.env_file }}
cat ${{ env.env_file }}
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: variables.env
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: ${{ env.env_file }}
- name: Cache wdqs service tar
uses: actions/cache@v3
env:
cache-name: cache-wdqs-backend-git-repo
with:
path: cache
key: cache-wdqs-backend-git-repo
- name: Build WDQS Image
id: download_step
run: bash build.sh wdqs ${{ env.env_file }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.ref == 'refs/heads/main'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Store release version docker image on GHCR
if: github.ref == 'refs/heads/main'
uses: wmde/tag-push-ghcr-action@v3
with:
image_name: ${{ env.WDQS_IMAGE_NAME }}
tag: ${{ github.run_id }}
- name: Archive docker production artifacts
uses: actions/upload-artifact@v3
with:
name: BuildArtifacts
if-no-files-found: error
path: artifacts/wdqs.docker.tar.gz
- name: Scan image
uses: ./.github/actions/scan-image
continue-on-error: true
with:
image_name: ${{ env.WDQS_IMAGE_NAME }}
image_tag: latest
build_wdqs_proxy:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Add extra DEBUG env vars
if: "${{ github.event.inputs.debug_extra_env != '' }}"
run: |
printf "${{ github.event.inputs.debug_extra_env }}" >> ${{ env.env_file }}
cat ${{ env.env_file }}
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: variables.env
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: ${{ env.env_file }}
- name: Build WDQS-proxy image
run: bash build.sh wdqs-proxy ${{ env.env_file }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.ref == 'refs/heads/main'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Store release version docker image on GHCR
if: github.ref == 'refs/heads/main'
uses: wmde/tag-push-ghcr-action@v3
with:
image_name: ${{ env.WDQS_PROXY_IMAGE_NAME }}
tag: ${{ github.run_id }}
- name: Archive docker production artifacts
uses: actions/upload-artifact@v3
with:
name: BuildArtifacts
if-no-files-found: error
path: artifacts/wdqs-proxy.docker.tar.gz
- name: Scan image
uses: ./.github/actions/scan-image
continue-on-error: true
with:
image_name: ${{ env.WDQS_PROXY_IMAGE_NAME }}
image_tag: latest
build_wdqs_frontend:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Add extra DEBUG env vars
if: "${{ github.event.inputs.debug_extra_env != '' }}"
run: |
printf "${{ github.event.inputs.debug_extra_env }}" >> ${{ env.env_file }}
cat ${{ env.env_file }}
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: variables.env
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: ${{ env.env_file }}
- name: Cache git_cache repos
uses: actions/cache@v3
env:
cache-name: cache-wdqs-frontend-git-repo
with:
path: git_cache
key: cache-wdqs-frontend-git-repo
- name: Build WDQS-frontend
run: bash build.sh wdqs-frontend ${{ env.env_file }}
- name: Archive metadata artifacts
uses: actions/upload-artifact@v3
with:
name: BuildMetadata
if-no-files-found: error
path: artifacts/build_metadata_wdqs_frontend.env
- name: Archive tar production artifacts
uses: actions/upload-artifact@v3
with:
name: BuildArtifacts
if-no-files-found: error
path: ./artifacts/wdqs-frontend.tar.gz
- name: Archive docker production artifacts
uses: actions/upload-artifact@v3
with:
name: BuildArtifacts
if-no-files-found: error
path: ./artifacts/wdqs-frontend.docker.tar.gz
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.ref == 'refs/heads/main'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Store release version docker image on GHCR
if: github.ref == 'refs/heads/main'
uses: wmde/tag-push-ghcr-action@v3
with:
image_name: ${{ env.WDQS_FRONTEND_IMAGE_NAME }}
tag: ${{ github.run_id }}
- name: Scan image
uses: ./.github/actions/scan-image
continue-on-error: true
with:
image_name: ${{ env.WDQS_FRONTEND_IMAGE_NAME }}
image_tag: latest
build_elasticsearch:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Add extra DEBUG env vars
if: "${{ github.event.inputs.debug_extra_env != '' }}"
run: |
printf "${{ github.event.inputs.debug_extra_env }}" >> ${{ env.env_file }}
cat ${{ env.env_file }}
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: variables.env
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: ${{ env.env_file }}
- name: Build Elasticsearch
run: bash build.sh elasticsearch ${{ env.env_file }}
- name: Archive docker production artifacts
uses: actions/upload-artifact@v3
with:
name: BuildArtifacts
if-no-files-found: error
path: ./artifacts/elasticsearch.docker.tar.gz
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.ref == 'refs/heads/main'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Store release version docker image on GHCR
if: github.ref == 'refs/heads/main'
uses: wmde/tag-push-ghcr-action@v3
with:
image_name: ${{ env.ELASTICSEARCH_IMAGE_NAME }}
tag: ${{ github.run_id }}
- name: Scan image
uses: ./.github/actions/scan-image
continue-on-error: true
with:
image_name: ${{ env.ELASTICSEARCH_IMAGE_NAME }}
image_tag: latest
test_wikibase:
strategy:
fail-fast: false
matrix:
suite: [
repo,
fedprops,
repo_client,
quickstatements,
pingback,
confirm_edit,
elasticsearch,
base__repo,
base__repo_client,
base__pingback,
base__fedprops,
]
databaseImageName: [ 'mariadb:10.9' ] # 'mysql:5.6' disabled https://phabricator.wikimedia.org/T296066
needs:
- build_wikibase_bundle
- build_wdqs
- build_elasticsearch
- build_wdqs_frontend
- build_wdqs_proxy
- build_quickstatements
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Get Wikibase docker image artifact
uses: actions/download-artifact@v3
with:
name: BuildArtifacts
path: artifacts/
- name: Run Tests - ${{ matrix.suite }}
env:
DATABASE_IMAGE_NAME: ${{ matrix.databaseImageName }}
run: make test SUITE=${{ matrix.suite }}
- name: Report Selenium
if: always()
run: |
cd .github/reporter
npm install
SUITE=${{ matrix.suite }} node report.js
- name: docker logs
if: always()
run: test/scripts/docker_logs.sh
- name: mediawiki logs
if: always()
continue-on-error: true
run: |
ls -lahr test/suites/${{ matrix.suite }}/results test/suites/${{ matrix.suite }}/results/*
tail -n +1 test/suites/${{ matrix.suite }}/results/*.log
- name: Archive docker test artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: TestArtifacts
path: test/suites/**/results
test_upgrade_base:
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
version: [
# Latest 1.37
'wmde.9',
# Latest 1.38
'wmde.10',
]
needs:
- build_wikibase
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Wikibase docker image artifact
uses: actions/download-artifact@v3
with:
name: BuildArtifacts
path: artifacts/
- name: Test upgrade version - ${{ matrix.version }}
# This step should only take ~5 mins to complete, but sometimes seems to lock up and use the whole job timeout
# Set a specific lower timeout to allow us to retry sooner
timeout-minutes: 10
run: make test-upgrade VERSION=${{ matrix.version }} TO_VERSION=${{ env.env_file }}
- name: docker logs
if: always()
run: test/scripts/docker_logs.sh
- name: Archive docker test artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: TestUpgradeArtifacts
path: test/suites/**/results
test_upgrade_bundle:
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
version: [
# Latest 1.37
'wmde.9-bundle',
# Latest 1.38
'wmde.10-bundle',
]
needs:
- build_wikibase_bundle
runs-on: ubuntu-latest
env:
TARGET_WIKIBASE_UPGRADE_IMAGE_NAME: wikibase-bundle
steps:
- uses: actions/checkout@v4
- name: Get Wikibase docker image artifact
uses: actions/download-artifact@v3
with:
name: BuildArtifacts
path: artifacts/
- name: Test upgrade version - ${{ matrix.version }}
# This step should only take ~5 mins to complete, but sometimes seems to lock up and use the whole job timeout
# Set a specific lower timeout to allow us to retry sooner
timeout-minutes: 10
run: make test-upgrade VERSION=${{ matrix.version }} TO_VERSION=${{ env.env_file }}
- name: docker logs
if: always()
run: test/scripts/docker_logs.sh
- name: Archive docker test artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: TestUpgradeArtifactsBundle
path: test/suites/**/results
versions:
needs:
- test_wikibase
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: ${{ env.env_file }}
- name: Build version requirements
run: bash build.sh requirements ${{ env.env_file }}
- name: Archive metadata artifacts
uses: actions/upload-artifact@v3
with:
name: BuildMetadata
if-no-files-found: error
path: artifacts/built_versions.log