Skip to content

Commit

Permalink
Merge pull request #156 from agoallikmaa/next-sync
Browse files Browse the repository at this point in the history
Sync to 0.84.0, add PHP 8.3 support
  • Loading branch information
agoallikmaa committed Feb 15, 2024
2 parents 096cc1e + 424d147 commit 84ff0d9
Show file tree
Hide file tree
Showing 2,967 changed files with 1,186,143 additions and 689 deletions.
312 changes: 284 additions & 28 deletions .circleci/config.yml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ tmp/build_extension/
composer.lock
**/core*
!tests/Frameworks/Drupal/Version_8_9/core
.DS_Store
.scenarios.lock/
.idea/
.vscode/
.libs
.deps
Expand Down
12 changes: 8 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
stages:
- build
- deploy
- benchmarks
- ci-build

variables:
LATEST_LIBRARY_x86_64_LINUX_GNU:
value: "https://github.com/DataDog/dd-trace-php/releases/download/0.81.0/dd-library-php-0.81.0-x86_64-linux-gnu.tar.gz"
value: "https://github.com/DataDog/dd-trace-php/releases/download/0.83.1/dd-library-php-0.83.1-x86_64-linux-gnu.tar.gz"
description: "Location where to download latest dd-library-php-*-x86_64-linux-gnu.tar.gz archive"
DOWNSTREAM_REL_BRANCH:
value: "master"
description: "Run a specific datadog-reliability-env branch downstream"
FORCE_TRIGGER:
value: "false"
description: "Set to true to override rules in the reliability-env pipeline (e.g. override 'only deploy master')"

include:
- remote: https://gitlab-templates.ddbuild.io/libdatadog/include/ci_authenticated_job.yml
- local: .gitlab/benchmarks.yml
- local: .gitlab/ci-images.yml

build:
stage: build
Expand Down
89 changes: 89 additions & 0 deletions .gitlab/ci-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
variables:
CI_REGISTRY_USER:
value: ""
description: "Your docker hub username"
CI_REGISTRY_TOKEN:
value: ""
description: "Your docker hub personal access token, can be created following this doc https://docs.docker.com/docker-hub/access-tokens/#create-an-access-token"
CI_REGISTRY:
value: "docker.io"

CentOS:
stage: ci-build
rules:
- when: manual
needs: []
tags: ["arch:amd64"]
timeout: 1h
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:24.0.4-gbi-focal
parallel:
matrix:
- PHP_VERSION:
- base
- php-8.3
- php-8.2
- php-8.1
- php-8.0
- php-7.4
- php-7.3
- php-7.2
- php-7.1
- php-7.0
script:
- cd dockerfiles/ci/centos/7
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_TOKEN" $CI_REGISTRY
- docker buildx bake --no-cache --pull --push $PHP_VERSION

Alpine Compile Extension:
stage: ci-build
rules:
- when: manual
needs: []
tags: ["arch:amd64"]
timeout: 1h
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:24.0.4-gbi-focal
parallel:
matrix:
- PHP_VERSION:
- 8.3-alpine
- 8.2-alpine
- 8.1-alpine
- 8.0-alpine
- 7.4-alpine
- 7.3-alpine
- 7.2-alpine
- 7.1-alpine
- 7.0-alpine
script:
- cd dockerfiles/ci/alpine_compile_extension
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_TOKEN" $CI_REGISTRY
- docker buildx bake --no-cache --pull --push $PHP_VERSION

Ubuntu Buster:
stage: ci-build
rules:
- when: manual
needs: []
tags: ["arch:amd64"]
timeout: 1h
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:24.0.4-gbi-focal
parallel:
matrix:
- PHP_VERSION:
- base
- php-8.3
- php-8.2
- php-8.1
- php-8.0
- php-8.0-shared-ext
- php-7.4
- php-7.4-shared-ext
- php-7.3
- php-7.2
- php-7.1
- php-7.0
- php-master
script:
- cd dockerfiles/ci/buster
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_TOKEN" $CI_REGISTRY
- docker buildx bake --no-cache --pull --push $PHP_VERSION
67 changes: 38 additions & 29 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ The easiest way to get the development environment set up is to install [Docker]

## Developing and testing locally

### PHP linting

