-
Notifications
You must be signed in to change notification settings - Fork 3
844 lines (825 loc) · 39.1 KB
/
continuous-integration.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
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
name: CI
on:
push:
pull_request:
schedule:
- cron: '37 9 1 * *'
jobs:
###############################################################################
################################### GENERAL ###################################
###############################################################################
check_secrets:
name: "Check SCOUT_APM_KEY secret"
runs-on: ubuntu-latest
outputs:
has_scout_apm_key_secret: ${{ steps.check_scout_apm_key_secret_job.outputs.has_scout_apm_key_secret }}
steps:
- name: "Check if SCOUT_APM_KEY secret is available for this build"
id: check_scout_apm_key_secret_job
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
run: |
echo "has_scout_apm_key_secret: ${{ env.SCOUT_APM_KEY != '' }}"
echo "has_scout_apm_key_secret=${{ env.SCOUT_APM_KEY != '' }}" >> $GITHUB_OUTPUT
base-unit:
name: "Unit tests"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- "ubuntu-latest"
dependencies:
- "lowest"
- "highest"
scout-ext:
- "with-scout-ext"
- "no-scout-ext"
extensions: [
"",
"mongodb"
]
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
services:
mongo:
image: mongo
ports:
- 27017:27017
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
- uses: actions/checkout@v3
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: pecl, composer:v2.3
extensions: "curl, sockets, fileinfo, ${{ matrix.extensions }}"
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Normally, we'd just add "scoutapm" to the above extensions in shivammathur/setup-php, but libcurl appears to
# be missing wherever the extension is built (not immediately obvious), so install it first
- name: "Install scoutapm extension"
if: ${{ matrix.scout-ext == 'with-scout-ext' }}
run: |
sudo apt-get update
sudo apt --fix-broken install
sudo apt-get install -y libcurl4-openssl-dev
sudo mkdir -p /tmp/pear/temp
sudo pecl update-channels
yes | sudo pecl install -f scoutapm
- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --prefer-dist --no-interaction --no-progress"
- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --prefer-dist --no-interaction --no-progress"
- name: "Run PHPUnit test suite"
run: "vendor/bin/phpunit --testsuite=unit,integration"
windows-unit:
name: "Windows tests"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- "windows-latest"
dependencies:
- "lowest"
- "highest"
scout-ext:
- "with-scout-ext"
- "no-scout-ext"
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
- uses: actions/checkout@v3
- uses: Vampire/setup-wsl@v2
if: ${{ matrix.os == 'windows-latest' }}
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
ini-values: "${{ matrix.scout-ext == 'with-scout-ext' && 'zend_extension=D:\\a\\scout-apm-php\\scout-apm-php\\php_scoutapm.dll' || '' }}"
tools: pecl, composer:v2.3
extensions: "curl, sockets, fileinfo, ${{ matrix.extensions }}"
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Get latest scoutapm extension version"
if: ${{ matrix.scout-ext == 'with-scout-ext' }}
uses: octokit/[email protected]
id: get_latest_ext_release
with:
route: GET /repos/scoutapp/scout-apm-php-ext/releases/latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Install scoutapm extension"
if: ${{ matrix.scout-ext == 'with-scout-ext' }}
shell: wsl-bash {0}
run: |
apt-get update && apt-get install -y jq curl unzip
# `shivammathur/setup-php` uses "nts" by default: https://github.com/shivammathur/setup-php#phpts-optional
SCOUT_EXT_THREAD_SAFE="nts"
# `windows-latest` currently uses x64
SCOUT_EXT_ARCH="x64"
SCOUT_EXT_CONFIGURATION="${{ matrix.php-version }}-${SCOUT_EXT_THREAD_SAFE}-${SCOUT_EXT_ARCH}"
SCOUT_EXT_DLL_ZIP=$(echo '${{ toJSON(fromJson(steps.get_latest_ext_release.outputs.data).assets) }}' | jq -r "map(select(.name | contains(\"${SCOUT_EXT_CONFIGURATION}\"))) | .[0].browser_download_url")
echo "Found release URL: ${SCOUT_EXT_DLL_ZIP}"
curl -L -o scoutapm-ext.zip "${SCOUT_EXT_DLL_ZIP}"
unzip scoutapm-ext.zip php_scoutapm.dll
- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --prefer-dist --no-interaction --no-progress"
- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --prefer-dist --no-interaction --no-progress"
- name: "Run PHPUnit test suite - unit"
run: "vendor/bin/phpunit --testsuite=unit"
- name: "Download and run core agent"
shell: wsl-bash {0}
run: |
sudo apt-get update && sudo apt-get install -y wget
wget https://s3-us-west-1.amazonaws.com/scout-public-downloads/apm_core_agent/release/scout_apm_core-v1.4.0-x86_64-unknown-linux-musl.tgz
tar zxvf scout_apm_core-v1.4.0-x86_64-unknown-linux-musl.tgz
./core-agent start --tcp 0.0.0.0:4444 --log-file core-agent.log --log-level DEBUG --daemonize true
- name: "Run PHPUnit test suite - integration"
run: "vendor/bin/phpunit --testsuite=integration --testdox"
env:
SCOUT_CORE_AGENT_DOWNLOAD: false
SCOUT_CORE_AGENT_LAUNCH: false
SCOUT_CORE_AGENT_SOCKET_PATH: tcp://127.0.0.1:4444
memory-leak-unit:
name: "Memory leak test"
needs: [ check_secrets ]
if: needs.check_secrets.outputs.has_scout_apm_key_secret == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dependencies: ["highest"]
scout-ext: ["with-scout-ext", "no-scout-ext"]
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
- uses: actions/checkout@v3
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: pecl, composer:v2.3
extensions: "curl"
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Normally, we'd just add "scoutapm" to the above extensions in shivammathur/setup-php, but libcurl appears to
# be missing wherever the extension is built (not immediately obvious), so install it first
- name: "Install scoutapm extension"
if: matrix.scout-ext == 'with-scout-ext'
run: |
sudo apt-get update
sudo apt --fix-broken install
sudo apt-get install -y libcurl4-openssl-dev
sudo mkdir -p /tmp/pear/temp
sudo pecl update-channels
yes | sudo pecl install -f scoutapm
- name: "Install lowest dependencies"
if: matrix.dependencies == 'lowest'
run: "composer update --prefer-lowest --prefer-dist --no-interaction --no-progress"
- name: "Install highest dependencies"
if: matrix.dependencies == 'highest'
run: "composer update --prefer-dist --no-interaction --no-progress"
- name: "Check for memory leaks"
run: "tests/check-memory-leaks.sh"
coding-standards:
name: "Check coding standards"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "7.2"
tools: composer:v2.3
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Install dependencies"
run: "composer install --no-interaction --prefer-dist"
- name: "Run PHP_CodeSniffer"
run: "vendor/bin/phpcs"
static-analysis:
name: "Perform static analysis"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "7.2"
tools: composer:v2.3
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Install dependencies"
run: "composer install --no-interaction --prefer-dist"
- name: "Run Psalm"
run: "vendor/bin/psalm"
roave-backwards-compatibility-check:
name: "Check for Backward Compatibility breaks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "8.1"
tools: composer:v2.3
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Require Roave/BackwardCompatibilityCheck"
run: "composer require --no-update --no-interaction --prefer-dist --prefer-stable --dev roave/backward-compatibility-check:^6.0.1"
- name: "Composer update with new requirements"
run: "composer update --no-interaction --prefer-dist --prefer-stable"
- name: "Check for BC breaks"
run: ".github/workflows/roave-backwards-compatibility-check.sh --install-development-dependencies --from=origin/${{ github.base_ref }}"
###############################################################################
################################### SYMFONY ###################################
###############################################################################
symfony-unit:
needs: base-unit
name: "Symfony Unit"
runs-on: ubuntu-latest
strategy:
matrix:
extensions: ["scoutapm", ""]
twig-version:
- "2.*"
- "3.*"
symfony-version:
- "4.*"
- "5.*"
- "6.*"
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
exclude:
- { symfony-version: "6.*", php-version: "7.2" } # Symfony 6 requires 8.0+
- { symfony-version: "6.*", php-version: "7.3" } # Symfony 6 requires 8.0+
- { symfony-version: "6.*", php-version: "7.4" } # Symfony 6 requires 8.0+
steps:
- uses: actions/checkout@v3
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: pecl, composer:v2.3
extensions: ${{ matrix.extensions }}
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# --no-update then a full `composer update` is needed to overcome locked dependencies
# See: https://github.com/composer/composer/issues/9561
- name: "Remove existing requirements components (avoid conflicts)"
run: "composer remove --dev symfony/* laravel/* api-ecosystem-for-laravel/dingo-api --no-update --no-interaction"
- name: "Require Symfony ${{ matrix.symfony-version }}, Twig ${{ matrix.twig-version }}"
run: "composer require symfony/symfony:${{ matrix.symfony-version }} twig/twig:${{ matrix.twig-version }} symfony/orm-pack:^2.0 symfony/twig-pack:^1.0 --no-update --no-interaction --prefer-dist --prefer-stable"
- name: "Composer update with new requirements"
run: "composer update --no-interaction --prefer-dist --prefer-stable"
- name: "Run PHPUnit test suite"
run: "vendor/bin/phpunit --testsuite=symfony"
###############################################################################
################################### LARAVEL ###################################
###############################################################################
laravel-unit:
needs: base-unit
name: "Laravel Unit"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
extensions: ["scoutapm", ""]
laravel-version:
- "5.5.*"
- "6.*"
- "7.*"
- "8.*"
- "9.*"
- "10.*"
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.3
exclude:
# See - https://laravel.com/docs/9.x/releases#support-policy
# See - https://github.com/laravel/framework/issues/40339
# Laravel 5.5 supports PHP 7.1 - 7.4
- {laravel-version: "5.5.*", php-version: "8.0"} # Laravel 5.5.* does not support PHP 8.0+
- {laravel-version: "5.5.*", php-version: "8.1"} # Laravel 5.5.* does not support PHP 8.0+
- {laravel-version: "5.5.*", php-version: "8.2"} # Laravel 5.5.* does not support PHP 8.0+
- {laravel-version: "5.5.*", php-version: "8.3"} # Laravel 5.5.* does not support PHP 8.0+
# Laravel 6 supports PHP 7.2 - 8.0
- {laravel-version: "6.*", php-version: "8.1"} # Laravel 6 does not support PHP 8.1+
- {laravel-version: "6.*", php-version: "8.2"} # Laravel 6 does not support PHP 8.1+
- {laravel-version: "6.*", php-version: "8.3"} # Laravel 6 does not support PHP 8.1+
# Laravel 7 supports PHP 7.2 - 8.0
- {laravel-version: "7.*", php-version: "8.1"} # Laravel 7 does not support PHP 8.1+
- {laravel-version: "7.*", php-version: "8.2"} # Laravel 7 does not support PHP 8.1+
- {laravel-version: "7.*", php-version: "8.3"} # Laravel 7 does not support PHP 8.1+
# Laravel 8 supports PHP 7.3 - 8.1
- {laravel-version: "8.*", php-version: "7.2"} # Laravel 8 requires 7.3+
- {laravel-version: "8.*", php-version: "8.2"} # Laravel 8 does not support PHP 8.2+
- {laravel-version: "8.*", php-version: "8.3"} # Laravel 8 does not support PHP 8.2+
# Laravel 9 supports PHP 8.0 - 8.2
- {laravel-version: "9.*", php-version: "7.2"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "7.3"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "7.4"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "8.3"} # Laravel 9 does not support PHP 8.3+
# Laravel 10 supports PHP 8.1 - 8.2 @todo tbc
- {laravel-version: "10.*", php-version: "7.2"} # Laravel 10 requires 8.1+
- {laravel-version: "10.*", php-version: "7.3"} # Laravel 10 requires 8.1+
- {laravel-version: "10.*", php-version: "7.4"} # Laravel 10 requires 8.1+
- {laravel-version: "10.*", php-version: "8.0"} # Laravel 10 requires 8.1+
steps:
- uses: actions/checkout@v3
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: pecl, composer:v2.3
extensions: ${{ matrix.extensions }}
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# --no-update then a full `composer update` is needed to overcome locked dependencies
# See: https://github.com/composer/composer/issues/9561
- name: "Remove existing requirements components (avoid conflicts)"
run: "composer remove --dev symfony/* laravel/* api-ecosystem-for-laravel/dingo-api --no-update --no-interaction"
- name: "Require framework ${{ matrix.laravel-version}}"
run: "composer require laravel/framework:${{ matrix.laravel-version}} --no-update --no-interaction --prefer-dist --prefer-stable"
- name: "Install spatie/laravel-ignition ^1.6 (if available)"
if: ${{ (matrix.php-version == '8.0' || matrix.php-version == '8.1') && (matrix.laravel-version == '8.*' || matrix.laravel-version == '9.*') }}
run: "composer require --dev spatie/laravel-ignition:^1.6 --no-update --no-interaction"
- name: "Install spatie/laravel-ignition ^2.0 (if available)"
if: ${{ (matrix.php-version == '8.1' || matrix.php-version == '8.2' || matrix.php-version == '8.3') && (matrix.laravel-version == '10.*') }}
run: "composer require --dev spatie/laravel-ignition:^2.0 --no-update --no-interaction"
- name: "Unrestrict nesbot/carbon for older PHP versions"
if: ${{ (matrix.php-version == '7.2' || matrix.php-version == '7.3' || matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1') }}
run: "composer remove --dev --no-update --no-interaction nesbot/carbon"
- name: "Composer update with new requirements"
run: "composer update --no-interaction --prefer-dist --prefer-stable"
- name: "Run PHPUnit (Laravel) test suite"
run: "vendor/bin/phpunit --testsuite=laravel"
laravel-e2e:
needs: [ check_secrets, laravel-unit ]
if: needs.check_secrets.outputs.has_scout_apm_key_secret == 'true'
name: "Laravel E2E"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
extensions: ["scoutapm", ""]
laravel-version:
- "5.5.*"
- "6.*"
- "7.*"
- "8.*"
- "9.*"
- "10.*"
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.3
exclude:
# See - https://laravel.com/docs/9.x/releases#support-policy
# See - https://github.com/laravel/framework/issues/40339
# Laravel 5.5 supports PHP 7.1 - 7.4
- {laravel-version: "5.5.*", php-version: "8.0"} # Laravel 5.5.* does not support PHP 8.0+
- {laravel-version: "5.5.*", php-version: "8.1"} # Laravel 5.5.* does not support PHP 8.0+
- {laravel-version: "5.5.*", php-version: "8.2"} # Laravel 5.5.* does not support PHP 8.0+
- {laravel-version: "5.5.*", php-version: "8.3"} # Laravel 5.5.* does not support PHP 8.0+
# Laravel 6 supports PHP 7.2 - 8.0
- {laravel-version: "6.*", php-version: "8.1"} # Laravel 6 does not support PHP 8.1+
- {laravel-version: "6.*", php-version: "8.2"} # Laravel 6 does not support PHP 8.1+
- {laravel-version: "6.*", php-version: "8.3"} # Laravel 6 does not support PHP 8.1+
# Laravel 7 supports PHP 7.2 - 8.0
- {laravel-version: "7.*", php-version: "8.1"} # Laravel 7 does not support PHP 8.1+
- {laravel-version: "7.*", php-version: "8.2"} # Laravel 7 does not support PHP 8.1+
- {laravel-version: "7.*", php-version: "8.3"} # Laravel 7 does not support PHP 8.1+
# Laravel 8 supports PHP 7.3 - 8.1
- {laravel-version: "8.*", php-version: "7.2"} # Laravel 8 requires 7.3+
- {laravel-version: "8.*", php-version: "8.2"} # Laravel 8 does not support PHP 8.2+
- {laravel-version: "8.*", php-version: "8.3"} # Laravel 8 does not support PHP 8.2+
# Laravel 9 supports PHP 8.0 - 8.2
- {laravel-version: "9.*", php-version: "7.2"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "7.3"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "7.4"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "8.3"} # Laravel 9 does not support PHP 8.3+
# Laravel 10 supports PHP 8.1 - 8.2 @todo tbc
- {laravel-version: "10.*", php-version: "7.2"} # Laravel 10 requires 8.1+
- {laravel-version: "10.*", php-version: "7.3"} # Laravel 10 requires 8.1+
- {laravel-version: "10.*", php-version: "7.4"} # Laravel 10 requires 8.1+
- {laravel-version: "10.*", php-version: "8.0"} # Laravel 10 requires 8.1+
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
- uses: actions/checkout@v3
with:
path: scout-apm-php
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: pecl, composer:v2.3
extensions: ${{ matrix.extensions }}
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Composer allow-plugins to allow Laravel to actually install"
run: composer config --global allow-plugins true
- name: "Install Laravel quickstart project"
run: "composer create-project laravel/laravel:${{ matrix.laravel-version}} test-app --prefer-dist"
- name: "Add scout-apm-php as a repository"
run: cd test-app && composer config repositories.scout path ../scout-apm-php
- name: "Allow Composer plugins to run for this project"
run: cd test-app && composer config --no-plugins allow-plugins true
- name: "Require scout-apm-php current checkout"
run: cd test-app && composer require scoutapp/scout-apm-php:*@dev guzzlehttp/guzzle composer/package-versions-deprecated
- name: "Publish the provider"
run: cd test-app && php artisan vendor:publish --provider="Scoutapm\Laravel\Providers\ScoutApmServiceProvider"
- name: "Configure error handler (Laravel 5-6)"
if: matrix.laravel-version == '5.5.*' || matrix.laravel-version == '6.*'
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel5-6-exception-handler.php app/Exceptions/Handler.php
- name: "Configure error handler (Laravel 7)"
if: matrix.laravel-version == '7.*'
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel7-exception-handler.php app/Exceptions/Handler.php
- name: "Configure error handler (Laravel 8)"
if: matrix.laravel-version == '8.*'
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel8-exception-handler.php app/Exceptions/Handler.php
- name: "Configure error handler (Laravel 9)"
if: matrix.laravel-version == '9.*' || matrix.laravel-version == '10.*'
run: cd test-app && cp ../scout-apm-php/.github/fixtures/laravel9-exception-handler.php app/Exceptions/Handler.php
- name: "Add route to trigger error"
run: cd test-app && echo -e "Route::get('/e', function () { throw new \RuntimeException('fail'); });" >> routes/web.php
- name: "Configure Scout"
run: cd test-app && echo -e "\nSCOUT_KEY=\"\${SCOUT_APM_KEY}\"\nSCOUT_NAME=\"My Laravel App\"\nSCOUT_MONITOR=true\nSCOUT_LOG_LEVEL=\"debug\"\nSCOUT_ERRORS_ENABLED=true\nSCOUT_LOG_PAYLOAD_CONTENT=true" >> .env
- name: "Load the index page to trigger instrumentation"
run: |
cd test-app
cat .env
php artisan serve &
# Give Laravel a chance to start...
sleep 2
# Very occasionally in GH Actions, core-agent didn't quite start in time - so load the page twice
wget -O /dev/null http://localhost:8000
sleep 1
# Regular page load instrumentation
wget --content-on-error -O index.html http://localhost:8000
cat index.html
# Error capture
wget --content-on-error -O error.html http://localhost:8000/e || true
cat error.html
ps -ax
- name: "Output logs on failure"
if: failure()
run: cat test-app/storage/logs/laravel.log
- name: "Check logs for successful payload send"
run: |
cd test-app
cat storage/logs/laravel.log
echo "Checking for APM instrumentation"
grep -q "local.DEBUG: \[Scout\] Sent whole payload successfully to core agent." storage/logs/laravel.log
echo "Checking for Error Reporting"
grep -q "local.DEBUG: \[Scout\] Sent 1 error event to Scout Error Reporting" storage/logs/laravel.log
artisan-test:
needs: [ check_secrets, laravel-unit ]
if: needs.check_secrets.outputs.has_scout_apm_key_secret == 'true'
name: "Artisan Test"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
extensions: ["scoutapm", ""]
laravel-version:
- "5.5.*"
- "6.*"
- "7.*"
- "8.*"
- "9.*"
- "10.*"
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.2
exclude:
# See - https://laravel.com/docs/9.x/releases#support-policy
# See - https://github.com/laravel/framework/issues/40339
# Laravel 5.5 supports PHP 7.1 - 7.4
- {laravel-version: "5.5.*", php-version: "8.0"} # Laravel 5.5.* does not support PHP 8.0+
- {laravel-version: "5.5.*", php-version: "8.1"} # Laravel 5.5.* does not support PHP 8.0+
- {laravel-version: "5.5.*", php-version: "8.2"} # Laravel 5.5.* does not support PHP 8.0+
- {laravel-version: "5.5.*", php-version: "8.3"} # Laravel 5.5.* does not support PHP 8.0+
# Laravel 6 supports PHP 7.2 - 8.0
- {laravel-version: "6.*", php-version: "8.1"} # Laravel 6 does not support PHP 8.1+
- {laravel-version: "6.*", php-version: "8.2"} # Laravel 6 does not support PHP 8.1+
- {laravel-version: "6.*", php-version: "8.3"} # Laravel 6 does not support PHP 8.1+
# Laravel 7 supports PHP 7.2 - 8.0
- {laravel-version: "7.*", php-version: "8.1"} # Laravel 7 does not support PHP 8.1+
- {laravel-version: "7.*", php-version: "8.2"} # Laravel 7 does not support PHP 8.1+
- {laravel-version: "7.*", php-version: "8.3"} # Laravel 7 does not support PHP 8.1+
# Laravel 8 supports PHP 7.3 - 8.1
- {laravel-version: "8.*", php-version: "7.2"} # Laravel 8 requires 7.3+
- {laravel-version: "8.*", php-version: "8.2"} # Laravel 8 does not support PHP 8.2+
- {laravel-version: "8.*", php-version: "8.3"} # Laravel 8 does not support PHP 8.2+
# Laravel 9 supports PHP 8.0 - 8.2
- {laravel-version: "9.*", php-version: "7.2"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "7.3"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "7.4"} # Laravel 9 requires 8.0+
- {laravel-version: "9.*", php-version: "8.3"} # Laravel 9 does not support PHP 8.3+
# Laravel 10 supports PHP 8.1 - 8.2 @todo tbc
- {laravel-version: "10.*", php-version: "7.2"} # Laravel 10 requires 8.1+
- {laravel-version: "10.*", php-version: "7.3"} # Laravel 10 requires 8.1+
- {laravel-version: "10.*", php-version: "7.4"} # Laravel 10 requires 8.1+
- {laravel-version: "10.*", php-version: "8.0"} # Laravel 10 requires 8.1+
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
- uses: actions/checkout@v3
with:
path: scout-apm-php
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: pecl, composer:v2.3
extensions: ${{ matrix.extensions }}
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Composer allow-plugins to allow Laravel to actually install"
run: composer config --global allow-plugins true
- name: "Install Laravel quickstart project"
run: "composer create-project laravel/laravel:${{ matrix.laravel-version}} test-app --prefer-dist"
- name: "Add scout-apm-php as a repository"
run: cd test-app && composer config repositories.scout path ../scout-apm-php
- name: "Allow Composer plugins to run for this project"
run: cd test-app && composer config --no-plugins allow-plugins true
- name: "Require scout-apm-php current checkout"
run: cd test-app && composer require scoutapp/scout-apm-php:*@dev guzzlehttp/guzzle composer/package-versions-deprecated
- name: "Publish the provider"
run: cd test-app && php artisan vendor:publish --provider="Scoutapm\Laravel\Providers\ScoutApmServiceProvider"
- name: "Configure Scout"
run: cd test-app && echo -e "\nSCOUT_KEY=\"\${SCOUT_APM_KEY}\"\nSCOUT_NAME=\"My Laravel App\"\nSCOUT_MONITOR=true\nSCOUT_LOG_LEVEL=\"debug\"\nSCOUT_ERRORS_ENABLED=true" >> .env
- name: "Run core agent"
run: |
cd test-app
cat .env
php artisan scoutapm:core-agent --download --launch
- name: "Check core agent is running"
run: |
sleep 2
ps ax | grep core-agent
pgrep core-agent
###############################################################################
#################################### LUMEN ####################################
###############################################################################
lumen-unit:
needs: base-unit
name: "Lumen Unit"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
extensions: ["scoutapm", ""]
lumen-version:
- "5.5.*"
- "6.*"
- "7.*"
- "8.*"
- "9.*"
- "10.*"
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.2
exclude:
# Lumen 5.5 supports PHP 7.1 - 7.3
- {lumen-version: "5.5.*", php-version: "7.4"} # Lumen 5.5 does not support PHP 7.4+
- {lumen-version: "5.5.*", php-version: "8.0"} # Lumen 5.5 does not support PHP 7.4+
- {lumen-version: "5.5.*", php-version: "8.1"} # Lumen 5.5 does not support PHP 7.4+
- {lumen-version: "5.5.*", php-version: "8.2"} # Lumen 5.5 does not support PHP 7.4+
- {lumen-version: "5.5.*", php-version: "8.3"} # Lumen 5.5 does not support PHP 7.4+
# Lumen 6 supports PHP 7.2 - 7.4
- {lumen-version: "6.*", php-version: "8.0"} # Lumen 6 does not support PHP 8.0+
- {lumen-version: "6.*", php-version: "8.1"} # Lumen 6 does not support PHP 8.0+
- {lumen-version: "6.*", php-version: "8.2"} # Lumen 6 does not support PHP 8.0+
- {lumen-version: "6.*", php-version: "8.3"} # Lumen 6 does not support PHP 8.0+
# Lumen 7 supports PHP 7.2 - 7.4
- {lumen-version: "7.*", php-version: "8.0"} # Lumen 7 does not support PHP 8.0+
- {lumen-version: "7.*", php-version: "8.1"} # Lumen 7 does not support PHP 8.0+
- {lumen-version: "7.*", php-version: "8.2"} # Lumen 7 does not support PHP 8.0+
- {lumen-version: "7.*", php-version: "8.3"} # Lumen 7 does not support PHP 8.0+
# Lumen 8 supports PHP 7.3 - 8.1
- {lumen-version: "8.*", php-version: "7.2"} # Lumen 8 requires 7.3+
- {lumen-version: "8.*", php-version: "8.2"} # Lumen 8 does not support PHP 8.2+
- {lumen-version: "8.*", php-version: "8.3"} # Lumen 8 does not support PHP 8.2+
# Lumen 9 supports PHP 8.0 - 8.2
- {lumen-version: "9.*", php-version: "7.2"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "7.3"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "7.4"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "8.3"} # Lumen 9 does not support PHP 8.3+
# Lumen 10 supports PHP 8.1 - 8.2 @todo tbc
- {lumen-version: "10.*", php-version: "7.2"} # Lumen 10 requires 8.1+
- {lumen-version: "10.*", php-version: "7.3"} # Lumen 10 requires 8.1+
- {lumen-version: "10.*", php-version: "7.4"} # Lumen 10 requires 8.1+
- {lumen-version: "10.*", php-version: "8.0"} # Lumen 10 requires 8.1+
steps:
- uses: actions/checkout@v3
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: pecl, composer:v2.3
extensions: ${{ matrix.extensions }}
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# --no-update then a full `composer update` is needed to overcome locked dependencies
# See: https://github.com/composer/composer/issues/9561
- name: "Remove existing requirements components (avoid conflicts)"
run: "composer remove --dev symfony/* laravel/* api-ecosystem-for-laravel/dingo-api --no-update --no-interaction"
- name: "Require framework ${{ matrix.lumen-version}}"
run: "composer require laravel/lumen:${{ matrix.lumen-version}} --no-update --no-interaction --prefer-dist --prefer-stable"
- name: "Unrestrict nesbot/carbon for older PHP versions"
if: ${{ (matrix.php-version == '7.2' || matrix.php-version == '7.3' || matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1') }}
run: "composer remove --dev --no-update --no-interaction nesbot/carbon"
- name: "Composer update with new requirements"
run: "composer update --no-interaction --prefer-dist --prefer-stable"
- name: "Run PHPUnit (Lumen) test suite"
run: "vendor/bin/phpunit --testsuite=laravel" # Test suite is same as Laravel
lumen-e2e:
needs: [ check_secrets, lumen-unit ]
if: needs.check_secrets.outputs.has_scout_apm_key_secret == 'true'
name: "Lumen E2E"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
extensions: ["scoutapm", ""]
lumen-version:
- "5.5.*"
- "6.*"
- "7.*"
- "8.*"
- "9.*"
- "10.*"
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3" # @todo confirm which versions of Laravel will support PHP 8.2
exclude:
# Lumen 5.5 supports PHP 7.1 - 7.3
- {lumen-version: "5.5.*", php-version: "7.4"} # Lumen 5.5 does not support PHP 7.4+
- {lumen-version: "5.5.*", php-version: "8.0"} # Lumen 5.5 does not support PHP 7.4+
- {lumen-version: "5.5.*", php-version: "8.1"} # Lumen 5.5 does not support PHP 7.4+
- {lumen-version: "5.5.*", php-version: "8.2"} # Lumen 5.5 does not support PHP 7.4+
- {lumen-version: "5.5.*", php-version: "8.3"} # Lumen 5.5 does not support PHP 7.4+
# Lumen 6 supports PHP 7.2 - 7.4
- {lumen-version: "6.*", php-version: "8.0"} # Lumen 6 does not support PHP 8.0+
- {lumen-version: "6.*", php-version: "8.1"} # Lumen 6 does not support PHP 8.0+
- {lumen-version: "6.*", php-version: "8.2"} # Lumen 6 does not support PHP 8.0+
- {lumen-version: "6.*", php-version: "8.3"} # Lumen 6 does not support PHP 8.0+
# Lumen 7 supports PHP 7.2 - 7.4
- {lumen-version: "7.*", php-version: "8.0"} # Lumen 7 does not support PHP 8.0+
- {lumen-version: "7.*", php-version: "8.1"} # Lumen 7 does not support PHP 8.0+
- {lumen-version: "7.*", php-version: "8.2"} # Lumen 7 does not support PHP 8.0+
- {lumen-version: "7.*", php-version: "8.3"} # Lumen 7 does not support PHP 8.0+
# Lumen 8 supports PHP 7.3 - 8.1
- {lumen-version: "8.*", php-version: "7.2"} # Lumen 8 requires 7.3+
- {lumen-version: "8.*", php-version: "8.2"} # Lumen 8 does not support PHP 8.2+
- {lumen-version: "8.*", php-version: "8.3"} # Lumen 8 does not support PHP 8.2+
# Lumen 9 supports PHP 8.0 - 8.2
- {lumen-version: "9.*", php-version: "7.2"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "7.3"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "7.4"} # Lumen 9 requires 8.0+
- {lumen-version: "9.*", php-version: "8.3"} # Lumen 9 does not support PHP 8.3+
# Lumen 10 supports PHP 8.1 - 8.2 @todo tbc
- {lumen-version: "10.*", php-version: "7.2"} # Lumen 10 requires 8.1+
- {lumen-version: "10.*", php-version: "7.3"} # Lumen 10 requires 8.1+
- {lumen-version: "10.*", php-version: "7.4"} # Lumen 10 requires 8.1+
- {lumen-version: "10.*", php-version: "8.0"} # Lumen 10 requires 8.1+
env:
SCOUT_APM_KEY: ${{ secrets.SCOUT_APM_KEY }}
steps:
- name: "Skip if SCOUT_APM_KEY secret is not available"
run: echo 'This job is skipped entirely as it needs SCOUT_APM_KEY set in secrets.'
- uses: actions/checkout@v3
with:
path: scout-apm-php
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: pecl, composer:v2.3
extensions: ${{ matrix.extensions }}
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Composer allow-plugins to allow Laravel to actually install"
run: composer config --global allow-plugins true
- name: "Install Lumen quickstart project"
run: "composer create-project laravel/lumen:${{ matrix.lumen-version}} test-app --prefer-dist"
- name: "Add scout-apm-php as a repository"
run: cd test-app && composer config repositories.scout path ../scout-apm-php
- name: "Require scout-apm-php current checkout"
run: cd test-app && composer require scoutapp/scout-apm-php:*@dev guzzlehttp/guzzle composer/package-versions-deprecated
- name: "Configure the application"
run: cd test-app && cp ../scout-apm-php/.github/fixtures/lumen-app.php bootstrap/app.php
- name: "Configure Scout"
run: cd test-app && echo -e "\nSCOUT_KEY=\"\${SCOUT_APM_KEY}\"\nSCOUT_NAME=\"My Lumen App\"\nSCOUT_MONITOR=true\nSCOUT_LOG_LEVEL=\"debug\"\nSCOUT_LOG_PAYLOAD_CONTENT=true" >> .env
- name: "Load the index page to trigger instrumentation"
run: |
cd test-app
cat .env
LOG_CHANNEL=single php -S localhost:8000 -t public/ &
# Give Lumen a chance to start...
sleep 2
# Very occasionally in GH Actions, core-agent didn't quite start in time - so load the page twice
wget -O /dev/null http://localhost:8000
sleep 1
wget http://localhost:8000
cat index.html
ps -ax
- name: "Output logs on failure"
if: failure()
run: cat test-app/storage/logs/lumen.log
- name: "Check logs for successful payload send"
run: |
cd test-app
ls -l storage/logs/
cat storage/logs/lumen.log
grep -q "DEBUG: \[Scout\] Sent whole payload successfully to core agent." storage/logs/lumen.log