Repository navigation
1579 lines (1401 loc) · 59.7 KB
/
Copy pathphp.yml
File metadata and controls
1579 lines (1401 loc) · 59.7 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
name: build
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
sqlite_timer_qualification:
description: 'Also execute the original real two-worker SQLite timer workload'
type: boolean
default: false
permissions:
contents: read
concurrency:
group: build-${{ github.event_name }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
action-policy:
name: Central action policy preflight
if: ${{ github.server_url == 'https://github.com' }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out candidate source
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- name: Check out central action policy
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
repository: durable-workflow/.github
ref: main
path: .central-action-policy
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.13"
- name: Bootstrap patched pip trust
uses: durable-workflow/.github/.github/actions/bootstrap-patched-pip@75587fc33ff40c34f32ef777293dad56bb6f48c7 # clean-trust
- name: Install policy dependencies
run: "python -m pip install --only-binary :all: PyYAML==6.0.2"
- name: Require centrally approved immutable action commits
run: >-
python .central-action-policy/scripts/qualification_policy.py validate
--policy .central-action-policy/qualification/policy.json
--target workflow
--workflow-directory .github/workflows
preflight:
name: Validate repository contracts
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
laravel_source_matrix: ${{ steps.laravel-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 0
persist-credentials: false
- name: Verify build and feature selection contracts
run: python scripts/ci/test-build-routing.py
- name: Verify complete feature inventories
run: php scripts/ci/verify-feature-shards.php
- name: Validate workflow YAML syntax
run: yq eval-all '.' .github/workflows/*.yml >/dev/null
- name: Validate GitHub Actions expressions
run: |
docker run --rm --network none --user "$(id -u):$(id -g)" \
--cpus 1 --memory 256m --memory-swap 256m \
--volume "$PWD:/repo:ro" --workdir /repo \
rhysd/actionlint@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667 \
-shellcheck= -pyflakes= .github/workflows/*.yml
- name: Validate CI script syntax
run: |
bash -n \
scripts/ci/laravel-embedded-upgrade-smoke.sh \
scripts/ci/check-packagist-release.sh \
scripts/ci/check-platform-conformance-mirror.sh \
scripts/ci/test-platform-conformance-resolver-audit.sh
php -l scripts/ci/compare-platform-conformance-mirrors.php
php -l scripts/ci/check-v2-coverage.php
php -l scripts/ci/list-worker-protocol-resolvers.php
php -l scripts/ci/check-laravel-dependency-security.php
php -l scripts/ci/laravel-embedded-upgrade-matrix.php
php -l scripts/ci/verify-history-export-source-identity.php
php scripts/ci/check-v2-coverage.php --self-test
python - <<'PY'
import ast
from pathlib import Path
for path in Path("scripts/ci").glob("*.py"):
ast.parse(path.read_text(), filename=str(path))
PY
- name: Verify platform conformance resolver audit
run: scripts/ci/test-platform-conformance-resolver-audit.sh
- name: Validate Laravel dependency security policy
run: php scripts/ci/check-laravel-dependency-security.php --policy-only
- name: Install payload consumer dependencies
run: composer install --prefer-dist --no-progress --no-dev --no-scripts
- name: Derive bounded Laravel source qualification
id: laravel-matrix
run: echo "matrix=$(php scripts/ci/laravel-embedded-upgrade-matrix.php --scope=source)" >> "$GITHUB_OUTPUT"
- name: Require durable replay and codec evidence
env:
CORPUS_BASE_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
run: |
arguments=()
if [[ "$CORPUS_BASE_REF" =~ ^[0-9a-f]{40}$ ]] && [[ ! "$CORPUS_BASE_REF" =~ ^0+$ ]]; then
arguments+=(--base-ref "$CORPUS_BASE_REF")
fi
python scripts/ci/validate-regression-corpus.py \
--skip-counterfactual \
"${arguments[@]}"
python scripts/ci/test-regression-corpus-policy.py
- name: Scan public boundary
shell: bash
env:
BUILD_EVENT_NAME: ${{ github.event_name }}
BUILD_BEFORE_SHA: ${{ github.event.before }}
BUILD_HEAD_SHA: ${{ github.sha }}
PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PULL_REQUEST_BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
set -euo pipefail
baseline=""
if [ "$BUILD_EVENT_NAME" = "pull_request" ]; then
range="${PULL_REQUEST_BASE_SHA}..${PULL_REQUEST_HEAD_SHA}"
base_ref="origin/${PULL_REQUEST_BASE_REF}"
if git rev-parse --verify --quiet "${base_ref}^{commit}" >/dev/null; then
baseline="$base_ref"
else
baseline="$PULL_REQUEST_BASE_SHA"
fi
elif [[ "$BUILD_BEFORE_SHA" =~ ^[0-9a-f]{40}$ ]] \
&& [[ ! "$BUILD_BEFORE_SHA" =~ ^0+$ ]] \
&& git cat-file -e "${BUILD_BEFORE_SHA}^{commit}"; then
range="${BUILD_BEFORE_SHA}..${BUILD_HEAD_SHA}"
elif git rev-parse --verify --quiet "${BUILD_HEAD_SHA}^" >/dev/null; then
range="${BUILD_HEAD_SHA}^..${BUILD_HEAD_SHA}"
else
range="$BUILD_HEAD_SHA"
fi
PUBLIC_BOUNDARY_GIT_RANGE="$range" \
PUBLIC_BOUNDARY_GIT_BASELINE="$baseline" \
scripts/check-public-boundary.sh
regression-corpus:
needs: preflight
runs-on: ubuntu-latest
timeout-minutes: 6
services:
redis:
image: redis
ports:
- 6379
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 0
persist-credentials: false
- name: Cache Composer packages
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
with:
path: vendor
key: ${{ github.event_name }}-${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ github.event_name }}-${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Prepare official consumer runtime
env:
REDIS_PUBLISHED_PORT: ${{ job.services.redis.ports['6379'] }}
run: |
if [ -d /dev/shm ] && [ -w /dev/shm ]; then
temporary_root=/dev/shm
else
temporary_root="${RUNNER_TEMP:-${TMPDIR:-/tmp}}"
fi
run_token="${GITHUB_RUN_ID:-local}-${GITHUB_RUN_ATTEMPT:-1}"
corpus_db="${temporary_root}/workflow-regression-corpus-${run_token}.sqlite"
touch "$corpus_db"
if getent hosts redis > /dev/null 2>&1; then
redis_host=redis
redis_port=6379
elif [ -n "$REDIS_PUBLISHED_PORT" ]; then
redis_host=127.0.0.1
redis_port="$REDIS_PUBLISHED_PORT"
else
echo "::error::Unable to resolve Redis service endpoint" >&2
exit 1
fi
{
echo "CORPUS_DB_PATH=$corpus_db"
echo "APP_KEY=base64:i3g6f+dV8FfsIkcxqd7gbiPn2oXk5r00sTmdD6V5utI="
echo "DB_CONNECTION=sqlite"
echo "DB_DATABASE=$corpus_db"
echo "CACHE_DRIVER=redis"
echo "CACHE_STORE=redis"
echo "QUEUE_CONNECTION=sync"
echo "QUEUE_FAILED_DRIVER=null"
echo "REDIS_HOST=$redis_host"
echo "REDIS_PORT=$redis_port"
echo "REDIS_PASSWORD="
} >> "$GITHUB_ENV"
- name: Prove new regression evidence against base and current bindings
env:
CORPUS_BASE_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
run: |
arguments=()
if [[ "$CORPUS_BASE_REF" =~ ^[0-9a-f]{40}$ ]] && [[ ! "$CORPUS_BASE_REF" =~ ^0+$ ]]; then
arguments+=(--base-ref "$CORPUS_BASE_REF")
fi
python scripts/ci/validate-regression-corpus.py "${arguments[@]}"
- name: Remove regression-corpus database
if: ${{ always() }}
run: |
if [ -n "${CORPUS_DB_PATH:-}" ] \
&& [[ "${CORPUS_DB_PATH##*/}" == workflow-regression-corpus-*.sqlite ]]; then
rm -f -- "$CORPUS_DB_PATH"
fi
quality:
needs: preflight
runs-on: ubuntu-latest
timeout-minutes: 13
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 10
persist-credentials: false
- name: Validate composer.json and composer.lock
run: composer validate --strict
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: '22'
- name: Check tracing overhead recipe
run: |
composer --working-dir=.github/tracing-performance validate --strict --no-check-all --no-check-publish
node --test .github/tracing-performance/probe.test.mjs .github/tracing-performance/analyze.test.mjs
- name: Cache Composer packages
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
with:
path: vendor
key: ${{ github.event_name }}-${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ github.event_name }}-${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Check coding style via ECS
run: vendor/bin/ecs check
- name: Run static analysis via PHPStan
run: vendor/bin/phpstan analyse src tests
laravel-embedded-upgrade-source:
name: Laravel ${{ matrix.laravel }} / PHP ${{ matrix.php }} embedded upgrade
needs: preflight
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.preflight.outputs.laravel_source_matrix) }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: ${{ matrix.php }}
tools: composer
- name: Run the clean stable-v1 to source-v2 journey
env:
LARAVEL_VERSION: ${{ matrix.laravel }}
WORKFLOW_V2_PATH: ${{ github.workspace }}
WORKFLOW_SQLITE_TIMER_QUALIFICATION: ${{ inputs.sqlite_timer_qualification && '1' || '0' }}
WORKFLOW_QUEUE_QUALIFICATION_EVIDENCE: ${{ github.workspace }}/sqlite-queue-qualification.json
run: scripts/ci/laravel-embedded-upgrade-smoke.sh
- name: Retain original two-worker outcomes including failures
if: always() && inputs.sqlite_timer_qualification
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: sqlite-source-queue-job-${{ strategy.job-index }}-php-${{ matrix.php }}
path: sqlite-queue-qualification.json
if-no-files-found: error
retention-days: 90
tracing-http:
needs: preflight
runs-on: ubuntu-latest
timeout-minutes: 8
env:
OTEL_PHP_FIBERS_ENABLED: 'false'
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- name: Set up the optional application instrumentation
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: '8.5'
extensions: pdo_sqlite, opentelemetry-1.4.2
tools: composer
coverage: none
env:
fail-fast: true
- name: Install ordinary package and client instrumentation dependencies
run: |
composer install --prefer-dist --no-progress
composer install --working-dir=.github/tracing-http --prefer-dist --no-progress --no-plugins --no-scripts
composer audit --working-dir=.github/tracing-http
- name: Verify real HTTP propagation through independent activity workers
run: >-
vendor/bin/phpunit --no-configuration
--bootstrap .github/tracing-http/bootstrap.php
--do-not-record-test-run-history --fail-on-warning --fail-on-skipped
tests/Unit/V2/HttpExecutionTracingTest.php
tests/Unit/V2/ExporterExecutionTracingTest.php
pr-unit-contracts:
needs: preflight
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 13
env:
XDEBUG_MODE: 'off'
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 10
persist-credentials: false
- name: Cache Composer packages
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
with:
path: vendor
key: ${{ github.event_name }}-${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ github.event_name }}-${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run embedded database-queue recovery controls
run: |
mkdir -p build/test-results
vendor/bin/phpunit tests/Unit/V2/DatabaseQueueRecoveryTest.php \
tests/Unit/V2/EmbeddedSqliteTaskContentionTest.php \
tests/Unit/V2/ProjectionSqliteContentionTest.php \
--fail-on-warning --log-junit build/test-results/pr-database-queue-recovery.xml
- name: Run file-backed SQLite concurrency controls
env:
DB_CONNECTION: sqlite
DB_DATABASE: ${{ runner.temp }}/workflow-overlap-release.sqlite
CACHE_DRIVER: array
CACHE_STORE: array
QUEUE_CONNECTION: sync
REDIS_HOST: ''
run: |
touch "$DB_DATABASE"
vendor/bin/phpunit tests/Unit/WorkflowOverlapReleaseTest.php \
tests/Unit/WorkflowOptionsTest.php \
tests/Unit/V2/LegacyOverlapOptionsBoundaryTest.php \
tests/Unit/V2/HostServiceQueryDispatchTest.php \
tests/Unit/V2/HostServiceQueryLifecycleTest.php \
tests/Unit/V2/HostServiceQueryConcurrentReplayTest.php --testdox --fail-on-warning
php -d zend.enable_gc=0 vendor/bin/phpunit \
tests/Unit/SqliteWalFixtureCleanupTest.php \
tests/Unit/V2/HostServiceQueryConcurrentReplayTest.php \
tests/Unit/V2/HostServiceQueryDispatchTest.php \
tests/Unit/V2/HostServiceQueryLifecycleTest.php \
tests/Unit/V2/LocalActivityRetryDispatchTest.php \
tests/Unit/V2/MemoTest.php --testdox --fail-on-warning
- name: Run retained execution authority and process-loss controls
run: >-
vendor/bin/phpunit tests/Unit/V2/EmbeddedContinuationTest.php
tests/Unit/V2/WorkflowContinuationCacheTest.php
tests/Unit/V2/EmbeddedContinuationProcessTest.php
--testdox --fail-on-warning
--log-junit build/test-results/pr-retained-execution.xml
- name: Run growing continuation worker setup controls
env:
PROFILE_EMBEDDED_CONTINUATION: setup
run: >-
vendor/bin/phpunit tests/Performance/EmbeddedContinuationGrowthProfileTest.php
--testdox --fail-on-warning --display-phpunit-deprecations
--log-junit build/test-results/pr-continuation-growth.xml
- name: Run minimally observed continuation setup controls
env:
PROFILE_EMBEDDED_CONTINUATION: setup
DWF_GROWTH_OBSERVERS: 'off'
run: >-
vendor/bin/phpunit tests/Performance/EmbeddedContinuationGrowthProfileTest.php
--filter '10-events_(1-workers_1-runs|4-workers_8-runs)_(replay|retained)_repeat-1'
--testdox --fail-on-warning --fail-on-empty-test-suite
--log-junit build/test-results/pr-continuation-minimal-observers.xml
- name: Resolve bounded pull-request test selection
run: >-
php scripts/ci/select-pr-tests.php
--config=.github/pr-test-selection.json
--weights=.github/feature-test-timings.json
--weight-profile=mysql
--output-dir=build/pr-selection
- name: Run optional embedded tracing controls
run: >-
vendor/bin/phpunit tests/Unit/V2/ActivityExecutionTracingTest.php
tests/Unit/V2/IncomingHttpTracingTest.php
tests/Unit/V2/RecoveryExecutionTracingTest.php
tests/Unit/V2/TransitionExecutionTracingTest.php
tests/Unit/V2/FailureOutcomeExecutionTracingTest.php
tests/Unit/V2/FanOutExecutionTracingTest.php
tests/Unit/V2/LargeFanOutExecutionTracingTest.php
tests/Unit/V2/TaskOutcomeCarrierTest.php
tests/Unit/V2/ChildRetryExecutionTracingTest.php
tests/Unit/V2/CancellationExecutionTracingTest.php
tests/Unit/V2/SignalStartExecutionTracingTest.php
tests/Unit/V2/SignalLinkExecutionTracingTest.php
tests/Unit/V2/UpdateLinkExecutionTracingTest.php
tests/Unit/V2/TimingExecutionTracingTest.php
tests/Unit/V2/AdmissionExecutionTracingTest.php
tests/Unit/V2/DispatchExecutionTracingTest.php
tests/Unit/V2/ScheduleExecutionTracingTest.php
--fail-on-warning --log-junit build/test-results/pr-activity-tracing.xml
- name: Run database-independent unit contracts
run: |
mkdir -p build/test-results
xargs -a build/pr-selection/unit-files.txt \
vendor/bin/phpunit --testdox \
--log-junit build/test-results/pr-unit-contracts.xml
- name: Run workflow command normalizer unit cases
run: >-
vendor/bin/phpunit tests/Unit/V2/WorkflowCommandNormalizerTest.php
--fail-on-warning --log-junit build/test-results/pr-workflow-command-normalizer.xml
env:
REDIS_HOST: 127.0.0.1
- name: Run embedded local retry queue and rollback controls
run: >-
vendor/bin/phpunit tests/Unit/V2/LocalActivityRetryDispatchTest.php
--fail-on-warning --log-junit build/test-results/pr-local-activity-retry.xml
- name: Run cancellation timeline unit cases
run: >-
vendor/bin/phpunit tests/Unit/V2/CancellationHistoryTimelineTest.php
--fail-on-warning --log-junit build/test-results/pr-cancellation-timeline.xml
pr-feature-mysql:
needs: preflight
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 13
services:
mysql:
image: mysql
env:
MYSQL_ROOT_PASSWORD: password
options: >-
--tmpfs /var/lib/mysql:rw,noexec,nosuid,size=1024m
ports:
- 3306
redis:
image: redis
ports:
- 6379
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 20
persist-credentials: false
- name: Resolve changed files
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
mkdir -p build/pr-selection
if [ -n "$BASE_SHA" ] && [ -n "$HEAD_SHA" ] \
&& git cat-file -e "${BASE_SHA}^{commit}" \
&& git cat-file -e "${HEAD_SHA}^{commit}"; then
git diff --name-only --diff-filter=ACMRT "$BASE_SHA" "$HEAD_SHA" \
> build/pr-selection/changed-files.txt
else
: > build/pr-selection/changed-files.txt
echo "Changed-file targeting unavailable; using the high-signal fallback."
fi
- name: Resolve bounded pull-request test selection
run: >-
php scripts/ci/select-pr-tests.php
--config=.github/pr-test-selection.json
--weights=.github/feature-test-timings.json
--weight-profile=mysql
--changed-files=build/pr-selection/changed-files.txt
--output-dir=build/pr-selection
- name: Cache Composer packages
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
with:
path: vendor
key: ${{ github.event_name }}-${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ github.event_name }}-${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Resolve service endpoints and export test defaults
env:
MYSQL_PUBLISHED_PORT: ${{ job.services.mysql.ports['3306'] }}
REDIS_PUBLISHED_PORT: ${{ job.services.redis.ports['6379'] }}
run: |
resolve_service() {
service="$1"
container_port="$2"
published_port="$3"
prefix="$4"
if getent hosts "$service" > /dev/null 2>&1; then
echo "${prefix}_HOST=${service}"
echo "${prefix}_PORT=${container_port}"
elif [ -n "$published_port" ]; then
echo "${prefix}_HOST=127.0.0.1"
echo "${prefix}_PORT=${published_port}"
else
echo "::error::Unable to resolve ${service} or determine its published port" >&2
exit 1
fi
}
{
resolve_service mysql 3306 "$MYSQL_PUBLISHED_PORT" DB
resolve_service redis 6379 "$REDIS_PUBLISHED_PORT" REDIS
echo "APP_KEY=base64:i3g6f+dV8FfsIkcxqd7gbiPn2oXk5r00sTmdD6V5utI="
echo "DB_DATABASE=testbench"
echo "DB_USERNAME=root"
echo "DB_PASSWORD=password"
echo "QUEUE_FAILED_DRIVER=null"
echo "REDIS_PASSWORD="
echo "CACHE_DRIVER=redis"
echo "CACHE_STORE=redis"
} >> "$GITHUB_ENV"
- name: Create MySQL database
run: >-
mysql
-e 'SET GLOBAL innodb_flush_log_at_trx_commit=2; SET GLOBAL sync_binlog=0; CREATE DATABASE testbench'
-h"$DB_HOST" -uroot -ppassword -P "$DB_PORT"
- name: Run bounded MySQL smoke selection
id: pr_mysql_suite
run: |
mkdir -p build/test-results
cat build/pr-selection/summary.txt
set +e
# shellcheck disable=SC2016
timeout --foreground 8m bash -euo pipefail -c '
filter=$(cat build/pr-selection/mysql-fallback-filter.txt)
xargs -a build/pr-selection/mysql-fallback-files.txt \
vendor/bin/phpunit --testdox --testsuite feature \
--filter "$filter" \
--log-junit build/test-results/pr-smoke-fallback.xml
if [ -s build/pr-selection/mysql-changed-files.txt ]; then
xargs -a build/pr-selection/mysql-changed-files.txt \
vendor/bin/phpunit --testdox --testsuite feature \
--log-junit build/test-results/pr-smoke-changed.xml
fi
'
status=$?
set -e
for report in build/test-results/pr-smoke-*.xml; do
[ -f "$report" ] || continue
name=$(basename "$report" .xml)
php scripts/ci/summarize-junit-times.php \
--input="$report" \
--output="build/test-results/${name}-timing.md" \
--csv="build/test-results/${name}-timing.csv"
cat "build/test-results/${name}-timing.md"
if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
cat "build/test-results/${name}-timing.md" >> "$GITHUB_STEP_SUMMARY"
fi
done
exit "$status"
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run delayed task and real SQS adapter controls
run: >-
vendor/bin/phpunit tests/Unit/V2/DelayedTaskTransportTest.php
tests/Unit/V2/SqsDelayAdapterTest.php
--testsuite unit
--fail-on-warning --log-junit build/test-results/pr-sqs-delay-adapter.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run scoped Activity fencing and original stop receipt cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2ScopedActivityCancellationTest.php
--testsuite feature
--fail-on-warning --log-junit build/test-results/pr-smoke-scoped-activities.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run scoped timer fencing and late fire cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2ScopedTimerCancellationTest.php
--testsuite feature
--fail-on-warning --log-junit build/test-results/pr-smoke-scoped-timers.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run canonical operation scope delivery boundary cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2CancellationScopeDeliveryTest.php
--testsuite feature
--fail-on-warning --log-junit build/test-results/pr-smoke-scope-delivery.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run canonical operation scope request authority cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2CancellationScopeRequestsTest.php
--testsuite feature
--fail-on-warning --log-junit build/test-results/pr-smoke-scope-requests.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run canonical operation scope admission cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2CancellationScopeHistoryTest.php
--testsuite feature
--fail-on-warning --log-junit build/test-results/pr-smoke-scope-admission.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run activity cancellation policy and portable admission cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2PortableCancellationDeliveryTest.php
--testsuite feature
--filter '/testInternal.*(ActivityWait|ActivityAbandon)|testPortableRemoteActivityPolicy/'
--fail-on-warning --log-junit build/test-results/pr-smoke-activity-cancellation-wait.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run local callback original-claim receipt cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2PortableCancellationDeliveryTest.php
--testsuite feature
--filter '/(testLocalStopReceipt|testLocalOriginalOwner|testLateLocalReceipt)/'
--fail-on-warning --log-junit build/test-results/pr-smoke-local-claim.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run portable local preparation cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2PortableLocalActivityPreparationTest.php
--testsuite feature
--fail-on-warning --log-junit build/test-results/pr-smoke-local-preparation.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run portable local retained-claim checkpoint cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2PortableLocalActivityCheckpointTest.php
--testsuite feature
--fail-on-warning --log-junit build/test-results/pr-smoke-local-checkpoint.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run portable local prepared outcome cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2PortableLocalActivityOutcomeTest.php
--testsuite feature
--fail-on-warning --log-junit build/test-results/pr-smoke-local-outcomes.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run portable local cold recovery cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2PortableLocalActivityRecoveryTest.php
--testsuite feature
--fail-on-warning --log-junit build/test-results/pr-smoke-local-recovery.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run portable local supervisor control cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2PortableLocalActivityControlTest.php
--testsuite feature
--fail-on-warning --log-junit build/test-results/pr-smoke-local-control.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run portable local cleanup and application heartbeat cases
run: >-
vendor/bin/phpunit tests/Feature/V2/V2PortableLocalActivityCleanupTest.php
--testsuite feature
--fail-on-warning --log-junit build/test-results/pr-smoke-local-cleanup.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Run service scheduling and completion contracts
run: >-
vendor/bin/phpunit tests/Unit/V2/DefaultServiceControlPlaneWorkflowBindingTest.php
tests/Unit/V2/ServiceCallEffectIdentityTest.php
tests/Unit/V2/WebhookInputValidationTest.php
tests/Unit/V2/WorkflowExecutorServiceOperationTest.php
tests/Unit/V2/DefaultWorkflowTaskBridgeServiceOperationTest.php
tests/Unit/V2/ServiceCallSchedulerTest.php
--fail-on-warning --log-junit build/test-results/pr-smoke-service-scheduling.xml
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Upload pull-request MySQL smoke timing report
if: ${{ always() && github.server_url == 'https://github.com' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: pr-feature-timing-mysql
path: |
build/pr-selection/*
build/test-results/pr-smoke-*
- name: Upload laravel.log if pull-request MySQL smoke fails
if: ${{ github.server_url == 'https://github.com' && (failure() || steps.pr_mysql_suite.outcome == 'failure') }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: laravel-log-pr-mysql
path: vendor/orchestra/testbench-core/laravel/storage/logs/laravel.log
feature-mysql:
needs: preflight
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 21
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3]
services:
mysql:
image: mysql
env:
MYSQL_ROOT_PASSWORD: password
# Keep disposable test data on tmpfs so schema setup and committed-row
# truncation are not gated by the container overlay's fsync latency.
options: >-
--tmpfs /var/lib/mysql:rw,noexec,nosuid,size=1024m
ports:
- 3306
redis:
image: redis
ports:
- 6379
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 10
persist-credentials: false
- name: Set up PHP coverage driver
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: '8.3'
coverage: pcov
- name: Cache Composer packages
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
with:
path: vendor
key: ${{ github.event_name }}-${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ github.event_name }}-${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Resolve service endpoints and export test defaults
env:
MYSQL_PUBLISHED_PORT: ${{ job.services.mysql.ports['3306'] }}
REDIS_PUBLISHED_PORT: ${{ job.services.redis.ports['6379'] }}
run: |
resolve_service() {
service="$1"
container_port="$2"
published_port="$3"
prefix="$4"
if getent hosts "$service" > /dev/null 2>&1; then
echo "${prefix}_HOST=${service}"
echo "${prefix}_PORT=${container_port}"
elif [ -n "$published_port" ]; then
echo "${prefix}_HOST=127.0.0.1"
echo "${prefix}_PORT=${published_port}"
else
echo "::error::Unable to resolve ${service} or determine its published port" >&2
exit 1
fi
}
{
resolve_service mysql 3306 "$MYSQL_PUBLISHED_PORT" DB
resolve_service redis 6379 "$REDIS_PUBLISHED_PORT" REDIS
echo "APP_KEY=base64:i3g6f+dV8FfsIkcxqd7gbiPn2oXk5r00sTmdD6V5utI="
echo "DB_DATABASE=testbench"
echo "DB_USERNAME=root"
echo "DB_PASSWORD=password"
echo "QUEUE_FAILED_DRIVER=null"
echo "REDIS_PASSWORD="
# Testbench defaults cache to array (per-process, in-memory). The V2
# TaskWatchdog throttle set by Tests\TestCase::setUp needs to be
# visible to the two queue:work worker processes so their wake()
# poll short-circuits — array cache means the workers never see the
# test's throttle and runPass races the test's DB state (originally
# diagnosed as the #427 PG "hang" and the MySQL Mode-B flakes).
# The local docker stack uses tests/.env.feature which already sets
# CACHE_DRIVER=redis for the same reason; mirror it here.
echo "CACHE_DRIVER=redis"
echo "CACHE_STORE=redis"
} >> "$GITHUB_ENV"
- name: Create MySQL database
run: >-
mysql
-e 'SET GLOBAL innodb_flush_log_at_trx_commit=2; SET GLOBAL sync_binlog=0; SET GLOBAL max_connections=500; CREATE DATABASE testbench'
-h"$DB_HOST" -uroot -ppassword -P "$DB_PORT"
- name: Run feature test suite (MySQL shard ${{ matrix.shard }})
id: mysql_suite
timeout-minutes: 15
run: |
mkdir -p build/test-results
php scripts/ci/split-feature-tests.php \
--dir=tests/Feature \
--shard=${{ matrix.shard }} \
--shards=4 \
--weights=.github/feature-test-timings.json \
--weight-profile=mysql \
--summary="build/test-results/mysql-shard-${{ matrix.shard }}-summary.txt" \
> /tmp/mysql-shard-files
cat /tmp/mysql-shard-files
cp /tmp/mysql-shard-files "build/test-results/mysql-shard-${{ matrix.shard }}-files.txt"
started_at=$(date +%s)
set +e
timeout --foreground 15m xargs -a /tmp/mysql-shard-files \
vendor/bin/phpunit --testdox --testsuite feature \
--coverage-clover "build/test-results/mysql-shard-${{ matrix.shard }}-coverage.xml" \
--log-junit "build/test-results/mysql-shard-${{ matrix.shard }}.xml"
status=$?
elapsed=$(( $(date +%s) - started_at ))
set -e
printf 'mysql shard=%s exit=%s elapsed_seconds=%s\n' '${{ matrix.shard }}' "$status" "$elapsed" \
| tee "build/test-results/mysql-shard-${{ matrix.shard }}-elapsed.txt"
if [ -f "build/test-results/mysql-shard-${{ matrix.shard }}.xml" ]; then
php scripts/ci/summarize-junit-times.php \
--input="build/test-results/mysql-shard-${{ matrix.shard }}.xml" \
--output="build/test-results/mysql-shard-${{ matrix.shard }}-timing.md" \
--csv="build/test-results/mysql-shard-${{ matrix.shard }}-timing.csv"
fi
exit "$status"
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Emit MySQL shard diagnostics
if: ${{ always() }}
env:
SUITE_OUTCOME: ${{ steps.mysql_suite.outcome }}
run: |
cat "build/test-results/mysql-shard-${{ matrix.shard }}-elapsed.txt" 2>/dev/null || true
cat "build/test-results/mysql-shard-${{ matrix.shard }}-timing.md" 2>/dev/null || true
if [ "$SUITE_OUTCOME" != "success" ]; then
echo "MySQL shard ${{ matrix.shard }} failed; assigned files:"
cat "build/test-results/mysql-shard-${{ matrix.shard }}-files.txt" 2>/dev/null || true
tail -n 300 vendor/orchestra/testbench-core/laravel/storage/logs/laravel.log 2>/dev/null || true
fi
- name: Upload MySQL feature timing report
if: ${{ always() && github.server_url == 'https://github.com' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: feature-timing-mysql-${{ matrix.shard }}
path: build/test-results/mysql-shard-${{ matrix.shard }}*
- name: Verify bounded dashboard reads on MySQL
if: ${{ matrix.shard == 0 }}
run: vendor/bin/phpunit tests/Unit/V2/OperatorDashboardReadBoundsTest.php --fail-on-warning
env:
DB_CONNECTION: mysql
QUEUE_CONNECTION: redis
XDEBUG_MODE: off
- name: Upload laravel.log if MySQL tests fail
if: ${{ github.server_url == 'https://github.com' && (failure() || steps.mysql_suite.outcome == 'failure') }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: laravel-log-mysql-${{ matrix.shard }}
path: vendor/orchestra/testbench-core/laravel/storage/logs/laravel.log
feature-postgresql:
needs: preflight
if: ${{ github.event_name != 'pull_request' }}