From c4caddb5f48a31421368a6673681ea9af4bdc386 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Fri, 2 Aug 2024 15:16:26 +0200 Subject: [PATCH 01/19] migrate profiling tests to github actions --- .circleci/continue_config.yml | 249 +------------------------------ .github/workflows/prof_tests.yml | 106 +++++++++++++ 2 files changed, 114 insertions(+), 241 deletions(-) create mode 100644 .github/workflows/prof_tests.yml diff --git a/.circleci/continue_config.yml b/.circleci/continue_config.yml index 344da463e5..e3ef804b68 100644 --- a/.circleci/continue_config.yml +++ b/.circleci/continue_config.yml @@ -288,16 +288,16 @@ commands: shell: "<<# parameters.is_windows >>bash.exe<>" command: | git config --global gc.auto 0 - + export CIRCLE_REPOSITORY_URL="${CIRCLE_REPOSITORY_URL/git@github.com:/https://github.com/}" - + APP_DIR="$HOME/datadog" if [ -e "$APP_DIR/.git" ] ; then echo 'Fetching into existing repository' existing_repo='true' cd "$APP_DIR" git remote set-url origin "$CIRCLE_REPOSITORY_URL" || true - + echo 'Fetching from remote repository' retry_count=3 if [ -n "$CIRCLE_TAG" ]; then @@ -316,7 +316,7 @@ commands: cd "$APP_DIR" git clone --no-checkout "$CIRCLE_REPOSITORY_URL" . fi - + if [ -n "$CIRCLE_TAG" ]; then echo 'Checking out tag' git checkout --force "$CIRCLE_TAG" @@ -329,7 +329,7 @@ commands: git checkout --force -B "$CIRCLE_BRANCH" "$CIRCLE_SHA1" git --no-pager log --no-color -n 1 --format='HEAD is now at %h %s' fi - + echo 'Updating submodules' # we don't need appsec submodules on windows <<# parameters.is_windows >>git submodule update --init libdatadog<> @@ -407,7 +407,7 @@ commands: command: | set +x cd << parameters.directory >> - if [[ '<< parameters.job >>' != "${LAST_ARTIFACTS_JOB:-}" ]]; then + if [[ '<< parameters.job >>' != "${LAST_ARTIFACTS_JOB:-}" ]]; then job_id=$(curl -X GET "https://circleci.com/api/v2/workflow/$CIRCLE_WORKFLOW_ID/job" -H "Accept: application/json" | grep -Eo '\{[^}]*"<< parameters.job >>"[^}]*' | grep -Eo '"job_number":[^,]+' | tail -c +14) export LAST_ARTIFACTS_RESULT=$(curl -X GET "https://circleci.com/api/v2/project/github/DataDog/dd-trace-php/$job_id/artifacts" -H "Accept: application/json") export LAST_ARTIFACTS_JOB='<< parameters.job >>' @@ -3160,7 +3160,7 @@ jobs: - run: name: cargo fetch command: | - SUDO=$(! command -v sudo >/dev/null || echo "sudo") + SUDO=$(! command -v sudo >/dev/null || echo "sudo") # On occasion, we've observed the .package-cache being in the cache. # If it's there, it will cause commands to stall, waiting for the file to be released. if [ -e '/rust/cargo/.package-cache' ] ; then @@ -3170,7 +3170,7 @@ jobs: $SUDO mkdir /.cargo $SUDO chmod 777 /.cargo - + $SUDO cargo fetch -v --target << parameters.triplet >> $SUDO chmod -R 777 '/rust/cargo' @@ -3214,90 +3214,6 @@ jobs: paths: - datadog-profiling - "profiling tests": - working_directory: ~/datadog - parameters: - docker_image: - type: string - triplet: - type: string - resource_class: - type: string - default: large # mostly for more RAM for ramdisk - <<: *BARE_DOCKER_MACHINE - environment: - - CARGO_TARGET_DIR: /mnt/ramdisk/cargo - steps: - - restore_cache: - keys: - - source-v1-{{ .Branch }}-{{ .Revision }} - - git_checkout - - <<: *STEP_ATTACH_WORKSPACE - - setup_docker: - docker_image: << parameters.docker_image >> - ramdisk: true - - restore_cache: - name: Restore Cargo Package Cache - keys: - - cargo-cache-<< parameters.triplet >>-{{ checksum "Cargo.lock" }} - - run: - name: cargo tests - command: | - if [ -d '/opt/rh/devtoolset-7' ] ; then - set +eo pipefail - source scl_source enable devtoolset-7 - set -eo pipefail - fi - set -u - command -v switch-php && switch-php "${PHP_VERSION}" - cd profiling - cargo test --release --all-features - - run: - name: phpt tests NTS - command: | - set -u - command -v switch-php && switch-php "${PHP_VERSION}" - set -e - libdir="/tmp/datadog-profiling" - cd profiling - cargo build --release --all-features - cd tests - # don't anticipate there being more than one - run_tests_php=$(find $(php-config --prefix) -name run-tests.php) - cp -v "${run_tests_php}" . - export TEST_PHP_EXECUTABLE=$(which php) - php run-tests.php -d "extension=/mnt/ramdisk/cargo/release/libdatadog_php_profiling.so" --show-diff -g "FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP" "phpt" - - run: - name: phpt tests ZTS - command: | - set -u - command -v switch-php && switch-php "${PHP_VERSION}-zts" - set -e - libdir="/tmp/datadog-profiling" - cd profiling - touch build.rs #make sure `build.rs` gets executed after `switch-php` call - cargo build --release --all-features - cd tests - # don't anticipate there being more than one - run_tests_php=$(find $(php-config --prefix) -name run-tests.php) - cp -v "${run_tests_php}" . - export TEST_PHP_EXECUTABLE=$(which php) - php run-tests.php -d "extension=/mnt/ramdisk/cargo/release/libdatadog_php_profiling.so" --show-diff -g "FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP" "phpt" - - - run: - name: clippy NTS (for select platforms) - command: | - if [[ "x86_64-unknown-linux-gnu" != "<< parameters.triplet >>" ]] ; then - exit 0 - fi - set -u - command -v switch-php && switch-php "${PHP_VERSION}" - set -e - cd profiling - touch build.rs - sed -i -e "s/crate-type.*$/crate-type = [\"rlib\"]/g" Cargo.toml - cargo clippy --all-targets --all-features -- -D warnings -Aunknown-lints - "compile_loader": working_directory: ~/datadog parameters: @@ -5673,152 +5589,3 @@ workflows: resource_class: - medium - arm.medium - - profiling_tests: - when: << pipeline.parameters.profiling >> - jobs: - - "profiling tests": - name: "Profiler test PHP v7.1 - x86_64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-7.1" - triplet: "x86_64-alpine-linux-musl" - - "profiling tests": - name: "Profiler test PHP v7.1 - aarch64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-7.1" - triplet: "aarch64-alpine-linux-musl" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v7.2 - x86_64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-7.2" - triplet: "x86_64-alpine-linux-musl" - - "profiling tests": - name: "Profiler test PHP v7.2 - aarch64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-7.2" - triplet: "aarch64-alpine-linux-musl" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v7.3 - x86_64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-7.3" - triplet: "x86_64-alpine-linux-musl" - - "profiling tests": - name: "Profiler test PHP v7.3 - aarch64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-7.3" - triplet: "aarch64-alpine-linux-musl" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v7.4 - x86_64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-7.4" - triplet: "x86_64-alpine-linux-musl" - - "profiling tests": - name: "Profiler test PHP v7.4 - aarch64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-7.4" - triplet: "aarch64-alpine-linux-musl" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v8.0 - x86_64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-8.0" - triplet: "x86_64-alpine-linux-musl" - - "profiling tests": - name: "Profiler test PHP v8.0 - aarch64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-8.0" - triplet: "aarch64-alpine-linux-musl" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v8.1 - x86_64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-8.1" - triplet: "x86_64-alpine-linux-musl" - - "profiling tests": - name: "Profiler test PHP v8.1 - aarch64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-8.1" - triplet: "aarch64-alpine-linux-musl" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v8.2 - x86_64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-8.2" - triplet: "x86_64-alpine-linux-musl" - - "profiling tests": - name: "Profiler test PHP v8.2 - aarch64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-8.2" - triplet: "aarch64-alpine-linux-musl" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v8.3 - x86_64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-8.3" - triplet: "x86_64-alpine-linux-musl" - - "profiling tests": - name: "Profiler test PHP v8.3 - aarch64-alpine-linux-musl" - docker_image: "datadog/dd-trace-ci:php-compile-extension-alpine-8.3" - triplet: "aarch64-alpine-linux-musl" - resource_class: "arm.medium" - - - "profiling tests": - name: "Profiler test PHP v7.1 - x86_64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-7.1_centos-7" - triplet: "x86_64-unknown-linux-gnu" - - "profiling tests": - name: "Profiler test PHP v7.1 - aarch64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-7.1_centos-7" - triplet: "aarch64-unknown-linux-gnu" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v7.2 - x86_64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-7.2_centos-7" - triplet: "x86_64-unknown-linux-gnu" - - "profiling tests": - name: "Profiler test PHP v7.2 - aarch64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-7.2_centos-7" - triplet: "aarch64-unknown-linux-gnu" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v7.3 - x86_64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-7.3_centos-7" - triplet: "x86_64-unknown-linux-gnu" - - "profiling tests": - name: "Profiler test PHP v7.3 - aarch64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-7.3_centos-7" - triplet: "aarch64-unknown-linux-gnu" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v7.4 - x86_64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-7.4_centos-7" - triplet: "x86_64-unknown-linux-gnu" - - "profiling tests": - name: "Profiler test PHP v7.4 - aarch64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-7.4_centos-7" - triplet: "aarch64-unknown-linux-gnu" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v8.0 - x86_64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-8.0_centos-7" - triplet: "x86_64-unknown-linux-gnu" - - "profiling tests": - name: "Profiler test PHP v8.0 - aarch64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-8.0_centos-7" - triplet: "aarch64-unknown-linux-gnu" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v8.1 - x86_64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-8.1_centos-7" - triplet: "x86_64-unknown-linux-gnu" - - "profiling tests": - name: "Profiler test PHP v8.1 - aarch64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-8.1_centos-7" - triplet: "aarch64-unknown-linux-gnu" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v8.2 - x86_64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-8.2_centos-7" - triplet: "x86_64-unknown-linux-gnu" - - "profiling tests": - name: "Profiler test PHP v8.2 - aarch64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-8.2_centos-7" - triplet: "aarch64-unknown-linux-gnu" - resource_class: "arm.medium" - - "profiling tests": - name: "Profiler test PHP v8.3 - x86_64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-8.3_centos-7" - triplet: "x86_64-unknown-linux-gnu" - - "profiling tests": - name: "Profiler test PHP v8.3 - aarch64-unknown-linux-gnu" - docker_image: "datadog/dd-trace-ci:php-8.3_centos-7" - triplet: "aarch64-unknown-linux-gnu" - resource_class: "arm.medium" diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml new file mode 100644 index 0000000000..43b88d39e7 --- /dev/null +++ b/.github/workflows/prof_tests.yml @@ -0,0 +1,106 @@ +name: Profiling Tests + +on: + push: + branches: + - main + pull_request: + +jobs: + profiling-tests: + strategy: + matrix: + docker_image: + - "datadog/dd-trace-ci:php-compile-extension-alpine-7.1" + - "datadog/dd-trace-ci:php-compile-extension-alpine-7.2" + - "datadog/dd-trace-ci:php-compile-extension-alpine-7.3" + - "datadog/dd-trace-ci:php-compile-extension-alpine-7.4" + - "datadog/dd-trace-ci:php-compile-extension-alpine-8.0" + - "datadog/dd-trace-ci:php-compile-extension-alpine-8.1" + - "datadog/dd-trace-ci:php-compile-extension-alpine-8.2" + - "datadog/dd-trace-ci:php-compile-extension-alpine-8.3" + # - "datadog/dd-trace-ci:php-7.1_centos-7" + # - "datadog/dd-trace-ci:php-7.2_centos-7" + # - "datadog/dd-trace-ci:php-7.3_centos-7" + # - "datadog/dd-trace-ci:php-7.4_centos-7" + # - "datadog/dd-trace-ci:php-8.0_centos-7" + # - "datadog/dd-trace-ci:php-8.1_centos-7" + # - "datadog/dd-trace-ci:php-8.2_centos-7" + # - "datadog/dd-trace-ci:php-8.3_centos-7" + architecture: + - x86_64 + - aarch64 + # triplet: + # - "x86_64-alpine-linux-musl" + # - "aarch64-alpine-linux-musl" + # - "x86_64-unknown-linux-gnu" + # - "aarch64-unknown-linux-gnu" + runs-on: ${{ matrix.architecture == 'aarch64' && 'arm-8core-linux' || 'ubuntu-latest' }} + + container: + image: ${{ matrix.docker_image }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + # - name: Restore Cargo Package Cache + # id: cache + # uses: actions/cache@v2 + # with: + # path: target + # key: cargo-cache-${{ matrix.triplet }}-${{ hashFiles('Cargo.lock') }} + + - name: Run cargo tests + run: | + if [ -d '/opt/rh/devtoolset-7' ] ; then + set +eo pipefail + source scl_source enable devtoolset-7 + set -eo pipefail + fi + set -u + command -v switch-php && switch-php "${PHP_VERSION}" + cd profiling + cargo test --release --all-features + + - name: Run phpt tests NTS + run: | + set -u + command -v switch-php && switch-php "${PHP_VERSION}" + set -e + libdir="/tmp/datadog-profiling" + cd profiling + cargo build --release --all-features + cd tests + run_tests_php=$(find $(php-config --prefix) -name run-tests.php) + cp -v "${run_tests_php}" . + export TEST_PHP_EXECUTABLE=$(which php) + php run-tests.php -d "extension=../../target/release/libdatadog_php_profiling.so" --show-diff -g "FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP" "phpt" + + - name: Run phpt tests ZTS + run: | + set -u + command -v switch-php && switch-php "${PHP_VERSION}-zts" + set -e + libdir="/tmp/datadog-profiling" + cd profiling + touch build.rs + cargo build --release --all-features + cd tests + run_tests_php=$(find $(php-config --prefix) -name run-tests.php) + cp -v "${run_tests_php}" . + export TEST_PHP_EXECUTABLE=$(which php) + php run-tests.php -d "extension=../../target/release/libdatadog_php_profiling.so" --show-diff -g "FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP" "phpt" + + # - name: Run clippy NTS (for select platforms) + # if: matrix.triplet == 'x86_64-unknown-linux-gnu' + # run: | + # set -u + # command -v switch-php && switch-php "${PHP_VERSION}" + # set -e + # cd profiling + # touch build.rs + # sed -i -e "s/crate-type.*$/crate-type = [\"rlib\"]/g" Cargo.toml + # cargo clippy --all-targets --all-features -- -D warnings -Aunknown-lints From fba7bc79ba432e589a3b2fbaaa8a3751700b1b96 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Mon, 12 Aug 2024 12:03:37 +0200 Subject: [PATCH 02/19] stuff --- .github/workflows/prof_tests.yml | 16 ++++++++++------ .../ci/alpine_compile_extension/base.Dockerfile | 8 +++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index 43b88d39e7..17558c1684 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -46,12 +46,16 @@ jobs: with: submodules: true - # - name: Restore Cargo Package Cache - # id: cache - # uses: actions/cache@v2 - # with: - # path: target - # key: cargo-cache-${{ matrix.triplet }}-${{ hashFiles('Cargo.lock') }} + - name: Bake me into the image + run: | + apk add --no-cache tar + + - name: Restore Cargo Package Cache + id: cache + uses: actions/cache@v2 + with: + path: target + key: cargo-cache-${{ matrix.triplet }}-${{ hashFiles('Cargo.lock') }} - name: Run cargo tests run: | diff --git a/dockerfiles/ci/alpine_compile_extension/base.Dockerfile b/dockerfiles/ci/alpine_compile_extension/base.Dockerfile index d21404f3a4..e70853e019 100644 --- a/dockerfiles/ci/alpine_compile_extension/base.Dockerfile +++ b/dockerfiles/ci/alpine_compile_extension/base.Dockerfile @@ -21,15 +21,13 @@ RUN set -eux; \ libsodium-dev \ libxml2-dev \ gnu-libiconv-dev \ - oniguruma-dev + oniguruma-dev \ + tar # Profiling deps # Minimum: libclang. Nice-to-have: full toolchain including linker to play # with cross-language link-time optimization. Needs to match rustc -Vv's llvm # version. -RUN apk add --no-cache llvm16-libs clang16-dev lld llvm16 -RUN apk add --no-cache rust-stdlib -RUN apk add --no-cache cargo -RUN apk add --no-cache clang git protoc unzip +RUN apk add --no-cache llvm16-libs clang16-dev lld llvm16 rust-stdlib cargo clang git protoc unzip CMD ["bash"] From 5e07885ef805405c0ff20c7dffc8edad1fcfb281 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Sat, 12 Oct 2024 12:01:18 +0200 Subject: [PATCH 03/19] fix tests --- .github/workflows/prof_tests.yml | 42 +++++++++++++------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index 17558c1684..fc5d81a2a5 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -19,22 +19,17 @@ jobs: - "datadog/dd-trace-ci:php-compile-extension-alpine-8.1" - "datadog/dd-trace-ci:php-compile-extension-alpine-8.2" - "datadog/dd-trace-ci:php-compile-extension-alpine-8.3" - # - "datadog/dd-trace-ci:php-7.1_centos-7" - # - "datadog/dd-trace-ci:php-7.2_centos-7" - # - "datadog/dd-trace-ci:php-7.3_centos-7" - # - "datadog/dd-trace-ci:php-7.4_centos-7" - # - "datadog/dd-trace-ci:php-8.0_centos-7" - # - "datadog/dd-trace-ci:php-8.1_centos-7" - # - "datadog/dd-trace-ci:php-8.2_centos-7" - # - "datadog/dd-trace-ci:php-8.3_centos-7" + - "datadog/dd-trace-ci:php-7.1_buster" + - "datadog/dd-trace-ci:php-7.2_buster" + - "datadog/dd-trace-ci:php-7.3_buster" + - "datadog/dd-trace-ci:php-7.4_buster" + - "datadog/dd-trace-ci:php-8.0_buster" + - "datadog/dd-trace-ci:php-8.1_buster" + - "datadog/dd-trace-ci:php-8.2_buster" + - "datadog/dd-trace-ci:php-8.3_buster" architecture: - x86_64 - aarch64 - # triplet: - # - "x86_64-alpine-linux-musl" - # - "aarch64-alpine-linux-musl" - # - "x86_64-unknown-linux-gnu" - # - "aarch64-unknown-linux-gnu" runs-on: ${{ matrix.architecture == 'aarch64' && 'arm-8core-linux' || 'ubuntu-latest' }} container: @@ -55,7 +50,7 @@ jobs: uses: actions/cache@v2 with: path: target - key: cargo-cache-${{ matrix.triplet }}-${{ hashFiles('Cargo.lock') }} + key: cargo-cache-${{ matrix.docker_image }}-${{ hashFiles('Cargo.lock') }} - name: Run cargo tests run: | @@ -64,16 +59,15 @@ jobs: source scl_source enable devtoolset-7 set -eo pipefail fi - set -u - command -v switch-php && switch-php "${PHP_VERSION}" + set -eux + switch-php "${PHP_VERSION}" cd profiling cargo test --release --all-features - name: Run phpt tests NTS run: | - set -u - command -v switch-php && switch-php "${PHP_VERSION}" - set -e + set -eux + switch-php "${PHP_VERSION}" libdir="/tmp/datadog-profiling" cd profiling cargo build --release --all-features @@ -85,9 +79,8 @@ jobs: - name: Run phpt tests ZTS run: | - set -u - command -v switch-php && switch-php "${PHP_VERSION}-zts" - set -e + set -eux + switch-php "${PHP_VERSION}-zts" libdir="/tmp/datadog-profiling" cd profiling touch build.rs @@ -101,9 +94,8 @@ jobs: # - name: Run clippy NTS (for select platforms) # if: matrix.triplet == 'x86_64-unknown-linux-gnu' # run: | - # set -u - # command -v switch-php && switch-php "${PHP_VERSION}" - # set -e + # set -eux + # switch-php "${PHP_VERSION}" # cd profiling # touch build.rs # sed -i -e "s/crate-type.*$/crate-type = [\"rlib\"]/g" Cargo.toml From 7814f1a0ec11c29aa626ff9fd3e9af13d97c0139 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Sat, 12 Oct 2024 12:20:01 +0200 Subject: [PATCH 04/19] fix --- .github/workflows/prof_tests.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index fc5d81a2a5..f94778e9c1 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -6,6 +6,10 @@ on: - main pull_request: +defaults: + run: + shell: bash + jobs: profiling-tests: strategy: @@ -34,6 +38,7 @@ jobs: container: image: ${{ matrix.docker_image }} + options: --user root steps: - name: Checkout repository @@ -41,7 +46,8 @@ jobs: with: submodules: true - - name: Bake me into the image + - name: Bake me into the base image + if: contains(matrix.docker_image, 'alpine') run: | apk add --no-cache tar @@ -54,12 +60,10 @@ jobs: - name: Run cargo tests run: | - if [ -d '/opt/rh/devtoolset-7' ] ; then - set +eo pipefail - source scl_source enable devtoolset-7 - set -eo pipefail - fi set -eux + if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then + source /root/.bashrc + fi switch-php "${PHP_VERSION}" cd profiling cargo test --release --all-features @@ -67,6 +71,9 @@ jobs: - name: Run phpt tests NTS run: | set -eux + if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then + source /root/.bashrc + fi switch-php "${PHP_VERSION}" libdir="/tmp/datadog-profiling" cd profiling @@ -80,6 +87,9 @@ jobs: - name: Run phpt tests ZTS run: | set -eux + if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then + source /root/.bashrc + fi switch-php "${PHP_VERSION}-zts" libdir="/tmp/datadog-profiling" cd profiling From 36ad349117b8516b98590064b796a44f50cad3e2 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Tue, 22 Oct 2024 13:09:55 +0200 Subject: [PATCH 05/19] fix --- .github/workflows/prof_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index f94778e9c1..1f59888b4a 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -8,7 +8,7 @@ on: defaults: run: - shell: bash + shell: bash -ieo pipefail jobs: profiling-tests: @@ -62,7 +62,7 @@ jobs: run: | set -eux if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then - source /root/.bashrc + source -i /root/.bashrc fi switch-php "${PHP_VERSION}" cd profiling From 4fc5698c8c6868d6076c5dfa1468242a998690fc Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Tue, 22 Oct 2024 13:11:42 +0200 Subject: [PATCH 06/19] fix --- .github/workflows/prof_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index 1f59888b4a..93c7a94075 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -8,7 +8,7 @@ on: defaults: run: - shell: bash -ieo pipefail + shell: /bin/bash -ieo pipefail jobs: profiling-tests: From 338d7d0cfcd01cfa922f00db108b27268f1090b7 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Tue, 22 Oct 2024 13:13:29 +0200 Subject: [PATCH 07/19] fix --- .github/workflows/prof_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index 93c7a94075..70c502634c 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -8,7 +8,7 @@ on: defaults: run: - shell: /bin/bash -ieo pipefail + shell: /bin/bash -ieo pipefail {0} jobs: profiling-tests: From f9ef1390fc714725ae96e66efc5e7d1e27d758de Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Tue, 22 Oct 2024 13:20:07 +0200 Subject: [PATCH 08/19] test --- .github/workflows/prof_tests.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index 70c502634c..bd6def9cab 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -61,9 +61,6 @@ jobs: - name: Run cargo tests run: | set -eux - if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then - source -i /root/.bashrc - fi switch-php "${PHP_VERSION}" cd profiling cargo test --release --all-features @@ -71,9 +68,6 @@ jobs: - name: Run phpt tests NTS run: | set -eux - if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then - source /root/.bashrc - fi switch-php "${PHP_VERSION}" libdir="/tmp/datadog-profiling" cd profiling @@ -87,9 +81,6 @@ jobs: - name: Run phpt tests ZTS run: | set -eux - if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then - source /root/.bashrc - fi switch-php "${PHP_VERSION}-zts" libdir="/tmp/datadog-profiling" cd profiling From 1f21c0f84a76d6d33ee80a24b1dac200f66633d7 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Tue, 22 Oct 2024 13:55:41 +0200 Subject: [PATCH 09/19] test --- .github/workflows/prof_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index bd6def9cab..0331981599 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -8,7 +8,7 @@ on: defaults: run: - shell: /bin/bash -ieo pipefail {0} + shell: /bin/bash -leo pipefail {0} jobs: profiling-tests: From 1c6aae084c600c7dbd4bf54c91e3aebd379b6d40 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Tue, 22 Oct 2024 13:58:42 +0200 Subject: [PATCH 10/19] fix --- .github/workflows/prof_tests.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index 0331981599..4b3a4965a4 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -61,14 +61,22 @@ jobs: - name: Run cargo tests run: | set -eux - switch-php "${PHP_VERSION}" + if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then + switch_php "${PHP_VERSION}" + else + switch-php "${PHP_VERSION}" + fi cd profiling cargo test --release --all-features - name: Run phpt tests NTS run: | set -eux - switch-php "${PHP_VERSION}" + if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then + switch_php "${PHP_VERSION}" + else + switch-php "${PHP_VERSION}" + fi libdir="/tmp/datadog-profiling" cd profiling cargo build --release --all-features @@ -81,7 +89,11 @@ jobs: - name: Run phpt tests ZTS run: | set -eux - switch-php "${PHP_VERSION}-zts" + if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then + switch_php "${PHP_VERSION}" + else + switch-php "${PHP_VERSION}" + fi libdir="/tmp/datadog-profiling" cd profiling touch build.rs From 47b7c1c15bbfd703e50c52552cf877314d2b8d54 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Tue, 22 Oct 2024 14:02:07 +0200 Subject: [PATCH 11/19] fix --- .github/workflows/prof_tests.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index 4b3a4965a4..d60d958d89 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -61,11 +61,6 @@ jobs: - name: Run cargo tests run: | set -eux - if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then - switch_php "${PHP_VERSION}" - else - switch-php "${PHP_VERSION}" - fi cd profiling cargo test --release --all-features @@ -73,9 +68,9 @@ jobs: run: | set -eux if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then - switch_php "${PHP_VERSION}" + switch_php nts else - switch-php "${PHP_VERSION}" + switch-php nts fi libdir="/tmp/datadog-profiling" cd profiling @@ -90,9 +85,9 @@ jobs: run: | set -eux if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then - switch_php "${PHP_VERSION}" + switch_php zts else - switch-php "${PHP_VERSION}" + switch-php zts fi libdir="/tmp/datadog-profiling" cd profiling From d470d3d0d44fed739e40b151e511454a867ed293 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Tue, 22 Oct 2024 14:05:05 +0200 Subject: [PATCH 12/19] fix --- .github/workflows/prof_tests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index d60d958d89..01da58f29d 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -61,6 +61,11 @@ jobs: - name: Run cargo tests run: | set -eux + if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then + switch_php zts + else + switch-php zts + fi cd profiling cargo test --release --all-features From 784847ec5259cee1152014863a3f9a9c48d39cd2 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Tue, 22 Oct 2024 14:10:49 +0200 Subject: [PATCH 13/19] fix --- .github/workflows/prof_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index 01da58f29d..2f13d5a6a9 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -62,9 +62,9 @@ jobs: run: | set -eux if [[ "${{ contains(matrix.docker_image, 'alpine') }}" == "true" ]]; then - switch_php zts + switch_php nts else - switch-php zts + switch-php nts fi cd profiling cargo test --release --all-features From c9eee3ecb6be09d75b18e737213e050a51fe94aa Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Tue, 22 Oct 2024 14:34:10 +0200 Subject: [PATCH 14/19] fix --- .github/workflows/prof_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index 2f13d5a6a9..9a55c545c7 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -8,7 +8,7 @@ on: defaults: run: - shell: /bin/bash -leo pipefail {0} + shell: /bin/bash -eo pipefail {0} jobs: profiling-tests: From 8c2771d2d52354f7f927d9e30e6931df7ba0c0b7 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Tue, 22 Oct 2024 16:43:13 +0200 Subject: [PATCH 15/19] sdf --- .github/workflows/prof_tests.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index 9a55c545c7..eca5f85c81 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -41,16 +41,17 @@ jobs: options: --user root steps: + - name: Bypass GitHub Alpine detection + if: contains(matrix.docker_image, 'alpine') + run: | + apk add gcompat + sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release + - name: Checkout repository uses: actions/checkout@v4 with: submodules: true - - name: Bake me into the base image - if: contains(matrix.docker_image, 'alpine') - run: | - apk add --no-cache tar - - name: Restore Cargo Package Cache id: cache uses: actions/cache@v2 From 90c6ea7a4a1d03ba93d5f939760b9ef9bed8e98a Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Tue, 22 Oct 2024 16:48:43 +0200 Subject: [PATCH 16/19] bumpedy bump --- .github/workflows/prof_tests.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index eca5f85c81..99e033c8f2 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -41,11 +41,15 @@ jobs: options: --user root steps: - - name: Bypass GitHub Alpine detection + - name: Bypass GitHub Alpine detection and patch native node into runner env if: contains(matrix.docker_image, 'alpine') run: | - apk add gcompat + apk add nodejs sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release + cd /host/home/runner/runners/*/externals/ + rm -rf node20/* + mkdir node20/bin + ln -s /usr/bin/node node20/bin/node - name: Checkout repository uses: actions/checkout@v4 From ea07e7666a6481b79f8e82bc2fa23cd400a5fc2a Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Wed, 23 Oct 2024 10:20:01 +0200 Subject: [PATCH 17/19] test --- .github/workflows/prof_tests.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index 99e033c8f2..61e7675d0e 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -46,10 +46,6 @@ jobs: run: | apk add nodejs sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release - cd /host/home/runner/runners/*/externals/ - rm -rf node20/* - mkdir node20/bin - ln -s /usr/bin/node node20/bin/node - name: Checkout repository uses: actions/checkout@v4 From 1afaeec8f95b26879a71aedf37e8c9bd6e50d247 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Fri, 8 Nov 2024 14:44:41 +0100 Subject: [PATCH 18/19] fix alpine --- .github/workflows/prof_tests.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index 61e7675d0e..ada59aad0f 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -39,6 +39,8 @@ jobs: container: image: ${{ matrix.docker_image }} options: --user root + volumes: + - /:/host # Jailbreak! steps: - name: Bypass GitHub Alpine detection and patch native node into runner env @@ -46,6 +48,11 @@ jobs: run: | apk add nodejs sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release + cd /host/home/runner/runners/*/externals/ + rm -rf node20/* + mkdir node20/bin + ln -s /usr/bin/node node20/bin/node + shell: sh # No bash in Alpine by default - name: Checkout repository uses: actions/checkout@v4 From 6e0aa033f93479d0d8656b8e6f9c90a51e574d04 Mon Sep 17 00:00:00 2001 From: Florian Engelhardt Date: Fri, 8 Nov 2024 14:52:09 +0100 Subject: [PATCH 19/19] test --- .github/workflows/prof_tests.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prof_tests.yml b/.github/workflows/prof_tests.yml index ada59aad0f..5d87b8551b 100644 --- a/.github/workflows/prof_tests.yml +++ b/.github/workflows/prof_tests.yml @@ -43,15 +43,20 @@ jobs: - /:/host # Jailbreak! steps: - - name: Bypass GitHub Alpine detection and patch native node into runner env + - name: Patch native Alpine NodeJS into Runner environment if: contains(matrix.docker_image, 'alpine') run: | - apk add nodejs + set -eux + apk add docker nodejs sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release + cd /host/home/runner + ls -lah + cd /host/home/runner/runners + cd /host/home/runner/actions-runner + ls -lah + ls -lah /host/home/runner/actions-runner + ls -lah cd /host/home/runner/runners/*/externals/ - rm -rf node20/* - mkdir node20/bin - ln -s /usr/bin/node node20/bin/node shell: sh # No bash in Alpine by default - name: Checkout repository