The PHP tracer conforms to the [PSR-2 coding style guide](https://www.php-fig.org/psr/psr-2/). The code style is checked with [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) which can be invoked with the following command:

```bash
$ composer lint
```

To try to automatically fix the code style, you can run:

```bash
$ composer fix-lint
```

### Testing

#### Start your container

While tests in CI run on all php versions, you typically develop on one version locally. Currently the latest local
dev environment we support is `8.0`.

Expand All @@ -15,12 +33,6 @@ Ensure that docker has at least 4 GB of RAM available, otherwise composer may ru
Execute one the following commands from your command line, this will bring up all required services:

```bash
# For 5.4
$ docker-compose run --rm 5.4-buster bash
# For 5.5
$ docker-compose run --rm 5.5-buster bash
# For 5.6
$ docker-compose run --rm 5.6-buster bash
# For 7.0
$ docker-compose run --rm 7.0-buster bash
# For 7.1
Expand All @@ -33,14 +45,20 @@ $ docker-compose run --rm 7.3-buster bash
$ docker-compose run --rm 7.4-buster bash
# For 8.0
$ docker-compose run --rm 8.0-buster bash
# For 8.1
$ docker-compose run --rm 8.1-buster bash
# For 8.2
$ docker-compose run --rm 8.2-buster bash
```

> :memo: **Note:** To run the container in debug mode, pass `docker-compose` an environment variable: `DD_TRACE_DOCKER_DEBUG=1`, eg:
```bash
docker-compose run --rm 8.0-buster -e DD_TRACE_DOCKER_DEBUG=1 bash
docker-compose run --rm 8.2-buster -e DD_TRACE_DOCKER_DEBUG=1 bash
```

#### Set up the container

Once inside the container, update dependencies with Composer.

```bash
Expand All @@ -61,13 +79,7 @@ You can check that the extension was installed properly.
$ php --ri=ddtrace
```

When you're done with development, you can stop and remove the containers with the following:

```bash
$ docker-compose down -v
```

### Running the tests
#### Running the tests

First you need to update composer's dependecies in `./tests` folder:

Expand All @@ -82,45 +94,42 @@ Then you can run tests:
# Run all tests
$ make test_all

# Run unit tests
# Run unit tests (tests/Unit folder)
$ make test_unit

# Run integration tests
# Run integration tests (tests/Integration folder)
$ make test_integration

# Run auto-instrumentation tests
# Run auto-instrumentation tests (tests/AutoInstrumentation folder)
$ make test_auto_instrumentation

# Run composer integration tests
# Run composer integration tests (tests/Composer folder)
$ make test_composer

# Run distributed tracing tests
# Run distributed tracing tests (tests/DistributedTracing folder)
$ make test_distributed_tracing

# Run library integrations tests
# Run library integrations tests (tests/Integrations folder)
$ make test_integrations

# Run web frameworks integrations tests
$ make test_web

# Run C Tests (the ones in tests/ext)
$ make test_c

In order to run the `phpt` tests for the php extension:

```bash
$ composer test-ext
```

### PHP linting

The PHP tracer conforms to the [PSR-2 coding style guide](https://www.php-fig.org/psr/psr-2/). The code style is checked with [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) which can be invoked with the following command:
#### Treardown the environment

```bash
$ composer lint
```

To try to automatically fix the code style, you can run:
When you're done with development, you can stop and remove the containers with the following:

```bash
$ composer fix-lint
$ docker-compose down -v
```

## Sending a pull request (PR)
Expand Down
34 changes: 33 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ARCHITECTURE=$(shell uname -m)

VERSION := $(shell awk -F\' '/const VERSION/ {print $$2}' < src/DDTrace/Tracer.php)
PROFILING_RELEASE_URL := https://github.com/DataDog/dd-prof-php/releases/download/v0.7.2/datadog-profiling.tar.gz
APPSEC_RELEASE_URL := https://github.com/DataDog/dd-appsec-php/releases/download/v0.4.5/dd-appsec-php-0.4.5-amd64.tar.gz
APPSEC_RELEASE_URL := https://github.com/DataDog/dd-appsec-php/releases/download/v0.6.0/dd-appsec-php-0.6.0-amd64.tar.gz

INI_FILE := $(shell php -i | awk -F"=>" '/Scan this dir for additional .ini files/ {print $$2}')/ddtrace.ini

Expand Down Expand Up @@ -808,10 +808,38 @@ TEST_WEB_82 := \
test_web_slim_312 \
test_web_slim_4 \
test_web_symfony_52 \
test_web_symfony_62 \
test_web_wordpress_59 \
test_web_custom
# test_web_yii_2 \
TEST_INTEGRATIONS_83 := \
test_integrations_curl \
test_integrations_deferred_loading \
test_integrations_memcached \
test_integrations_mongodb1 \
test_integrations_mysqli \
test_integrations_pcntl \
test_integrations_pdo \
test_integrations_elasticsearch7 \
test_integrations_elasticsearch8 \
test_integrations_predis1 \
test_integrations_roadrunner \
test_opentracing_10

TEST_WEB_83 := \
test_metrics \
test_web_codeigniter_22 \
test_web_laravel_8x \
test_web_nette_24 \
test_web_nette_30 \
test_web_slim_312 \
test_web_slim_4 \
test_web_symfony_52 \
test_web_symfony_62 \
test_web_wordpress_59 \
test_web_custom

FILTER := .

define run_tests
Expand Down Expand Up @@ -1017,6 +1045,10 @@ test_web_symfony_52: global_test_run_dependencies
$(COMPOSER) --working-dir=tests/Frameworks/Symfony/Version_5_2 update
php tests/Frameworks/Symfony/Version_5_2/bin/console cache:clear --no-warmup --env=prod
$(call run_tests,--testsuite=symfony-52-test)
test_web_symfony_62: global_test_run_dependencies
$(COMPOSER) --working-dir=tests/Frameworks/Symfony/Version_6_2 update
php tests/Frameworks/Symfony/Version_6_2/bin/console cache:clear --no-warmup --env=prod
$(call run_tests,--testsuite=symfony-62-test)

test_web_wordpress_48: global_test_run_dependencies
$(call run_tests,tests/Integrations/WordPress/V4_8)
Expand Down
6 changes: 5 additions & 1 deletion config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ if test "$PHP_DDTRACE" != "no"; then
"
elif test $PHP_VERSION_ID -lt 90000; then
dnl PHP 8.x
EXTRA_PHP_SOURCES="ext/handlers_curl.c"
EXTRA_PHP_SOURCES="\
ext/handlers_curl.c \
ext/hook/uhook_attributes.c \
"
ZAI_RESOLVER_SUFFIX=""

if test $PHP_VERSION_ID -lt 80200; then
Expand Down Expand Up @@ -114,6 +117,7 @@ if test "$PHP_DDTRACE" != "no"; then
ext/handlers_internal.c \
ext/handlers_pcntl.c \
ext/integrations/integrations.c \
ext/ip_extraction.c \
ext/logging.c \
ext/memory_limit.c \
ext/limiter/limiter.c \
Expand Down
Loading

0 comments on commit 84ff0d9

Please sign in to comment.