-
Notifications
You must be signed in to change notification settings - Fork 147
/
config.yml
1183 lines (1134 loc) · 43.3 KB
/
config.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
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
version: "2.1"
aliases:
- &CACHE_COMPOSER_KEY
key: 'betav1-composer-deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "composer.json" }}'
- &CACHE_NPM_KEY
key: 'betav1-lint-deps-{{ checksum "composer.json" }}'
- &IMAGE_DOCKER_DD_AGENT
image: datadog/agent:latest
environment:
- DD_APM_ENABLED=true
- DD_BIND_HOST=0.0.0.0
- DD_API_KEY=invalid_key_but_this_is_fine
- &IMAGE_DOCKER_REDIS
image: circleci/redis:4.0-alpine
name: redis_integration
- &IMAGE_DOCKER_ELASTICSEARCH2
image: elasticsearch:2
name: elasticsearch2_integration
- &IMAGE_DOCKER_HTTPBIN
image: kennethreitz/httpbin
name: httpbin_integration
- &IMAGE_DOCKER_MEMCHACED
image: memcached:1.5-alpine
name: memcached_integration
- &IMAGE_DOCKER_MYSQL
image: datadog/dd-trace-ci:php-mysql-dev-5.6
name: mysql_integration
environment:
- MYSQL_ROOT_PASSWORD=test
- MYSQL_PASSWORD=test
- MYSQL_USER=test
- MYSQL_DATABASE=test
- &IMAGE_DOCKER_MONGO
image: "circleci/mongo:4.0"
name: mongodb_integration
environment:
- MONGO_INITDB_ROOT_USERNAME=test
- MONGO_INITDB_ROOT_PASSWORD=test
- &IMAGE_DOCKER_REQUEST_REPLAYER
image: datadog/dd-trace-ci:php-request-replayer
name: request-replayer
environment:
DD_REQUEST_DUMPER_FILE: dump.json
- &STEP_ATTACH_WORKSPACE
attach_workspace:
at: ~/datadog
- &STEP_EXT_INSTALL
run:
name: Build and install extension
command: make sudo install install_ini BUILD_DIR=tmp/build_extension
- &STEP_COMPOSER_SELF_UPDATE
run:
name: Updating composer itself
command: sudo composer self-update
- &STEP_COMPOSER_CACHE_RESTORE
restore_cache:
<<: *CACHE_COMPOSER_KEY
- &STEP_COMPOSER_CACHE_SAVE
save_cache:
<<: *CACHE_COMPOSER_KEY
paths:
- vendor/
- &STEP_COMPOSER_DISABLE_TLS
run:
name: Disabling tls for php < 5.6 (https://stackoverflow.com/questions/47527455/getting-an-error-peer-fingerprint-did-not-match-after-running-composer-update)
command: composer config disable-tls true
- &STEP_COMPOSER_INSTALL
run:
name: Installing dependencies with composer
command: composer install --no-interaction
- &STEP_COMPOSER_COMPILE
run:
name: Compiling dd-tace-php files into single file
command: composer compile
- &STEP_COMPOSER_COMPILE_VERIFY
run:
name: Verifying dd-tace-php files compiled into single file
command: composer compile-verify
- &STEP_PREPARE_TEST_RESULTS_DIR
run:
name: testresults dir
command: mkdir test-results
- &STEP_EXPORT_CI_ENV
run:
name: export .env.circleci
command: |
echo "export $(cat .env.circleci | xargs)" >> $HOME/.profile
- &STEP_DISABLE_XDEBUG
run:
name: Disable Xdebug for built-in web tests
command: test -e /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && sudo rm -f $_ || true
- &STEP_WAIT_AGENT
run:
name: Waiting for Dockerized agent
command: dockerize -wait tcp://127.0.0.1:8126 -timeout 1m && export
- &STEP_WAIT_MYSQL
run:
name: Waiting for Dockerized MySQL
command: dockerize -wait tcp://mysql_integration:3306 -timeout 1m
- &STEP_WAIT_REQUEST_REPLAYER
run:
name: Waiting for Dockerized request replayer
command: dockerize -wait tcp://request-replayer:80/clear-dumped-data -timeout 2m
- &STEP_PERSIST_TO_WORKSPACE
persist_to_workspace:
root: '.'
paths:
- vendor/
- tmp/build_extension
- &STEP_STORE_TEST_RESULTS
store_test_results:
path: test-results
commands:
lib_curl_workaround:
parameters:
command:
type: string
default: none
steps:
- run:
name: Installing missing libcurl workaround
command: |
if [[ ! "<<parameters.command>>" == "none" ]]; then
<< parameters.command >>
fi;
install_extension:
parameters:
lib_curl_command:
type: string
default: none
steps:
- lib_curl_workaround:
command: << parameters.lib_curl_command >>
- <<: *STEP_EXT_INSTALL
copy_valgrind_rc:
parameters:
valgrind_config:
type: string
default: ""
steps:
- run:
name: Copy valgrind.rc configuration and suppressions
command: |
if [ -e ".circleci/valgrind/<< parameters.valgrind_config >>_valgrind.rc" ]; then
cp .circleci/valgrind/<< parameters.valgrind_config >>_valgrind.rc /home/circleci/.valgrindrc
cp .circleci/valgrind/valgrind_<< parameters.valgrind_config >>_suppressions.lib /home/circleci/valgrind_<< parameters.valgrind_config >>_suppressions.lib
fi
prepare_extension_and_composer_with_cache:
steps:
- <<: *STEP_EXT_INSTALL
- run: # disabled by default due to test flakiness
name: Disable TLS to avoid composer flakiness (https://stackoverflow.com/questions/47527455/getting-an-error-peer-fingerprint-did-not-match-after-running-composer-update)
command: composer config disable-tls true
- <<: *STEP_COMPOSER_SELF_UPDATE
- <<: *STEP_COMPOSER_CACHE_RESTORE
- <<: *STEP_COMPOSER_INSTALL
- <<: *STEP_COMPOSER_CACHE_SAVE
executors:
with_agent:
environment:
DDAGENT_HOSTNAME: 127.0.0.1
parameters:
docker_image:
type: string
docker:
- image: << parameters.docker_image >>
- <<: *IMAGE_DOCKER_DD_AGENT
with_httpbin:
environment:
DDAGENT_HOSTNAME: 127.0.0.1
parameters:
docker_image:
type: string
docker:
- image: << parameters.docker_image >>
- <<: *IMAGE_DOCKER_DD_AGENT
- <<: *IMAGE_DOCKER_HTTPBIN
with_integrations:
environment:
DDAGENT_HOSTNAME: 127.0.0.1
COMPOSER_MEMORY_LIMIT: -1 # disable composer memory limit completely
parameters:
docker_image:
type: string
docker:
- image: << parameters.docker_image >>
- <<: *IMAGE_DOCKER_DD_AGENT
- <<: *IMAGE_DOCKER_ELASTICSEARCH2
- <<: *IMAGE_DOCKER_HTTPBIN
- <<: *IMAGE_DOCKER_REDIS
- <<: *IMAGE_DOCKER_MEMCHACED
- <<: *IMAGE_DOCKER_MYSQL
- <<: *IMAGE_DOCKER_MONGO
- <<: *IMAGE_DOCKER_REQUEST_REPLAYER
jobs:
"Lint files":
working_directory: ~/datadog
docker:
- image: circleci/php:7.2-cli-node-browsers
steps:
- <<: *STEP_ATTACH_WORKSPACE
- lib_curl_workaround:
command: sudo apt update; sudo apt -y install libcurl4-nss-dev
- prepare_extension_and_composer_with_cache
- restore_cache:
<<: *CACHE_NPM_KEY
- run:
name: Installing dependencies with npm
command: npm install eclint --no-package-lock --no-save
- save_cache:
<<: *CACHE_NPM_KEY
paths:
- node_modules/
- run:
name: Creating directory for phpcs results
command: mkdir -p test-results/phpcs
- run:
name: Running eclint
command: node_modules/.bin/eclint check '**/*' '!dockerfiles/testing-environment/**/*' '!tests/ext/sandbox/*' '!tests/ext/sandbox-prehook/*' '!config.*' '!m4/*' '!tmp/**/*' '!vendor/**/*' '!src/ext/.libs/*' '!src/dogstatsd/**' '!LICENSE' '!phpstan.*.neon' '!tests/overhead/**' '!tests/Frameworks/*/Version_*/**' '!tests/dockerfiles/**' '!dockerfiles/**/*.patch' '!tests/AutoInstrumentation/**' '!.composer/**/*' '!src/ext/mpack/**' '!src/ext/third-party/**' '!LICENSE.*' || touch .failure
- run:
name: Running phpcs
command: composer lint -- --report=junit | tee test-results/phpcs/results.xml || touch .failure
- run:
name: Install Clang
command: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
(
echo "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch main"
echo "deb-src http://apt.llvm.org/stretch/ llvm-toolchain-stretch main"
) | sudo tee /etc/apt/sources.list.d/llvm-toolchain.list
sudo apt-get update
sudo apt-get -y install clang-format
- run:
name: Run clang-format
command: make clang_format_check CLANG_FORMAT=clang-format
- run:
name: Check linting failure
command: test -e .failure && exit 1 || true
- run:
name: Verify PECL config and Version files
command: make verify_all
- <<: *STEP_STORE_TEST_RESULTS
"Static Analysis":
working_directory: ~/datadog
docker:
- image: circleci/php:7.3
steps:
- <<: *STEP_ATTACH_WORKSPACE
- lib_curl_workaround:
command: sudo apt update; sudo apt -y install libcurl4-nss-dev
- prepare_extension_and_composer_with_cache
- run:
name: Install phpstan
command: |
composer global require phpstan/phpstan:0.12.*
composer global require psr/log
composer scenario:update
- run:
name: Running phpstan
command: composer scenario opentracing1 ; PATH=$PATH:~/.composer/vendor/bin composer static-analyze
"Post-Install Hook":
working_directory: ~/datadog
docker:
- image: datadog/dd-trace-ci:php-nginx-apache2
steps:
- <<: *STEP_ATTACH_WORKSPACE
- run:
name: Start Supervisor
command: supervisord
background: true
- run:
name: Copy post-install script
command: |
mkdir -p /src/ddtrace-scripts
cp package/post-install.sh /src/ddtrace-scripts
- run:
name: Test post-install hook
command: bash tests/PostInstallHook/run-tests.sh
opcache_tests:
parameters:
docker_image:
type: string
working_directory: ~/datadog
executor:
name: with_agent
docker_image: << parameters.docker_image >>
steps:
- <<: *STEP_ATTACH_WORKSPACE
- <<: *STEP_EXT_INSTALL
- <<: *STEP_EXPORT_CI_ENV
- <<: *STEP_PREPARE_TEST_RESULTS_DIR
- run:
name: Run opcache tests
command: |
export REPORT_EXIT_STATUS=1
cd tmp/build_extension
php run-tests.php -p $(which php) --show-all -d zend_extension=opcache.so ../../tests/opcache
xdebug_tests:
parameters:
docker_image:
type: string
xdebug_version_one:
type: string
xdebug_version_two:
type: string
default: none
working_directory: ~/datadog
executor:
name: with_agent
docker_image: << parameters.docker_image >>
steps:
- <<: *STEP_ATTACH_WORKSPACE
- <<: *STEP_EXT_INSTALL
- <<: *STEP_EXPORT_CI_ENV
- <<: *STEP_PREPARE_TEST_RESULTS_DIR
- run:
name: Run xdebug tests
command: |
export REPORT_EXIT_STATUS=1
cd tmp/build_extension
php run-tests.php -p $(which php) --show-all -d zend_extension=xdebug-<< parameters.xdebug_version_one >>.so ../../tests/xdebug/<< parameters.xdebug_version_one >>
if [[ ! "<<parameters.xdebug_version_two>>" == "none" ]]; then
php run-tests.php -p $(which php) --show-all -d zend_extension=xdebug-<< parameters.xdebug_version_two >>.so ../../tests/xdebug/<< parameters.xdebug_version_two >>
fi;
unit_tests:
parameters:
docker_image:
type: string
valgrind_config:
type: string
default: musl
lib_curl_command:
type: string
default: none
unit_test_target:
type: string
default: test_extension_ci
working_directory: ~/datadog
environment:
DDAGENT_HOSTNAME: 127.0.0.1
DD_AGENT_HOST: 127.0.0.1
HTTPBIN_HOSTNAME: httpbin_integration
executor:
name: with_httpbin
docker_image: << parameters.docker_image >>
steps:
- <<: *STEP_ATTACH_WORKSPACE
- lib_curl_workaround:
command: << parameters.lib_curl_command >>
- prepare_extension_and_composer_with_cache
- <<: *STEP_PREPARE_TEST_RESULTS_DIR
- <<: *STEP_EXPORT_CI_ENV
- copy_valgrind_rc:
valgrind_config: << parameters.valgrind_config >>
- run:
name: Run extension tests with leak detection
command: make << parameters.unit_test_target >> BUILD_DIR=tmp/build_extension JUNIT_RESULTS_DIR=$(pwd)/test-results
- run:
name: Run unit tests
command: composer test-unit -- --log-junit test-results/php-unit/results.xml
- <<: *STEP_PERSIST_TO_WORKSPACE
- <<: *STEP_STORE_TEST_RESULTS
- run:
command: |
mkdir -p /tmp/artifacts/core_dumps
find tmp -name "core.*" | xargs -I % -n 1 cp % /tmp/artifacts/core_dumps
cp -a tmp/build_extension/tests/ext /tmp/artifacts/tests
when: on_fail
- store_artifacts:
path: /tmp/artifacts
php_language_tests:
parameters:
docker_image:
type: string
xfail_list:
type: string
default: none
working_directory: ~/datadog
environment:
DDAGENT_HOSTNAME: 127.0.0.1
DD_AGENT_HOST: 127.0.0.1
executor:
name: with_agent
docker_image: << parameters.docker_image >>
steps:
- <<: *STEP_ATTACH_WORKSPACE
- prepare_extension_and_composer_with_cache
- <<: *STEP_PREPARE_TEST_RESULTS_DIR
- <<: *STEP_EXPORT_CI_ENV
- run:
name: Run tests
command: |
sudo rm -f /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini
if [[ ! "<<parameters.xfail_list>>" == "none" ]]; then
cp "<<parameters.xfail_list>>" /usr/local/src/php/xfail_tests.list
(
cd /usr/local/src/php
cat xfail_tests.list | xargs -n 1 rm -f || true
)
fi
cd /usr/local/src/php
export DD_TRACE_CLI_ENABLED=true
export DD_TRACE_STARTUP_LOGS=0
export DD_TRACE_WARN_LEGACY_DD_TRACE=0
export REPORT_EXIT_STATUS=1
export TEST_PHP_JUNIT=/tmp/artifacts/tests/php-tests.xml
mkdir -p /tmp/artifacts/tests
php run-tests.php -q \
-p /usr/local/bin/php \
--show-diff \
-d ddtrace.request_init_hook=/home/circleci/datadog/bridge/dd_wrap_autoloader.php
- run:
command: |
cd /usr/local/src/php
mkdir -p /tmp/artifacts/core_dumps
find ./ -name "core.*" | xargs -I % -n 1 cp % /tmp/artifacts/core_dumps
mkdir -p /tmp/artifacts/diffs
find -type f -name '*.diff' -exec cp --parents '{}' /tmp/artifacts/diffs \;
when: on_fail
- store_test_results:
path: /tmp/artifacts/tests/
- store_artifacts:
path: /tmp/artifacts/
base_integration_tests:
working_directory: ~/datadog
parameters:
docker_image:
type: string
resource_class: medium
executor:
name: with_integrations
docker_image: << parameters.docker_image >>
environment:
COMPOSER_PROCESS_TIMEOUT: 0
steps:
- <<: *STEP_ATTACH_WORKSPACE
- install_extension
- restore_cache: &INTEGRATION_COMPOSER_CACHE_KEY
key: 'betav1-composer-base-integration-deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "composer.json" }}'
- run: composer install --no-interaction --prefer-dist
- <<: *STEP_PREPARE_TEST_RESULTS_DIR
- <<: *STEP_EXPORT_CI_ENV
- <<: *STEP_WAIT_AGENT
- <<: *STEP_WAIT_MYSQL
- <<: *STEP_WAIT_REQUEST_REPLAYER
- run:
name: Run auto-instrumentation tests
command: composer test-auto-instrumentation -- --log-junit test-results/php-auto-instrumentation/results.xml
- run:
name: Run composer interoperability tests
command: composer test-composer -- --log-junit test-results/php-composer/results.xml
- run:
name: Run distributed-tracing tests
command: DD_TRACE_AGENT_TIMEOUT=1000 composer test-distributed-tracing -- --log-junit test-results/php-distributed-tracing/results.xml
- run:
name: Run integration tests
command: composer test-integration -- --log-junit test-results/php-integration/results.xml
- save_cache:
<<: *INTEGRATION_COMPOSER_CACHE_KEY
paths:
- vendor/
- ~/.composer/cache
- <<: *STEP_PERSIST_TO_WORKSPACE
- <<: *STEP_STORE_TEST_RESULTS
integration_tests:
working_directory: ~/datadog
parameters:
docker_image:
type: string
integration_testsuite:
type: string
lib_curl_command:
type: string
default: none
resource_class:
type: string
default: medium
sapi:
type: string
default: cli-server
resource_class: << parameters.resource_class >>
executor:
name: with_integrations
docker_image: << parameters.docker_image >>
environment:
COMPOSER_PROCESS_TIMEOUT: 0
steps:
- <<: *STEP_ATTACH_WORKSPACE
- install_extension:
lib_curl_command: << parameters.lib_curl_command >>
- restore_cache: &INTEGRATION_COMPOSER_CACHE_KEY
key: 'betav1-composer-integration-deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "composer.json" }}'
- run: composer install --no-interaction --prefer-dist
- <<: *STEP_EXPORT_CI_ENV
- <<: *STEP_DISABLE_XDEBUG
- <<: *STEP_WAIT_AGENT
- <<: *STEP_WAIT_MYSQL
- <<: *STEP_WAIT_REQUEST_REPLAYER
- run:
name: Run << parameters.integration_testsuite >> integration test
command: DD_TRACE_AGENT_TIMEOUT=1000 DD_TRACE_TEST_SAPI=<< parameters.sapi >> composer << parameters.integration_testsuite >>
- run:
command: |
mkdir -p /tmp/artifacts
find ~/datadog/tests -type f -name 'nginx_*.log' -o -name 'dd_php_error.log' -exec cp --parents '{}' /tmp/artifacts \;
when: on_fail
- store_artifacts:
path: /tmp/artifacts/
- save_cache:
<<: *INTEGRATION_COMPOSER_CACHE_KEY
paths:
- vendor/
- ~/.composer/cache
- <<: *STEP_PERSIST_TO_WORKSPACE
hyperfine_tests:
working_directory: ~/datadog
parameters:
docker_image:
type: string
lib_curl_command:
type: string
default: none
executor:
name: with_agent
docker_image: << parameters.docker_image >>
steps:
- <<: *STEP_ATTACH_WORKSPACE
- lib_curl_workaround:
command: << parameters.lib_curl_command >>
- prepare_extension_and_composer_with_cache
- <<: *STEP_PREPARE_TEST_RESULTS_DIR
- <<: *STEP_EXPORT_CI_ENV
- <<: *STEP_WAIT_AGENT
- run: |
set -xe
curl -q -o hyperfine.tgz -L https://github.com/sharkdp/hyperfine/releases/download/v1.6.0/hyperfine-v1.6.0-x86_64-unknown-linux-musl.tar.gz
tar xf hyperfine.tgz --strip-component=1
php -m | grep ddtrace
sudo rm /usr/local/etc/php/conf.d/ddtrace.ini
php -m | grep ddtrace || true
./hyperfine -s basic 'php -m' 'php -m -dextension=ddtrace.so' --min-runs 10000 --export-markdown hyperfine.md
- store_artifacts: { path: 'hyperfine.md', destination: /hyperfine.md }
framework_tests:
working_directory: ~/datadog
parameters:
framework_target:
type: string
default: all
executor:
name: with_agent
docker_image: circleci/php:7.3
steps:
- <<: *STEP_ATTACH_WORKSPACE
- setup_remote_docker
- run: make -f dockerfiles/frameworks/Makefile << parameters.framework_target >>
verify_package:
working_directory: ~/datadog
parameters:
docker_image:
type: string
package_type:
type: string
docker: [ image: << parameters.docker_image >> ]
steps:
- <<: *STEP_ATTACH_WORKSPACE
- run: sh dockerfiles/verify_packages/verify_<< parameters.package_type >>.sh
compile_extension:
working_directory: ~/datadog
parameters:
docker_image:
type: string
so_suffix:
type: string
default: unknown
catch_warnings:
type: boolean
default: true
lib_curl_command:
type: string
default: none
docker: [ image: << parameters.docker_image >> ]
environment:
CFLAGS: ""
steps:
- <<: *STEP_ATTACH_WORKSPACE
- run: mkdir -p extensions
- lib_curl_workaround:
command: << parameters.lib_curl_command >>
- run:
shell: /bin/bash -eo pipefail -l
name: Build extension basic .so
command: make all CFLAGS="-std=gnu11 -O2 -Wall -Wextra <<# parameters.catch_warnings >> -Werror <</ parameters.catch_warnings >>" ECHO_ARG="-e"
- run:
name: Copy extension basic .so
command: cp tmp/build_extension/.libs/ddtrace.so extensions/ddtrace-<< parameters.so_suffix >>.so
- run:
shell: /bin/bash -eo pipefail -l
name: Build extension debug .so
command: make clean all CFLAGS="-std=gnu11 -g -Wall -Wextra <<# parameters.catch_warnings >> -Werror <</ parameters.catch_warnings >>" ECHO_ARG="-e"
- run:
name: Copy extension basic .so
command: cp tmp/build_extension/.libs/ddtrace.so extensions/ddtrace-<< parameters.so_suffix >>-debug.so
- persist_to_workspace:
root: '.'
paths: ['./extensions']
"Prepare Code":
working_directory: ~/datadog
docker: [ image: 'circleci/php:7.3-cli' ]
steps:
- restore_cache:
keys:
- source-v1-{{ .Branch }}-{{ .Revision }}
- source-v1-{{ .Branch }}-
- source-v1-
- checkout
- save_cache:
key: source-v1-{{ .Branch }}-{{ .Revision }}
paths:
- ".git"
- <<: *STEP_ATTACH_WORKSPACE
- <<: *STEP_COMPOSER_INSTALL
- <<: *STEP_COMPOSER_COMPILE
- <<: *STEP_COMPOSER_COMPILE_VERIFY
- run:
name: Showing folder containing generated files
command: ls -al ~/datadog/bridge
- run:
name: Removing composer generated files
command: rm -rf ~/datadog/composer.lock ~/datadog/vendor
- persist_to_workspace:
root: '.'
paths: ['./']
"package extension":
working_directory: ~/datadog
docker: [ image: 'datadog/docker-library:ddtrace_php_fpm_packaging' ]
steps:
- <<: *STEP_ATTACH_WORKSPACE
- run:
name: Build packages
command: make packages
- store_artifacts: { path: 'build/packages', destination: / }
- store_artifacts: { path: 'packages.tar.gz', destination: '/all/packages.tar.gz' }
- persist_to_workspace:
root: '.'
paths: ['./build/packages', 'dockerfiles/verify_packages']
"package verification":
working_directory: ~/datadog
machine:
image: circleci/classic:latest
steps:
- <<: *STEP_ATTACH_WORKSPACE
- run: mkdir -p test-results
- run:
name: Test installing packages on target systems
command: make -f dockerfiles/verify_packages/Makefile docker_compose_pull all
- store_test_results:
path: test-results
placeholder:
docker:
- image: busybox
steps:
- run: echo "."
workflows:
version: 2
build_packages:
jobs:
- "Prepare Code":
filters:
tags:
only: /(^build$)|(^[v]?[0-9]+(\.[0-9]+)*$)/
branches:
# Always build on master and on release branches
only: /^.*(master|build|[0-9]+.[0-9]+.[0-9]+|ddtrace-[0-9]+.[0-9]+).*$/
- compile_extension:
name: "Compile PHP 54"
docker_image: "datadog/docker-library:ddtrace_centos_6_php_5_4"
catch_warnings: false
lib_curl_command: yum -y install libcurl-devel
so_suffix: "20100412"
requires: [ 'Prepare Code' ]
- compile_extension:
requires: [ 'Prepare Code' ]
name: "Compile PHP 56"
lib_curl_command: yum -y install libcurl-devel
docker_image: "datadog/docker-library:ddtrace_centos_6_php_5_6"
so_suffix: "20131106"
- compile_extension:
requires: [ 'Prepare Code' ]
name: "Compile PHP 70"
lib_curl_command: yum -y install libcurl-devel
docker_image: "datadog/docker-library:ddtrace_centos_6_php_7_0"
so_suffix: "20151012"
- compile_extension:
requires: [ 'Prepare Code' ]
name: "Compile PHP 71"
lib_curl_command: yum -y install libcurl-devel
docker_image: "datadog/docker-library:ddtrace_centos_6_php_7_1"
so_suffix: "20160303"
- compile_extension:
requires: [ 'Prepare Code' ]
name: "Compile PHP 72"
lib_curl_command: yum -y install libcurl-devel
docker_image: "datadog/docker-library:ddtrace_centos_6_php_7_2"
so_suffix: "20170718"
- compile_extension:
requires: [ 'Prepare Code' ]
name: "Compile PHP 73"
lib_curl_command: yum -y install libcurl-devel
docker_image: "datadog/docker-library:ddtrace_centos_7_php_73"
so_suffix: "20180731"
- compile_extension:
requires: [ 'Prepare Code' ]
name: "Compile PHP 74"
docker_image: "datadog/dd-trace-ci:php-7.4-centos-7"
so_suffix: "20190902"
- compile_extension:
requires: [ 'Prepare Code' ]
name: "Compile PHP 56-zts"
docker_image: "circleci/php:5.6-zts"
lib_curl_command: sudo apt update; sudo apt -y install libcurl4-nss-dev
so_suffix: "20131106-zts"
- compile_extension:
requires: [ 'Prepare Code' ]
name: "Compile PHP 70-zts"
docker_image: "circleci/php:7.0-zts"
lib_curl_command: sudo apt update; sudo apt -y install libcurl4-nss-dev
so_suffix: "20151012-zts"
- compile_extension:
requires: [ 'Prepare Code' ]
name: "Compile PHP 71-zts"
docker_image: "circleci/php:7.1-zts"
lib_curl_command: sudo apt update; sudo apt -y install libcurl4-nss-dev
so_suffix: "20160303-zts"
- compile_extension:
requires: [ 'Prepare Code' ]
name: "Compile PHP 72-zts"
docker_image: "circleci/php:7.2-zts"
lib_curl_command: sudo apt update; sudo apt -y install libcurl4-nss-dev
so_suffix: "20170718-zts"
- compile_extension:
requires: [ 'Prepare Code' ]
name: "Compile PHP 73-zts"
docker_image: "circleci/php:7.3-zts"
lib_curl_command: sudo apt update; sudo apt -y install libcurl4-nss-dev
so_suffix: "20180731-zts"
- compile_extension:
requires: [ 'Prepare Code' ]
name: "Compile PHP 74-zts"
docker_image: "circleci/php:7.4-zts"
lib_curl_command: sudo apt update; sudo apt -y install libcurl4-nss-dev
so_suffix: "20190902-zts"
- "package extension":
requires:
- "Compile PHP 54"
- "Compile PHP 56"
- "Compile PHP 70"
- "Compile PHP 71"
- "Compile PHP 72"
- "Compile PHP 73"
- "Compile PHP 74"
- "Compile PHP 56-zts"
- "Compile PHP 70-zts"
- "Compile PHP 71-zts"
- "Compile PHP 72-zts"
- "Compile PHP 73-zts"
- "Compile PHP 74-zts"
- "package verification":
requires:
- "package extension"
- placeholder:
requires: [ 'package extension' ]
name: Framework tests
- framework_tests:
requires: [ "Framework tests" ]
framework_target: flow
name: "Flow testsuite"
- framework_tests:
requires: [ "Framework tests" ]
framework_target: flow_no_ddtrace
name: "Flow baseline testsuite"
- framework_tests:
requires: [ "Framework tests" ]
framework_target: laravel
name: "Laravel testsuite"
- framework_tests:
requires: [ "Framework tests" ]
framework_target: laravel_no_ddtrace
name: "Laravel baseline testsuite"
# Symfony path needs to be updated as symfony/contracts 2.0 has been released and it changes
# test files where the patch is applied.
# - framework_tests:
# requires: [ "Framework tests" ]
# framework_target: symfony
# name: "Symfony testsuite"
# - framework_tests:
# requires: [ "Framework tests" ]
# framework_target: symfony_no_ddtrace
# name: "Symfony baseline testsuite"
- framework_tests:
requires: [ "Framework tests" ]
framework_target: wordpress
name: "WordPress testsuite"
- framework_tests:
requires: [ "Framework tests" ]
framework_target: wordpress_no_ddtrace
name: "WordPress baseline testsuite"
- verify_package:
requires: [ "package extension" ]
name: "webdevops/php:7.1"
docker_image: webdevops/php:7.1
package_type: deb
- verify_package:
requires: [ "package extension" ]
name: "php:7.3"
docker_image: php:7.3
package_type: deb
- integration_tests:
requires: [ 'Prepare Code' ]
name: "PHP 72 web tests with nginx + FastCGI"
resource_class: medium+
sapi: cgi-fcgi
integration_testsuite: "test-web-72"
docker_image: "datadog/dd-trace-ci:php-7.2-debug-buster"
- integration_tests:
requires: [ 'Prepare Code' ]
name: "PHP 73 web tests with nginx + FastCGI"
resource_class: medium+
sapi: cgi-fcgi
integration_testsuite: "test-web-73"
docker_image: "datadog/dd-trace-ci:php-7.3-debug-buster"
- integration_tests:
requires: [ 'Prepare Code' ]
name: "PHP 74 web tests with nginx + FastCGI"
resource_class: medium+
sapi: cgi-fcgi
integration_testsuite: "test-web-74"
docker_image: "datadog/dd-trace-ci:php-7.4-debug-buster"
build:
jobs:
- "Prepare Code"
- compile_extension:
requires: [ 'Prepare Code' ]
name: "PHP 55 Compilation test"
docker_image: "datadog/docker-library:ddtrace_alpine_php-5.5-debug"
lib_curl_command: sudo apk update ; sudo apk add curl-dev
- compile_extension:
requires: [ 'Prepare Code' ]
name: "PHP 56-zts Compilation test"
docker_image: "datadog/docker-library:ddtrace_alpine_php-5.6-zts"
lib_curl_command: sudo apk update ; sudo apk add curl-dev
- unit_tests:
requires: [ 'Prepare Code' ]
name: "PHP 54 Unit tests"
docker_image: "datadog/docker-library:ddtrace_alpine_php-5.4-debug"
lib_curl_command: sudo apk update ; sudo apk add curl-dev
- unit_tests:
requires: [ 'Prepare Code' ]
name: "PHP 56 Unit tests"
docker_image: "datadog/docker-library:ddtrace_alpine_php-5.6-debug"
lib_curl_command: sudo apk update ; sudo apk add curl-dev
- unit_tests:
requires: [ 'Prepare Code' ]
name: "PHP 70 Unit tests"
docker_image: "datadog/docker-library:ddtrace_alpine_php-7.0-debug"
lib_curl_command: sudo apk update ; sudo apk add curl-dev
- opcache_tests:
requires: [ 'Prepare Code' ]
name: "PHP 70 opcache tests"
docker_image: "datadog/dd-trace-ci:php-7.0-debug-buster"
- xdebug_tests:
requires: [ 'Prepare Code' ]
name: "PHP 70 Xdebug tests"
docker_image: "datadog/dd-trace-ci:php-7.0-debug-buster"
xdebug_version_one: "2.7.2"
- unit_tests:
requires: [ 'Prepare Code' ]
name: "PHP 71 Unit tests"
docker_image: "datadog/docker-library:ddtrace_alpine_php-7.1-debug"
lib_curl_command: sudo apk update ; sudo apk add curl-dev
- opcache_tests:
requires: [ 'Prepare Code' ]
name: "PHP 71 opcache tests"
docker_image: "datadog/dd-trace-ci:php-7.1-debug-buster"
- xdebug_tests:
requires: [ 'Prepare Code' ]
name: "PHP 71 Xdebug tests"
docker_image: "datadog/dd-trace-ci:php-7.1-debug-buster"
xdebug_version_one: "2.9.2"
xdebug_version_two: "2.9.5"
- unit_tests:
requires: [ 'Prepare Code' ]
name: "PHP 72 Unit tests"
docker_image: "datadog/docker-library:ddtrace_alpine_php-7.2-debug"
lib_curl_command: sudo apk update ; sudo apk add curl-dev
# - unit_tests: # disabled due to posisbly leaking tests
# requires: [ 'Prepare Code' ]
# name: "PHP 70 Unit tests-zts"
# docker_image: "datadog/docker-library:ddtrace_alpine_php-7.0-zts-debug"
- opcache_tests:
requires: [ 'Prepare Code' ]
name: "PHP 72 opcache tests"
docker_image: "datadog/dd-trace-ci:php-7.2-debug-buster"
- xdebug_tests:
requires: [ 'Prepare Code' ]
name: "PHP 72 Xdebug tests"
docker_image: "datadog/dd-trace-ci:php-7.2-debug-buster"
xdebug_version_one: "2.9.2"
xdebug_version_two: "2.9.5"
- unit_tests:
requires: [ 'Prepare Code' ]
name: "PHP 73 Unit tests"
docker_image: "datadog/docker-library:ddtrace_alpine_php-7.3-debug"
valgrind_config: 7_3_musl
lib_curl_command: sudo apk update ; sudo apk add curl-dev
- opcache_tests:
requires: [ 'Prepare Code' ]
name: "PHP 73 opcache tests"
docker_image: "datadog/dd-trace-ci:php-7.3-debug-buster"
- xdebug_tests:
requires: [ 'Prepare Code' ]
name: "PHP 73 Xdebug tests"
docker_image: "datadog/dd-trace-ci:php-7.3-debug-buster"
xdebug_version_one: "2.9.2"
xdebug_version_two: "2.9.5"
- unit_tests:
requires: [ 'Prepare Code' ]
name: "PHP 74 Unit tests"
docker_image: "datadog/dd-trace-ci:php-7.4-debug-alpine-3.11"
valgrind_config: 7_4_musl
- unit_tests:
requires: [ 'Prepare Code' ]
name: "PHP 74 asan tests"
docker_image: "datadog/dd-trace-ci:php-7.4-debug-asan-buster"
unit_test_target: test_c_asan
- opcache_tests:
requires: [ 'Prepare Code' ]
name: "PHP 74 opcache tests"
docker_image: "datadog/dd-trace-ci:php-7.4-debug-buster"
- xdebug_tests:
requires: [ 'Prepare Code' ]
name: "PHP 74 Xdebug tests"
docker_image: "datadog/dd-trace-ci:php-7.4-debug-buster"
xdebug_version_one: "2.9.2"
xdebug_version_two: "2.9.5"
- placeholder:
requires: [ 'Prepare Code' ]
name: Language tests
- php_language_tests:
requires: [ 'Language tests' ]
name: "PHP 74 language tests"
xfail_list: dockerfiles/ci/xfail_tests/7.4.list