ci: split valgrind extension tests and stop retrying real failures #11332
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Profiling correctness | |
| on: | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| permissions: | |
| contents: read | |
| jobs: | |
| prof-correctness: | |
| runs-on: ubuntu-24.04 | |
| env: | |
| LLVM_VERSION: "20" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: ['8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] | |
| phpts: [nts, zts] | |
| include: | |
| - phpts: zts | |
| extensions: parallel-krakjoe/parallel@v1.2.7 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 1 | |
| submodules: true | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| coverage: none | |
| extensions: ${{ matrix.extensions }} | |
| env: | |
| phpts: ${{ matrix.phpts }} | |
| fail-fast: true | |
| - name: Restore build cache | |
| uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-llvm-${{ env.LLVM_VERSION }}-${{ hashFiles('**/Cargo.lock', 'profiling/rust-toolchain.toml') }}-${{ matrix.php-version }}-${{ matrix.phpts }} | |
| - name: Build profiler | |
| run: | | |
| codename="$(lsb_release -cs)" | |
| curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg | |
| echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${LLVM_VERSION} main" | sudo tee /etc/apt/sources.list.d/llvm.list | |
| sudo apt-get update | |
| llvm18_packages="$(dpkg-query -W -f='${binary:Package}\n' \ | |
| '*clang*18*' '*llvm*18*' '*lld*18*' '*libomp*18*' \ | |
| '*libc++*18*' '*libc++abi*18*' '*mlir*18*' '*flang*18*' \ | |
| '*bolt*18*' '*polly*18*' 2>/dev/null || true)" | |
| if [ -n "$llvm18_packages" ]; then | |
| sudo apt-get purge -y $llvm18_packages | |
| sudo apt-get autoremove -y | |
| fi | |
| sudo apt-get install -y clang-${LLVM_VERSION} lld-${LLVM_VERSION} llvm-${LLVM_VERSION}-dev libclang-${LLVM_VERSION}-dev libclang-rt-${LLVM_VERSION}-dev | |
| sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100 | |
| sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100 | |
| sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-${LLVM_VERSION} 100 | |
| export CC=clang-${LLVM_VERSION} | |
| export CXX=clang++-${LLVM_VERSION} | |
| export LLVM_CONFIG_PATH=/usr/bin/llvm-config-${LLVM_VERSION} | |
| export LIBCLANG_PATH=/usr/lib/llvm-${LLVM_VERSION}/lib | |
| export LD_LIBRARY_PATH="${LIBCLANG_PATH}:${LD_LIBRARY_PATH:-}" | |
| clang --version | |
| ld.lld --version | |
| "$LLVM_CONFIG_PATH" --version | |
| cd profiling | |
| version_number=$(awk -F' = ' '$1 == "channel" { gsub(/"/, "", $2); print $2 }' rust-toolchain.toml) | |
| curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal -y --default-toolchain "$version_number" | |
| cargo rustc --features="trigger_time_sample" --profile profiler-release --crate-type=cdylib | |
| - name: Cache build dependencies | |
| uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-llvm-${{ env.LLVM_VERSION }}-${{ hashFiles('**/Cargo.lock', 'profiling/rust-toolchain.toml') }}-${{ matrix.php-version }}-${{ matrix.phpts }} | |
| - name: Run no profile test | |
| run: | | |
| export DD_PROFILING_ENABLED=Off | |
| export DD_PROFILING_EXPERIMENTAL_FEATURES_ENABLED=1 | |
| export DD_PROFILING_EXCEPTION_MESSAGE_ENABLED=1 | |
| php -v | |
| php -d extension=target/profiler-release/libdatadog_php_profiling.so --ri datadog-profiling | |
| for test_case in "allocations" "time" "strange_frames" "timeline" "exceptions" "io" "allocation_time_combined" "generators"; do | |
| mkdir -p profiling/tests/correctness/"$test_case"/ | |
| export DD_PROFILING_OUTPUT_PPROF=$PWD/profiling/tests/correctness/"$test_case"/test.pprof | |
| php -d extension="${PWD}/target/profiler-release/libdatadog_php_profiling.so" "profiling/tests/correctness/${test_case}.php" | |
| if compgen -G "$DD_PROFILING_OUTPUT_PPROF.*" > /dev/null; then | |
| echo "Profile output should not exist:" | |
| ls -l "$DD_PROFILING_OUTPUT_PPROF".* | |
| exit 1; | |
| fi | |
| done | |
| - name: Run tests | |
| run: | | |
| export DD_PROFILING_LOG_LEVEL=trace | |
| export DD_PROFILING_EXPERIMENTAL_FEATURES_ENABLED=1 | |
| export DD_PROFILING_EXPERIMENTAL_EXCEPTION_SAMPLING_DISTANCE=1 | |
| export DD_PROFILING_EXCEPTION_MESSAGE_ENABLED=1 | |
| php -v | |
| php -d extension=target/profiler-release/libdatadog_php_profiling.so --ri datadog-profiling | |
| for test_case in "allocations" "time" "strange_frames" "timeline" "exceptions" "io" "allocation_time_combined" "generators"; do | |
| mkdir -p profiling/tests/correctness/"$test_case"/ | |
| export DD_PROFILING_OUTPUT_PPROF=$PWD/profiling/tests/correctness/"$test_case"/test.pprof | |
| php -d extension=$PWD/target/profiler-release/libdatadog_php_profiling.so profiling/tests/correctness/"$test_case".php | |
| done | |
| mkdir -p profiling/tests/correctness/allocations_1byte/ | |
| export DD_PROFILING_OUTPUT_PPROF=$PWD/profiling/tests/correctness/allocations_1byte/test.pprof | |
| export DD_PROFILING_ALLOCATION_SAMPLING_DISTANCE=1 | |
| php -d extension=$PWD/target/profiler-release/libdatadog_php_profiling.so profiling/tests/correctness/allocations.php | |
| mkdir -p profiling/tests/correctness/allocations_1byte_no_zend_alloc/ | |
| export DD_PROFILING_OUTPUT_PPROF=$PWD/profiling/tests/correctness/allocations_1byte_no_zend_alloc/test.pprof | |
| export DD_PROFILING_ALLOCATION_SAMPLING_DISTANCE=1 | |
| USE_ZEND_ALLOC=0 php -d extension=$PWD/target/profiler-release/libdatadog_php_profiling.so profiling/tests/correctness/allocations.php | |
| unset DD_PROFILING_ALLOCATION_SAMPLING_DISTANCE | |
| - name: Run ZTS tests | |
| if: matrix.phpts == 'zts' | |
| run: | | |
| export DD_PROFILING_LOG_LEVEL=trace | |
| export DD_PROFILING_EXPERIMENTAL_FEATURES_ENABLED=1 | |
| export DD_PROFILING_EXPERIMENTAL_EXCEPTION_SAMPLING_DISTANCE=1 | |
| export DD_PROFILING_EXCEPTION_MESSAGE_ENABLED=1 | |
| php -v | |
| php -d extension=target/profiler-release/libdatadog_php_profiling.so --ri datadog-profiling | |
| for test_case in "exceptions_zts"; do | |
| mkdir -p profiling/tests/correctness/"$test_case"/ | |
| export DD_PROFILING_OUTPUT_PPROF=$PWD/profiling/tests/correctness/"$test_case"/test.pprof | |
| php -d extension=$PWD/target/profiler-release/libdatadog_php_profiling.so profiling/tests/correctness/"$test_case".php | |
| done | |
| - name: Check profiler correctness for allocations | |
| uses: Datadog/prof-correctness/analyze@main | |
| with: | |
| expected_json: profiling/tests/correctness/allocations.json | |
| pprof_path: profiling/tests/correctness/allocations/ | |
| - name: Check profiler correctness for allocations with 1 byte sampling distance | |
| uses: Datadog/prof-correctness/analyze@main | |
| with: | |
| expected_json: profiling/tests/correctness/allocations.json | |
| pprof_path: profiling/tests/correctness/allocations_1byte/ | |
| - name: Check profiler correctness for allocations with 1 byte sampling distance and `USE_ZEND_ALLOC=0` | |
| uses: Datadog/prof-correctness/analyze@main | |
| with: | |
| expected_json: profiling/tests/correctness/allocations.json | |
| pprof_path: profiling/tests/correctness/allocations_1byte_no_zend_alloc/ | |
| - name: Check profiler correctness for time | |
| uses: Datadog/prof-correctness/analyze@main | |
| with: | |
| expected_json: profiling/tests/correctness/time.json | |
| pprof_path: profiling/tests/correctness/time/ | |
| - name: Check profiler correctness for strange frames | |
| uses: Datadog/prof-correctness/analyze@main | |
| with: | |
| expected_json: profiling/tests/correctness/strange_frames.json | |
| pprof_path: profiling/tests/correctness/strange_frames/ | |
| - name: Check profiler correctness for timeline | |
| uses: Datadog/prof-correctness/analyze@main | |
| with: | |
| expected_json: profiling/tests/correctness/timeline.json | |
| pprof_path: profiling/tests/correctness/timeline/ | |
| - name: Check profiler correctness for allocation_time_combined | |
| uses: Datadog/prof-correctness/analyze@main | |
| with: | |
| expected_json: profiling/tests/correctness/allocation_time_combined.json | |
| pprof_path: profiling/tests/correctness/allocation_time_combined/ | |
| - name: Check profiler correctness for generators | |
| uses: Datadog/prof-correctness/analyze@main | |
| with: | |
| expected_json: profiling/tests/correctness/generators.json | |
| pprof_path: profiling/tests/correctness/generators/ | |
| - name: Check profiler correctness for IO | |
| uses: Datadog/prof-correctness/analyze@main | |
| with: | |
| expected_json: profiling/tests/correctness/io.json | |
| pprof_path: profiling/tests/correctness/io/ | |
| - name: Check profiler correctness for exceptions ZTS | |
| if: matrix.phpts == 'zts' | |
| uses: Datadog/prof-correctness/analyze@main | |
| with: | |
| expected_json: profiling/tests/correctness/exceptions_zts.json | |
| pprof_path: profiling/tests/correctness/exceptions_zts/ | |
| - name: Check profiler correctness for exceptions | |
| uses: Datadog/prof-correctness/analyze@main | |
| with: | |
| expected_json: profiling/tests/correctness/exceptions.json | |
| pprof_path: profiling/tests/correctness/exceptions/ | |
| - name: Notify Slack | |
| if: failure() && github.ref == 'refs/heads/master' | |
| run: | | |
| curl -X POST "${{ secrets.SLACK_WEBHOOK }}" \ | |
| -H 'Content-Type: application/json' \ | |
| -d "{'scenarios': 'PHP', 'failed_run_url': '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'}" |