Repository navigation
1765 lines (1726 loc) · 78 KB
/
Copy pathci.yml
File metadata and controls
1765 lines (1726 loc) · 78 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
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
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SPDX-FileCopyrightText: 2026 Anton Wiklund and Solid Memo contributors
#
# SPDX-License-Identifier: MIT
name: CI
# Every change is checked before it is merged (docs/testing.md#continuous-integration):
# a pull request, from this repository or a fork, runs every job here,
# and a push to main every job or none but those that reuse the run that
# tested its tree, as the gate decides (below). A pull request is merged
# through the merge queue (merge_group), which runs them again on the
# pull request on top of main and of those ahead of it in the queue, and
# merges exactly the commit that passed. A branch's pushes alone run
# nothing, so a pull request's commits are not checked twice for one
# push. The jobs read the repository and nothing else: the token can
# only read, and no secret is used, so a fork's pull request neither
# writes to the repository nor reads a secret. The exceptions, caches,
# which runs on main alone, and the fail-fast jobs, which never run for a
# fork, run no code of the repository's. A pull request's run uses the
# workflow files it carries, so the repository requires approval of every
# outside contributor's run (docs/releasing.md#runs-from-forks). Only
# runs on main save Turbo's cache and the end-to-end images, Turbo's
# being the queue's when main's run reuses it; a pull request and the
# merge queue read main's.
#
# A tree is tested once (docs/releasing.md#what-each-stage-checks): the
# gate job has every job run in a pull request, in the merge queue, by
# hand, and on a push to main that skipped the queue, but on a push the
# queue passed, or a release commit, whose tree the queue (or its
# parent's full run) already tested, the run reuses that one: the jobs
# that test are skipped, and reuse takes over the site and Turbo's cache
# it made. A job that runs blocks. Each job is labeled deterministic, the
# same answer on any runner, or timing-dependent, its answer hanging on
# how busy the runner or a real server is
# (docs/testing.md#deterministic-and-timing-dependent-jobs).
on:
pull_request:
merge_group:
push:
branches: [main]
workflow_dispatch:
inputs:
trace:
description: Keep the user journeys' traces, videos and screenshots even when they pass
type: boolean
default: false
permissions:
contents: read
# A newer run of a pull request's or a branch's checks cancels the one
# still going, and so does a merge queue run of a pull request that the
# queue built again, as it does when main moves under it. Each build of
# an entry has a ref of its own (gh-readonly-queue/main/pr-<N>-<base>,
# the base being the commit of main it was built on), so its group is
# keyed on its merge commit's message instead ("Merge pull request #<N>
# from ..."), which every build of one entry keeps, and which no other
# entry has. Runs on main are never canceled: release.yml releases, and
# deploy.yml deploys a release commit, only after a push run on main that
# passed, so a push run canceled by a later run, a manual one included,
# would leave its commit unreleased, or its version undeployed. Each event
# has its own group, so a run by hand never waits for a push run, and push
# runs on main go one at a time, in order; one waiting is replaced by a
# newer push, which a release then includes. A release commit's run has a
# group of its own: only that run can deploy its version, so no newer push
# may replace it.
concurrency:
group: >-
ci-${{ github.event_name }}-${{
github.event_name == 'merge_group' && github.event.merge_group.head_commit.message ||
github.ref }}${{
startsWith(github.event.head_commit.message, 'chore(release): ') &&
format('-{0}', github.sha) || '' }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
# What this run runs (npm run ci:gate): every job (jobs=all), or only
# those that reuse the run that tested this tree (jobs=reuse), that run
# being tested-by. On a release commit, it also
# fails unless the commit changes nothing but the files a release
# writes. Only on a push to main does it ask GitHub's API: whether the
# merge queue passed the commit, or CI on main a release commit's
# parent. Deterministic.
gate:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
# To look up CI's runs on the commit and on its parent.
actions: read
outputs:
jobs: ${{ steps.gate.outputs.jobs }}
tested-by: ${{ steps.gate.outputs.tested-by }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 2
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
# The script imports no package, so nothing is installed.
- id: gate
env:
GH_TOKEN: ${{ github.token }}
run: npm run ci:gate
# npm run check:ci, but for the growth tests, which the growth job
# runs. Deterministic.
check:
needs: gate
if: needs.gate.outputs.jobs == 'all'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
# Turbo's cache, so a task whose inputs have not changed is not run
# again. The key is this job's alone: a key is saved once, by the
# first job to finish, and another job's cache would not hold the
# check's results. Each run restores the last one and adds to it, so
# entries older than two weeks are evicted (TURBO_CACHE_MAX_AGE).
# Only a run on main saves it, below: a pull request's or the merge
# queue's copy would be kept apart, under its own ref, and never
# read again, while it would count toward the repository's 10 GB.
- id: turbo
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo/cache
key: turbo-check-${{ github.sha }}
restore-keys: turbo-check-
- run: npm ci --ignore-scripts
# The registry's record of every installed version is signed with
# its keys, and any attestation of where the version was built
# (provenance) verifies. It fails on an invalid signature or
# attestation, and on a version with no signature from a registry
# that has keys, so a pull request that changes package-lock.json,
# Renovate's included, fails on one. It checks the registry's
# record, not the lockfile's hashes or the files installed
# (docs/testing.md#the-workflows).
- run: npm audit signatures
# Chromium, which site's tests draw the docs' Mermaid diagrams in
# (docs/markdown.md).
- uses: ./.github/actions/chromium
# npm run check:ci, a step per part, so that the jobs API shows how
# long each takes. A later part also runs when an earlier part
# failed, so that a run shows every failure, but not when a step
# before the parts failed: the lints step runs only after every
# step above passed, and the later parts only after it ran. npm run
# check without the deck library, which the library job checks,
# and compares with the base. First Biome's formatting and lint
# rules (docs/style.md), markdownlint's, cspell's and the prose
# check's (docs/testing.md#documentation).
- id: lints
run: npm run check:lints
# Every package: typecheck, tests at 100% coverage, the round trip
# of the library's releases, generated code and Turtle formatting
# in step with their sources.
- if: ${{ !cancelled() && (steps.lints.outcome == 'success' || steps.lints.outcome == 'failure') }}
run: npm run check:tasks
env:
TURBO_CACHE_MAX_AGE: 14d
# The boundaries, the docs' index (docs/docs.ttl), the shipped
# dependencies' maturity and the repository's other checks
# (docs/testing.md#the-repositorys-own-checks).
- if: ${{ !cancelled() && (steps.lints.outcome == 'success' || steps.lints.outcome == 'failure') }}
run: npm run check:repository
# Each package's coverage, in the run's summary; the thresholds that
# gate are each package's own, in npm run check.
- if: success() || failure()
run: npm run coverage:summary
- if: github.ref == 'refs/heads/main' && steps.turbo.outputs.cache-hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo/cache
key: turbo-check-${{ github.sha }}
# In the queue, the cache is kept as the run's turbo-cache artifact
# instead: main's run of the same commit reuses this run (gate's
# tested-by), and saves it as main's (the reuse job). Its entries are
# compressed already.
- if: github.event_name == 'merge_group'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: turbo-cache
path: .turbo/cache/
include-hidden-files: true
compression-level: 0
retention-days: 7
if-no-files-found: error
overwrite: true
# The growth tests (npm run test:growth): work that must take time
# growing with its input, not its square, timed as the ratio of two
# runs' CPU time on the same runner, which a busy runner leaves about
# the same (packages/domain/src/testing/growth.ts). A job of its own,
# beside check, so that check's tests don't wait for theirs, and
# without coverage, which slows them and which check's tests measure
# whole. No Turbo cache: they run on every run, as a cache of their
# own would need main's, saved from the queue's run as check's is.
# Deterministic.
growth:
needs: gate
if: needs.gate.outputs.jobs == 'all'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
- run: npm run test:growth
# Main's older Turbo caches, deleted once check or reuse has saved its
# own, which was built on them, and they would count toward the
# repository's 10 GB until GitHub's 7 days are up; with them, the
# older entries of three other caches that only grow. A job of its own, so
# the only token that can delete caches is in a job that runs none of
# the repository's code; and one that may fail without failing the run,
# which release.yml and deploy.yml wait for. Deterministic.
caches:
if: >-
github.ref == 'refs/heads/main' && !cancelled() &&
(needs.check.result == 'success' || needs.reuse.result == 'success')
needs: [check, reuse]
runs-on: ubuntu-latest
timeout-minutes: 5
continue-on-error: true
permissions:
actions: write
steps:
# shell: bash runs with pipefail, which the default does not, so a list
# that fails fails the step instead of deleting nothing.
- name: Keep only the newest Turbo cache
shell: bash
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
gh cache list --ref refs/heads/main --key turbo-check- --sort created_at --order desc --limit 100 \
--json id --jq '.[1:][].id' | xargs -r -n1 gh cache delete
# GitHub's CodeQL scan saves a database of the code for each run on
# main, a few hundred MB, and reads only the newest of its
# language's: the key's seventh part.
- name: Keep only the newest CodeQL database of each language
shell: bash
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
gh cache list --ref refs/heads/main --key codeql-overlay-base-database- --limit 1000 \
--json id,key,createdAt \
--jq 'group_by(.key | split("-")[6]) | .[] | sort_by(.createdAt) | reverse | .[1:][].id' |
xargs -r -n1 gh cache delete
# The end-to-end images' (.github/actions/e2e-images): an entry per
# server and key, the key's last part what names its images, so a
# changed image leaves the older entry, which main never reads again.
# A revert to an older key, still cached, leaves its entry the older,
# and so deleted, until a run of main misses it and saves it again.
- name: Keep only the newest images of each end-to-end server
shell: bash
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
gh cache list --ref refs/heads/main --key e2e-images- --limit 1000 \
--json id,key,createdAt \
--jq 'group_by(.key | split("-") | .[:-1]) | .[] | sort_by(.createdAt) | reverse | .[1:][].id' |
xargs -r -n1 gh cache delete
# The system libraries' (.github/actions/playwright-deps): an entry
# per runner image, the two newest kept, as both run while GitHub
# rolls a new image out.
- name: Keep only the newest system libraries of each browser
shell: bash
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
for browser in chromium firefox webkit; do
gh cache list --ref refs/heads/main --key "playwright-deps-$browser-" --sort created_at --order desc --limit 100 \
--json id --jq '.[2:][].id'
done | xargs -r -n1 gh cache delete
# The site, built once for the whole run (npm run build): the journeys
# test this build, which they download, rather than each building its
# own. It reads no Turbo cache: the build states the commit, so it is
# never found there, and vocab's generate:check, the one task it runs
# first, is check's to cache. Chromium's headless shell draws the docs'
# diagrams. The build is kept a week, as the journeys' blobs are, so
# that a journeys job run again (Re-run failed jobs), which does not
# build it again, still finds it; a job run again replaces it. It is
# the site deploy.yml ships, so nothing in it comes from GitHub's cache
# (docs/deployment.md#the-build-ci-tested): any job on main can write
# main's cache entries. In the merge queue and on main it attests the
# site's manifest, and the deploy ships the artifact only if it matches
# that attestation, so no other job of the run can stand in a site of
# its own. Deterministic.
site:
needs: gate
if: needs.gate.outputs.jobs == 'all'
runs-on: ubuntu-latest
permissions:
contents: read
# To attest the site's manifest (actions/attest), this job alone.
id-token: write
attestations: write
artifact-metadata: write
# Room for Ubuntu's mirror to stall (actions/playwright-deps gives each
# apt-get four tries of three minutes), as any library the image
# lacks comes from it every time.
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Without npm's cache, which setup-node would restore for
# packageManager in package.json.
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
package-manager-cache: false
- run: npm ci --ignore-scripts
# Downloaded and checked against a committed SHA-256, with its
# system libraries from Ubuntu's signed mirror, not restored from
# the cache.
- uses: ./.github/actions/chromium
with:
cache: false
- run: npm run build
# Every file of the site and its SHA-256, in one list the deploy
# makes again from the artifact it downloads (deploy.yml's build
# job), attested as this workflow's on that commit. A pull request's
# site is never deployed, and a fork's run can't attest.
- name: The site's manifest
if: github.event_name == 'merge_group' || github.event_name == 'push'
working-directory: apps/web/dist
run: find . ! -type d -print0 | LC_ALL=C sort -z | xargs -0r sha256sum > "$RUNNER_TEMP/site.sha256"
- if: github.event_name == 'merge_group' || github.event_name == 'push'
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
with:
subject-path: ${{ runner.temp }}/site.sha256
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: site
path: apps/web/dist/
retention-days: 7
if-no-files-found: error
overwrite: true
# The change compared with its base. The deck library
# (docs/deck-library.md#checks): no published version
# (decks/<name>/v<N>.ttl) edited or removed, and every version new
# since then naming the library's contact and no email. The public
# API (docs/releasing.md#how-ci-holds-to-it): no line of api/ gone
# unless a commit says the change breaks, and none of api/frozen/ at
# all. Earlier releases' own code
# (docs/releasing.md#what-never-changes): a pod is exchanged with
# the first release that has the exchange's runner and the first of
# each major version after it, each checked out from its tag with
# its own dependencies, which read and save what this change wrote.
# It needs the whole history and the tags, which check does not, so
# it is a job of its own. Deterministic.
library:
needs: gate
if: needs.gate.outputs.jobs == 'all'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
# On a push to the default branch, compare with the commit the push
# moved it from; in the merge queue, with the commit of the
# default branch the queue built on, so the pull requests ahead
# are part of the change; on a pull request (its merge with the
# default branch) or a run by hand, with where it left the default
# branch, so a version not merged yet can still be fixed there. A
# push that created the default branch (all zeros), or one whose
# earlier commit a force push left unfetched, compares with the
# default branch.
- name: Find the base
id: base
env:
EVENT: ${{ github.event_name }}
REF: ${{ github.ref }}
BEFORE: ${{ github.event.before }}
QUEUE_BASE: ${{ github.event.merge_group.base_sha }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
if [ "$EVENT" = merge_group ]; then
base="$QUEUE_BASE"
elif [ "$EVENT" = push ] && [ "$REF" = "refs/heads/$DEFAULT_BRANCH" ] && [ -n "$BEFORE" ] && ! [[ "$BEFORE" =~ ^0+$ ]] && git cat-file -e "$BEFORE^{commit}" 2>/dev/null; then
base="$BEFORE"
else
git fetch --no-tags origin "+refs/heads/$DEFAULT_BRANCH:refs/remotes/origin/$DEFAULT_BRANCH"
base="$(git merge-base HEAD "origin/$DEFAULT_BRANCH")"
fi
echo "Comparing with $base"
echo "sha=$base" >> "$GITHUB_OUTPUT"
- name: npm run library:check -- --base <base>
env:
BASE: ${{ steps.base.outputs.sha }}
run: npm run library:check -- --base "$BASE"
# After the library's check, whatever it found: the two are apart.
- name: npm run check:breaking -- --base <base>
if: success() || failure()
env:
BASE: ${{ steps.base.outputs.sha }}
run: npm run check:breaking -- --base "$BASE"
# After both, whatever they found. The checkout above fetched every
# tag with the history.
- name: npm run check:exchange
if: success() || failure()
run: npm run check:exchange
# The vocabulary, the deck library and pod catalog documents, checked
# again by an independent SHACL engine (pySHACL), SPARQL constraints
# included. It reads only files in the repository (no npm install, no
# generated code, no build), so it runs beside check rather than after
# it, and the deploy waits for it like every other job here.
# Deterministic.
crosscheck:
needs: gate
if: needs.gate.outputs.jobs == 'all'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.15"
cache: pip
cache-dependency-path: scripts/requirements-ci.txt
- run: pip install --require-hashes -r scripts/requirements-ci.txt
# The script's own tests (scripts/test_shacl_crosscheck.py), on
# small documents of their own, before it checks the real ones, and
# the taxonomy deck generator's (scripts/test_taxonomy_deck.py) and the
# Wikidata labels script's (scripts/test_wikidata_labels.py).
- run: python -m unittest discover -s scripts
- run: python scripts/shacl_crosscheck.py
# The app's use cases and Solid adapters against real Solid servers,
# one job per server (e2e/pod/servers.ts): each pulls or builds only its
# server's image, or loads it from GitHub's cache (e2e-images), starts it
# in Docker on this runner and runs the whole suite (docs/testing.md). Off main, one server failing cancels the others;
# what the server printed is kept when its job fails. Only a run on main
# saves the images; elsewhere, new images are pulled through the mirror.
# Timing-dependent: real servers, started on a shared runner. Where it is
# skipped on main, warm saves the images it would have.
pod:
name: pod (${{ matrix.server }})
needs: gate
if: needs.gate.outputs.jobs == 'all'
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
# Off main, one server failing cancels the others, and fail-fast-pod
# the run; on main, each runs to its end, saving its images.
fail-fast: ${{ github.ref != 'refs/heads/main' }}
matrix:
server: [css-7, css-6, nss-6, nss-5, css-acp]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
- id: key
run: echo "key=$(node e2e/pod/servers.ts key ${{ matrix.server }})" >> "$GITHUB_OUTPUT"
- id: images
uses: ./.github/actions/e2e-images
with:
name: pod-${{ matrix.server }}
key: ${{ steps.key.outputs.key }}
- run: npm run servers -w @solid-memo/e2e-pod -- ${{ matrix.server }}
- if: steps.images.outputs.hit != 'true' && github.ref == 'refs/heads/main'
env:
FILE: ${{ steps.images.outputs.file }}
run: node e2e/pod/images.ts save "$FILE" e2e/pod/servers/${{ matrix.server }}/compose.yml
- if: steps.images.outputs.hit != 'true' && github.ref == 'refs/heads/main'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
continue-on-error: true
with:
path: ${{ steps.images.outputs.file }}
key: ${{ steps.images.outputs.key }}
- run: npm run test:pod
env:
SOLID_SERVERS: ${{ matrix.server }}
- if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: pod-logs-${{ matrix.server }}
path: e2e/pod/logs/
retention-days: 7
# The second Solid client, solid-memo-client (packages/solid-memo-client),
# put in place of Inrupt's by SOLID_CLIENT (scripts/solidClient.ts) and
# run through the tests of the packages that use it: solid's, its round
# trip included, shacl's, composition's and web's, without the tests of
# the Inrupt modules it replaces, which test those modules themselves.
# Its own tests are check's, in npm run check. Advisory: it only
# reports, so a failure fails neither the run nor ci-ok, and holds back
# no merge, release or deploy. vitest runs straight, not through Turbo,
# so no result is read from a cache, and without coverage, which the
# replaced modules' tests left out would lower. web's build test builds
# the site without the docs' diagrams (DOCS_DIAGRAMS=skip), which need
# Chromium and have nothing of the client: check draws them.
# Deterministic.
solid-memo-client:
name: solid-memo-client (unit)
needs: gate
if: needs.gate.outputs.jobs == 'all'
runs-on: ubuntu-latest
timeout-minutes: 15
continue-on-error: true
env:
SOLID_CLIENT: solid-memo-client
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
- run: npm run test:unit -w @solid-memo/solid -- --exclude 'src/client/{access,rdf,resources,session,session.library,session.redirect.library}.test.ts'
- if: success() || failure()
run: npm run test:roundtrip -w @solid-memo/solid
- if: success() || failure()
run: npm run test:unit -w @solid-memo/shacl
- if: success() || failure()
run: npm run test:unit -w @solid-memo/composition
- if: success() || failure()
run: npm run test:unit -w @solid-memo/web
env:
DOCS_DIAGRAMS: skip
# The end-to-end tests of pod, on each blocking server, with
# solid-memo-client in place of Inrupt's client, as the job above.
# The images come from pod's cache entries, which this job only
# restores: pod saves them. Advisory, as the job above: a failure fails
# neither the run nor ci-ok. Timing-dependent: real servers, started on
# a shared runner.
solid-memo-client-pod:
name: solid-memo-client (${{ matrix.server }})
needs: gate
if: needs.gate.outputs.jobs == 'all'
runs-on: ubuntu-latest
timeout-minutes: 15
continue-on-error: true
strategy:
fail-fast: false
matrix:
server: [css-7, css-6, nss-6, nss-5, css-acp]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
- id: key
run: echo "key=$(node e2e/pod/servers.ts key ${{ matrix.server }})" >> "$GITHUB_OUTPUT"
- uses: ./.github/actions/e2e-images
with:
name: pod-${{ matrix.server }}
key: ${{ steps.key.outputs.key }}
- run: npm run servers -w @solid-memo/e2e-pod -- ${{ matrix.server }}
- run: npm run test:pod
env:
SOLID_SERVERS: ${{ matrix.server }}
SOLID_CLIENT: solid-memo-client
- if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: solid-memo-client-logs-${{ matrix.server }}
path: e2e/pod/logs/
retention-days: 7
# The advisory servers (docs/testing.md) only report, in the Interop
# workflow, but each must still start and meet the harness's contract:
# a change that breaks one fails here, not unnoticed until Interop runs.
# Timing-dependent: real servers, which must start in time.
contract:
name: contract (${{ matrix.server }})
needs: gate
if: needs.gate.outputs.jobs == 'all'
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
# Off main, one server failing cancels the others, and fail-fast-contract
# the run; on main, each runs to its end, saving its images.
fail-fast: ${{ github.ref != 'refs/heads/main' }}
matrix:
server: [css-8, pivot, nextcloud, jss, css-lws, css-lws-only]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
- id: key
run: echo "key=$(node e2e/pod/servers.ts key ${{ matrix.server }})" >> "$GITHUB_OUTPUT"
- id: images
uses: ./.github/actions/e2e-images
with:
name: pod-${{ matrix.server }}
key: ${{ steps.key.outputs.key }}
- run: npm run servers -w @solid-memo/e2e-pod -- ${{ matrix.server }}
- if: steps.images.outputs.hit != 'true' && github.ref == 'refs/heads/main'
env:
FILE: ${{ steps.images.outputs.file }}
run: node e2e/pod/images.ts save "$FILE" e2e/pod/servers/${{ matrix.server }}/compose.yml
- if: steps.images.outputs.hit != 'true' && github.ref == 'refs/heads/main'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
continue-on-error: true
with:
path: ${{ steps.images.outputs.file }}
key: ${{ steps.images.outputs.key }}
- run: node e2e/pod/servers.ts contract ${{ matrix.server }}
- if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: contract-logs-${{ matrix.server }}
path: e2e/pod/logs/
retention-days: 7
# The user journeys (e2e/journeys, docs/testing.md): the site job's
# build of the app, served by vite preview, in Chromium, logging in to
# a Community Solid Server 7 behind TLS that the harness starts in
# Docker, each journey with an account and pod of its
# own. The other engines and the phone run a few of them, and the
# phone some of the theme tours (docs/testing.md#browsers). Five jobs
# run them side by side, so the run waits for the slowest, not for
# all: Chromium's journeys in three shards of about the same time
# (harness/shards.ts, from durations.json), desktop Firefox's and
# WebKit's together, and the phone's, the slowest of the others, in a
# job of its own. Each job, started once the site job is done, pays
# the setup again (about a minute), for a shorter wall time; it starts
# the server in the background while the browsers are set up. When one
# fails, the others are canceled (fail-fast), as their result no longer
# changes the run's and they take long; the job's summary names the
# step it failed in, and its
# artifact holds the trace to replay it step
# by step (`npx playwright show-trace`), the report, a video, and the
# server's log. On main and in the merge queue the traces are kept
# always, and each job keeps its run as a blob, for journeys-report to
# merge: main's report takes them from the run that tested its tree
# when it skips them (gate's tested-by), the queue's as a rule.
# Timing-dependent: end to end, waiting on a real server behind TLS,
# on a shared runner. Their waits are fixed where they flake, not
# retried (retries: 0, playwright.config.ts).
journeys:
name: journeys (${{ matrix.name }})
needs: [gate, site]
if: needs.gate.outputs.jobs == 'all'
runs-on: ubuntu-latest
# The journeys' own time: the job starts once the site job is done.
timeout-minutes: 25
strategy:
fail-fast: true
# name: the job's, and its blob's (journeys-report lists them);
# projects: what it runs; shard: which of Chromium's three it is;
# browser and also: what it installs, and the keys they are kept
# under, the phone's being WebKit's.
matrix:
include:
- name: chromium-1
projects: --project=chromium
shard: 1
browser: chromium
- name: chromium-2
projects: --project=chromium
shard: 2
browser: chromium
- name: chromium-3
projects: --project=chromium
shard: 3
browser: chromium
- name: desktop
projects: --project=firefox --project=webkit
browser: firefox
also: webkit
- name: phone
projects: --project=phone
browser: webkit
env:
JOURNEY_TRACE: >-
${{ (inputs.trace || github.ref == 'refs/heads/main' ||
github.event_name == 'merge_group') && 'on' || '' }}
# The blob's name, so the jobs' blobs sit side by side when merged.
PLAYWRIGHT_BLOB_OUTPUT_NAME: report-${{ matrix.name }}.zip
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
- id: images
uses: ./.github/actions/e2e-images
with:
name: journeys
key: ${{ hashFiles('e2e/journeys/css/compose.yml') }}
- run: npm run css:prepare -w @solid-memo/e2e-journeys
# The server, up while the browsers are set up; "Wait for the
# Solid server" below fails if it never is.
- name: Start the Solid server
run: |
nohup node e2e/journeys/harness/cssServer.ts > "$RUNNER_TEMP/css.out" 2>&1 &
echo $! > "$RUNNER_TEMP/css.pid"
- if: steps.images.outputs.hit != 'true' && github.ref == 'refs/heads/main'
env:
FILE: ${{ steps.images.outputs.file }}
run: node e2e/pod/images.ts save "$FILE" e2e/journeys/css/compose.yml
- if: steps.images.outputs.hit != 'true' && github.ref == 'refs/heads/main'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
continue-on-error: true
with:
path: ${{ steps.images.outputs.file }}
key: ${{ steps.images.outputs.key }}
# The browsers' key holds the runner's Ubuntu version (ImageOS), as
# Playwright builds WebKit for each: a runner of a new Ubuntu must
# not restore the old one's. The runner's variable, which the env
# context lacks.
- id: playwright
run: |
echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
echo "os=${ImageOS:?}" >> "$GITHUB_OUTPUT"
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: browsers
with:
path: ~/.cache/ms-playwright
key: playwright-${{ steps.playwright.outputs.os }}-${{ steps.playwright.outputs.version }}-${{ matrix.browser }}
- if: steps.browsers.outputs.cache-hit != 'true'
run: npx playwright install ${{ matrix.browser }}
- uses: ./.github/actions/playwright-deps
with:
browser: ${{ matrix.browser }}
# The desktop job's second browser, kept under its own key.
- if: matrix.also
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: also
with:
path: ~/.cache/ms-playwright
key: playwright-${{ steps.playwright.outputs.os }}-${{ steps.playwright.outputs.version }}-${{ matrix.also }}
- if: matrix.also && steps.also.outputs.cache-hit != 'true'
run: npx playwright install ${{ matrix.also }}
- if: matrix.also
uses: ./.github/actions/playwright-deps
with:
browser: ${{ matrix.also }}
# Chromium's share of the journeys, from the list of them all, so a
# journey added or moved is in exactly one shard.
- id: shard
if: matrix.shard
working-directory: e2e/journeys
env:
SHARD: ${{ matrix.shard }}
run: |
npx playwright test --project=chromium --list --reporter=json > "$RUNNER_TEMP/listing.json"
# Apart from echo, so a failing split fails the step.
journeys=$(node harness/shards.ts "$SHARD" 3 < "$RUNNER_TEMP/listing.json")
if [ -z "$journeys" ]; then
echo "::error::Shard $SHARD of Chromium's journeys holds none."
exit 1
fi
echo "journeys=$journeys" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: site
path: apps/web/dist/
- name: Wait for the Solid server
run: |
for _ in $(seq 1 120); do
url=$(sed -n 's/^Community Solid Server 7 at \(https:[^ ]*\) .*/\1/p' "$RUNNER_TEMP/css.out")
if [ -n "$url" ]; then
echo "JOURNEY_SERVER_URL=$url" >> "$GITHUB_ENV"
exit 0
fi
if ! kill -0 "$(cat "$RUNNER_TEMP/css.pid")" 2> /dev/null; then break; fi
sleep 1
done
echo "::error::The Solid server did not start. What it printed:"
cat "$RUNNER_TEMP/css.out"
exit 1
- env:
JOURNEYS: ${{ steps.shard.outputs.journeys }}
run: |
read -ra journeys <<< "$JOURNEYS"
npm run journeys -- ${{ matrix.projects }} "${journeys[@]}"
- if: always()
run: node e2e/journeys/harness/summary.ts journeys-${{ matrix.name }}-${{ github.run_attempt }}
# In the queue, the blob below holds the traces; this, only on a failure.
- if: failure() || (env.JOURNEY_TRACE == 'on' && github.event_name != 'merge_group')
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: journeys-${{ matrix.name }}-${{ github.run_attempt }}
path: |
e2e/journeys/playwright-report/
e2e/journeys/test-results/
e2e/journeys/logs/
retention-days: 7
# A job run again replaces its blob from the attempt before; kept as
# long as the report, so that re-running one job still finds the
# other's.
- if: always() && (github.ref == 'refs/heads/main' || github.event_name == 'merge_group')
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: journeys-blob-${{ matrix.name }}
path: e2e/journeys/blob-report/
retention-days: 7
overwrite: true
# On main, the journeys jobs' runs merged into one report, every
# browser's journeys and their traces in it; when a journey failed,
# what the jobs ran before the others were canceled: the deploy
# publishes it at /journeys/ (docs/deployment.md). When this
# run skipped the journeys, their blobs come from the run gate names,
# which ran them on this tree: the merge queue's, or a release commit's
# parent's. When the journeys passed, or ran there, every job's blob
# must be there, so a run the deploy may publish never has a report
# missing a browser. ci-ok doesn't need it, as it runs on main alone;
# its failure still fails the run, and so holds back release and
# deploy. Deterministic.
journeys-report:
if: ${{ !cancelled() && github.ref == 'refs/heads/main' }}
needs: [gate, journeys]
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
# To download the journeys' blobs from the run that tested this tree.
actions: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
- if: needs.gate.outputs.jobs == 'all'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: journeys-blob-*
merge-multiple: true
path: e2e/journeys/blob-reports/
- if: needs.gate.outputs.jobs == 'reuse'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: journeys-blob-*
merge-multiple: true
run-id: ${{ needs.gate.outputs.tested-by }}
github-token: ${{ github.token }}
path: e2e/journeys/blob-reports/
- working-directory: e2e/journeys
env:
JOURNEYS: ${{ needs.journeys.result }}
JOBS: ${{ needs.gate.outputs.jobs }}
# The journeys jobs' names, as their matrix has them.
REPORTS: chromium-1 chromium-2 chromium-3 desktop phone
run: |
if [ "$JOURNEYS" = success ] || [ "$JOBS" = reuse ]; then
for name in $REPORTS; do
test -f "blob-reports/report-$name.zip"
done
fi
if compgen -G 'blob-reports/*.zip' > /dev/null; then
npx playwright merge-reports --reporter html blob-reports
fi
- if: hashFiles('e2e/journeys/playwright-report/index.html') != ''
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: journeys-report
path: e2e/journeys/playwright-report/
retention-days: 7
overwrite: true
# On main, when this run reuses the one that tested its tree (gate's
# jobs=reuse, tested-by), what that run made is taken over, not made
# again: its site, kept as this run's site artifact, which the deploy
# ships once it matches the site job's attestation (docs/deployment.md),
# and, but on a release commit, its Turbo
# cache, saved as main's, which every pull request and queue run
# restores. That run tested this very tree: the queue's commit is the
# one main moved to, and a release commit's code is its parent's. On a
# release commit, main's Turbo cache holds its parent's already. It runs
# none of the repository's code, so it needs no checkout. Deterministic.
reuse:
if: needs.gate.outputs.jobs == 'reuse'
needs: gate
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
# To download the site and Turbo's cache from the run that tested this tree.
actions: read
env:
RELEASE: >-
${{ startsWith(github.event.head_commit.message, 'chore(release): ') }}
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: site
run-id: ${{ needs.gate.outputs.tested-by }}
github-token: ${{ github.token }}
path: site/
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: site
path: site/
retention-days: 7
if-no-files-found: error
overwrite: true
- if: env.RELEASE != 'true'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: turbo-cache
run-id: ${{ needs.gate.outputs.tested-by }}
github-token: ${{ github.token }}
path: .turbo/cache/
- if: env.RELEASE != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo/cache
key: turbo-check-${{ github.sha }}
# A release commit's own files, when this run reuses the one that tested
# its parent: the gate has checked that it changes nothing else, and
# its code is its parent's, so these are what it can get wrong. Biome's
# rules (package.json), markdownlint's and cspell's (CHANGELOG.md), as
# npm run check has them, and publiccode.yml, by its parser.
# Deterministic.
release-files:
if: >-
needs.gate.outputs.jobs == 'reuse' &&
startsWith(github.event.head_commit.message, 'chore(release): ')
needs: gate
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
- run: npm run lint
- run: npm run lint:markdown
- run: npm run lint:spelling
- uses: ./.github/actions/publiccode
with:
network: "false"
# On main, when this run reuses another and the jobs that test are
# skipped, the caches they would have saved there, which every pull
# request and queue run reads: each server's images and the journeys'
# (e2e-images), the journeys' browsers, and Chromium's headless shell
# (.github/actions/chromium), and their system libraries
# (.github/actions/playwright-deps). This job only looks them up, by the keys
# those jobs use; warm-images and warm-browsers make and save what is
# missing, and nothing else, so a run with every cache in place spends
# one short job; warm-pip, pip's. Like caches, they may fail without
# failing the run. Deterministic.
warm:
if: github.ref == 'refs/heads/main' && needs.gate.outputs.jobs == 'reuse'
needs: gate
runs-on: ubuntu-latest