-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/root_span_for_PHP_lifecycle_re…
…quest' into root_span_for_PHP_lifecycle_request
- Loading branch information
Showing
78 changed files
with
440 additions
and
119 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
|
||
# Runs the build based on the provided files in test.yml | ||
name: build | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
build_arch: | ||
required: false | ||
type: string | ||
default: 'x86_64' | ||
workflow_dispatch: | ||
inputs: | ||
build_arch: | ||
type: choice | ||
description: Build architecture | ||
default: 'x86_64' | ||
options: | ||
- all | ||
- x86_64 | ||
- arm64 | ||
|
||
jobs: | ||
setup-build-matrix: | ||
uses: ./.github/workflows/build-arch-matrix-generator.yml | ||
with: | ||
build_arch: ${{ inputs.build_arch }} | ||
|
||
test-phpt: | ||
name: test-phpt | ||
runs-on: ubuntu-latest | ||
needs: setup-build-matrix | ||
timeout-minutes: 300 | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJson(needs.setup-build-matrix.outputs.matrix-combinations) }} | ||
env: | ||
BUILD_ARCHITECTURE: ${{ matrix.arch }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: build-native-${{ matrix.arch }} | ||
path: prod/native/_build/${{ matrix.arch }}-release/ | ||
- if: ${{ matrix.run_qemu }} | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: arm64 | ||
- name: Run phpt tests | ||
run: | | ||
uname -a | ||
echo "Arch: ${BUILD_ARCHITECTURE}" | ||
pushd prod/native/extension/phpt | ||
mkdir ${PWD}/results | ||
PHP_VERSIONS=( 80 81 82 83 ) | ||
for PHP_VERSION in "${PHP_VERSIONS[@]}" | ||
do | ||
./run.sh -b ${BUILD_ARCHITECTURE} -p ${PHP_VERSION} -f ${PWD}/results/phpt-${PHP_VERSION}.tar.gz || TEST_ERROR=1 | ||
done | ||
popd | ||
if [ $TEST_ERROR -eq 1 ]; then | ||
echo "Some tests failed" | ||
exit 1 | ||
fi | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: test-phpt-failures-${{ matrix.arch }} | ||
path: | | ||
prod/native/extension/phpt/results/* | ||
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
add_subdirectory(code) |
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
tests/*.sh | ||
tests/*.diff | ||
tests/*.exp | ||
tests/*.log | ||
tests/*.php | ||
|
||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#!/bin/bash | ||
|
||
function show_help { | ||
|
||
echo -e "$0 -b build_architecture -p php_version [-t tests] | ||
Arguments description: | ||
-b build_architecture required, architecture of agent so library, f.ex. linux-x86-64 | ||
-p php_version PHP version f.ex. 80 or 83 | ||
-t tests Tests to run, folder or particular test file name. Default: tests | ||
-f path Generate test failures archive and save it in path | ||
-h print this help | ||
" | ||
} | ||
|
||
TESTS_TO_RUN=tests | ||
|
||
while getopts "b:p:t:f:h" opt; do | ||
case "$opt" in | ||
h|\?) | ||
show_help | ||
exit 0 | ||
;; | ||
b) BUILD_ARCHITECTURE="${OPTARG}" | ||
;; | ||
p) PHP_VERSION="${OPTARG}" | ||
;; | ||
t) TESTS_TO_RUN="${OPTARG}" | ||
;; | ||
f) TESTS_FAILURES_ARCHIVE="${OPTARG}" | ||
;; | ||
esac | ||
done | ||
|
||
if [ -z "${BUILD_ARCHITECTURE}" ] || [ -z "${PHP_VERSION}" ]; then | ||
show_help | ||
exit 1 | ||
fi | ||
|
||
ELASTIC_AGENT_SO_PATH=${PWD}/../../_build/${BUILD_ARCHITECTURE}-release/extension/code/elastic_otel_php_${PHP_VERSION}.so | ||
if [ ! -f ${ELASTIC_AGENT_SO_PATH} ]; then | ||
echo "Native build not found: '${ELASTIC_AGENT_SO_PATH}'" | ||
exit 1 | ||
fi | ||
|
||
if [[ ! "${BUILD_ARCHITECTURE}" =~ "musl" ]]; then | ||
echo "Running using glibc docker image"; | ||
else | ||
echo "Running using musl docker image"; | ||
ALPINE_IMAGE=-alpine | ||
fi | ||
|
||
ELASTIC_AGENT_PHP_PATH=${PWD}/../../../php | ||
|
||
|
||
LOCAL_TMP_DIR=$(mktemp -d) | ||
|
||
LOCAL_LOG_FAILED_TESTS=${LOCAL_TMP_DIR}/test-run-failures.log | ||
touch ${LOCAL_LOG_FAILED_TESTS} | ||
|
||
LOCAL_LOG_TEST_RUN=${LOCAL_TMP_DIR}/test-run.log | ||
touch ${LOCAL_LOG_TEST_RUN} | ||
|
||
LOG_FAILED_TESTS=/phpt-tests/test-run-failures.log | ||
LOG_TEST_RUN=/phpt-tests/test-run.log | ||
|
||
RUN_TESTS=/usr/local/lib/php/build/run-tests.php | ||
|
||
# copy test folder or test file into temp folder | ||
mkdir -p ${LOCAL_TMP_DIR}/$(dirname ${TESTS_TO_RUN}) | ||
cp -R ${TESTS_TO_RUN} ${LOCAL_TMP_DIR}/${TESTS_TO_RUN} | ||
|
||
docker run --rm \ | ||
-v ${LOCAL_TMP_DIR}/tests:/phpt-tests/tests \ | ||
-v ./tests_util:/phpt-tests/tests_util \ | ||
-v ${LOCAL_LOG_FAILED_TESTS}:${LOG_FAILED_TESTS} \ | ||
-v ${LOCAL_LOG_TEST_RUN}:${LOG_TEST_RUN} \ | ||
-v ${ELASTIC_AGENT_PHP_PATH}:/elastic/php \ | ||
-v ${ELASTIC_AGENT_SO_PATH}:/elastic/elastic_otel_php.so \ | ||
-w /phpt-tests \ | ||
php:${PHP_VERSION:0:1}.${PHP_VERSION:1:1}-cli${ALPINE_IMAGE} sh -c "php -n ${RUN_TESTS} -w ${LOG_FAILED_TESTS} ${TESTS_TO_RUN} 2>&1 | tee ${LOG_TEST_RUN}" | ||
|
||
if [ -s ${LOCAL_LOG_FAILED_TESTS} ]; then | ||
echo "Test failed" | ||
|
||
pushd ${LOCAL_TMP_DIR} | ||
tar -czf ${TESTS_FAILURES_ARCHIVE} . | ||
popd | ||
rm -rf ${LOCAL_TMP_DIR} | ||
|
||
exit 1 | ||
fi | ||
|
||
rm -rf ${LOCAL_TMP_DIR} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.