Skip to content

Commit

Permalink
migrate profiling tests to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
realFlowControl committed Aug 2, 2024
1 parent 6d15972 commit 82576f7
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 241 deletions.
249 changes: 8 additions & 241 deletions .circleci/continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,16 @@ commands:
shell: "<<# parameters.is_windows >>bash.exe<</ parameters.is_windows >>"
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
Expand All @@ -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"
Expand All @@ -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<</ parameters.is_windows >>
Expand Down Expand Up @@ -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 >>'
Expand Down Expand Up @@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Loading

0 comments on commit 82576f7

Please sign in to comment.