Skip to content

feat: Add tooling to generate stubs for the Public PHP API #2884

feat: Add tooling to generate stubs for the Public PHP API

feat: Add tooling to generate stubs for the Public PHP API #2884

Workflow file for this run

name: Profiling ASAN Tests
on:
pull_request:
jobs:
prof-asan:
runs-on: ubuntu-latest
container:
image: datadog/dd-trace-ci:php-8.3_bookworm-4
# https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user
options: --user root --privileged
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: Restore build cache
uses: actions/cache/restore@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-asan-${{ hashFiles('**/Cargo.lock') }}
- name: Build and install profiler
run: |
set -eux
switch-php nts-asan
cd profiling
export CARGO_TARGET_DIR=/tmp/build-cargo
export CC=clang-17
export CFLAGS='-fsanitize=address -fno-omit-frame-pointer'
export LDFLAGS='-fsanitize=address'
export RUSTC_LINKER=lld-17
triplet=$(uname -m)-unknown-linux-gnu
RUST_NIGHTLY_VERSION="-2024-02-27"
RUSTFLAGS='-Zsanitizer=address' cargo +nightly${RUST_NIGHTLY_VERSION} build -Zbuild-std --target $triplet --release
cp -v "$CARGO_TARGET_DIR/$triplet/release/libdatadog_php_profiling.so" "$(php-config --extension-dir)/datadog-profiling.so"
- name: Cache build dependencies
uses: actions/cache/save@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
/tmp/build-cargo/
key: ${{ runner.os }}-cargo-asan-${{ hashFiles('**/Cargo.lock') }}
- name: Fix kernel mmap rnd bits
# Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
# high-entropy ASLR in much newer kernels that GitHub runners are
# using leading to random crashes: https://reviews.llvm.org/D148280
# https://github.com/actions/runner-images/issues/9491#issuecomment-1989718917
run: sysctl vm.mmap_rnd_bits=28
- name: Run phpt tests
run: |
set -eux
switch-php nts-asan
cd profiling/tests
cp -v $(php-config --prefix)/lib/php/build/run-tests.php .
php run-tests.php --show-diff --asan -d extension=datadog-profiling.so phpt