From e5e998aba94a67e2dd5529d445d14bdbadd9c1cb Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 21 Feb 2023 14:28:55 -0800 Subject: [PATCH 01/72] require composer to load awscrt extension --- composer.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 72944466..fd528a7c 100644 --- a/composer.json +++ b/composer.json @@ -11,14 +11,15 @@ } ], "config": { - "platform": {"php": "5.6"} + "platform": {"php": "7.4"} }, "minimum-stability": "alpha", "require": { - "php": ">=5.5" + "php": ">=5.5", + "ext-awscrt": "*" }, "require-dev": { - "phpunit/phpunit":"^4.8.35|^5.6.3" + "phpunit/phpunit":"^5.6.3" }, "autoload": { "classmap": [ From 31a5785c2d436920c6301b70752fedf56cef4a7d Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 21 Feb 2023 18:53:50 -0800 Subject: [PATCH 02/72] load extension before run composer --- .github/workflows/ci.yml | 22 +++++++++++++--------- run_tests | 3 ++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b66da21e..180ebeb2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,12 +30,6 @@ jobs: with: submodules: recursive - - name: Install ancient PHPUnit - run: composer require --dev --ignore-platform-reqs phpunit/phpunit "4.8.36" - - - name: Install dependencies - run: composer update --no-interaction - - name: Build for PHP 5.5 env: CC: clang @@ -45,6 +39,13 @@ jobs: ./configure make + - name: Install dependencies + run: | + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + php composer-setup.php + php -c php.ini composer.phar require --dev --ignore-platform-reqs phpunit/phpunit "4.8.36" + php -c php.ini composer.phar update --no-interaction + php-linux-x64: runs-on: ubuntu-latest strategy: @@ -71,9 +72,6 @@ jobs: with: submodules: recursive - - name: Install dependencies - run: composer update --no-interaction - - name: Run tests env: CC: clang @@ -84,6 +82,12 @@ jobs: make make test + - name: Install dependencies + run: | + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + php composer-setup.php + php -c php.ini composer.phar update --no-interaction + # linux-arm: # name: ARM (${{ matrix.arch }}) diff --git a/run_tests b/run_tests index 18b449ae..cd199743 100755 --- a/run_tests +++ b/run_tests @@ -12,7 +12,8 @@ if [ -z $PHP_BINARY ]; then fi if [ ! -d vendor ]; then - composer update + COMPOSER_BINARY=$(which composer) + $PHP_BINARY -c php.ini $COMPOSER_BINARY update fi $launcher $PHP_BINARY -c php.ini vendor/bin/phpunit tests --debug From 82abc2d4da34a105b89b2aa8ec34785f77304b22 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 21 Feb 2023 19:01:11 -0800 Subject: [PATCH 03/72] make test after the composer nonsense --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 180ebeb2..9701cae2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,13 +80,13 @@ jobs: phpize ./configure make - make test - name: Install dependencies run: | php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php composer-setup.php php -c php.ini composer.phar update --no-interaction + make test # linux-arm: From 1a0efbfa4d3d7512f236b6fdadf8f1a96f928f17 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 21 Feb 2023 21:13:05 -0800 Subject: [PATCH 04/72] try to just use make test? --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9701cae2..c1a87e68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,15 +79,15 @@ jobs: run: | phpize ./configure - make - - - name: Install dependencies - run: | - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php composer-setup.php - php -c php.ini composer.phar update --no-interaction make test + # - name: Install dependencies + # run: | + # php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + # php composer-setup.php + # php -c php.ini composer.phar update --no-interaction + # make test + # linux-arm: # name: ARM (${{ matrix.arch }}) From 17b6a93ced6ad1c9b006a813823077e39f7f1d0b Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 21 Feb 2023 21:17:07 -0800 Subject: [PATCH 05/72] run test --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1a87e68..cc9595c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,7 +79,8 @@ jobs: run: | phpize ./configure - make test + make + ./run_tests # - name: Install dependencies # run: | From 9ff650e6d9bd0203a5240809fc957b8ac453d8ac Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 21 Feb 2023 21:30:06 -0800 Subject: [PATCH 06/72] clean up --- .github/workflows/ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc9595c6..bffb43bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,14 +82,6 @@ jobs: make ./run_tests - # - name: Install dependencies - # run: | - # php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - # php composer-setup.php - # php -c php.ini composer.phar update --no-interaction - # make test - - # linux-arm: # name: ARM (${{ matrix.arch }}) # runs-on: ubuntu-latest From 9de07efb766c0f153f45d39fd3f6b6fa17df33a6 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 11:42:34 -0800 Subject: [PATCH 07/72] restructure --- Makefile.frag | 10 ++-- ext/awscrt.stub.php => awscrt.stub.php | 0 builder.json | 2 +- composer.json | 2 +- dev-scripts/cleanup.sh | 48 +++++++++++++++++++ dev-scripts/genarate_pecl_package.sh | 7 +++ .../package.xml-template_post | 0 .../package.xml-template_pre | 0 .../prepare_package_xml.sh | 14 +++--- .../prepare_release.sh | 10 +++- run_tests => dev-scripts/run_tests | 0 run_tests.bat => dev-scripts/run_tests.bat | 0 ext/.gitignore | 1 + 13 files changed, 81 insertions(+), 13 deletions(-) rename ext/awscrt.stub.php => awscrt.stub.php (100%) create mode 100755 dev-scripts/cleanup.sh create mode 100644 dev-scripts/genarate_pecl_package.sh rename package.xml-template_post => dev-scripts/package.xml-template_post (100%) rename package.xml-template_pre => dev-scripts/package.xml-template_pre (100%) rename prepare_package_xml.sh => dev-scripts/prepare_package_xml.sh (91%) rename prepare_release.sh => dev-scripts/prepare_release.sh (73%) rename run_tests => dev-scripts/run_tests (100%) rename run_tests.bat => dev-scripts/run_tests.bat (100%) diff --git a/Makefile.frag b/Makefile.frag index 3eda4bc3..4e5a5e53 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -1,6 +1,6 @@ INT_DIR=build/install -GENERATE_STUBS=$(shell expr `php --version | head -1 | cut -f 2 -d' '` \>= 7.1) +GENERATE_STUBS=$(expr `php --version | head -1 | cut -f 2 -d' '` \>= 7.1) CMAKE = cmake3 ifeq (, $(shell which cmake3)) @@ -27,8 +27,8 @@ CMAKE_BUILD = CMAKE_BUILD_PARALLEL_LEVEL='' $(CMAKE) --build CMAKE_BUILD_TYPE ?= RelWithDebInfo CMAKE_TARGET = --config $(CMAKE_BUILD_TYPE) --target install -all: extension -.PHONY: all extension +all: extension +.PHONY: all extension # configure for static aws-crt-ffi.a build/aws-crt-ffi-static/CMakeCache.txt: @@ -46,8 +46,10 @@ ext/awscrt.lo: ext/awscrt.c ext/awscrt.c: build/aws-crt-ffi-static/libaws-crt-ffi.a ext/api.h ext/awscrt_arginfo.h -ext/awscrt_arginfo.h: ext/awscrt.stub.php gen_stub.php +ext/awscrt_arginfo.h: awscrt.stub.php gen_stub.php ifeq ($(GENERATE_STUBS),1) + # install awscrt.stub.php to ext/ + cp -v awscrt.stub.php ext/awscrt.stub.php # generate awscrt_arginfo.h php gen_stub.php --minimal-arginfo ext/awscrt.stub.php endif diff --git a/ext/awscrt.stub.php b/awscrt.stub.php similarity index 100% rename from ext/awscrt.stub.php rename to awscrt.stub.php diff --git a/builder.json b/builder.json index 2c6f0be8..14763d0c 100644 --- a/builder.json +++ b/builder.json @@ -32,6 +32,6 @@ "NO_INTERACTION": "1" }, "test_steps": [ - ["./run_tests"] + ["./dev-scripts/run_tests"] ] } diff --git a/composer.json b/composer.json index fd528a7c..d6318558 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ ] }, "scripts": { - "test": "./run_tests", + "test": "./dev-scripts/run_tests", "test-extension": "@test", "test-win": "run_tests" }, diff --git a/dev-scripts/cleanup.sh b/dev-scripts/cleanup.sh new file mode 100755 index 00000000..739381dc --- /dev/null +++ b/dev-scripts/cleanup.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +BASENAME=${0} +TOOLS_DIR=$(dirname ${BASENAME}) +WORK_DIR="${TOOLS_DIR}/.." + +cd "${WORK_DIR}" + +find . -name \*.tgz -a |xargs rm -rf + +## get rid of anything that phpize, configure and make as well +rm -rf .deps \ +.libs \ +Makefile \ +Makefile.fragments \ +Makefile.global \ +Makefile.objects \ +acinclude.m4 \ +aclocal.m4 \ +autom4te.cache \ +build \ +config.guess \ +config.h \ +config.h.in* \ +config.log \ +config.nice \ +config.status \ +config.sub \ +configure \ +configure.in \ +configure.ac \ +include \ +install-sh \ +libtool \ +ltmain.sh \ +missing \ +mkinstalldirs \ +modules \ +run-tests.php \ +awscrt.la \ +vendor \ +composer.lock \ +ext/awscrt.stub.php \ + +find . -name \*.lo -o -name \*.o | xargs rm -f +find . -name \*.la -o -name \*.a | xargs rm -f +find . -name \*.so | xargs rm -f +find . -name .libs -a -type d|xargs rm -rf \ No newline at end of file diff --git a/dev-scripts/genarate_pecl_package.sh b/dev-scripts/genarate_pecl_package.sh new file mode 100644 index 00000000..197a62d7 --- /dev/null +++ b/dev-scripts/genarate_pecl_package.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +BASENAME=${0} +TOOLS_DIR=$(dirname ${BASENAME}) +WORK_DIR="${TOOLS_DIR}/.." + +cd "${WORK_DIR}" \ No newline at end of file diff --git a/package.xml-template_post b/dev-scripts/package.xml-template_post similarity index 100% rename from package.xml-template_post rename to dev-scripts/package.xml-template_post diff --git a/package.xml-template_pre b/dev-scripts/package.xml-template_pre similarity index 100% rename from package.xml-template_pre rename to dev-scripts/package.xml-template_pre diff --git a/prepare_package_xml.sh b/dev-scripts/prepare_package_xml.sh similarity index 91% rename from prepare_package_xml.sh rename to dev-scripts/prepare_package_xml.sh index 9e775822..c8c4badf 100755 --- a/prepare_package_xml.sh +++ b/dev-scripts/prepare_package_xml.sh @@ -11,9 +11,12 @@ EMAIL="${opts[--email]}" VERSION="${opts[--version]}" NOTES="${opts[--notes]}" +BASENAME=${0} +TOOLS_DIR=$(dirname ${BASENAME}) + TODAY=$(date -u +%Y-%m-%d) -cat package.xml-template_pre \ +cat $TOOLS_DIR/package.xml-template_pre \ | sed "s/{{{NAME}}}/$NAME/g" \ | sed "s/{{{USER}}}/$USER/g" \ | sed "s/{{{EMAIL}}}/$EMAIL/g" \ @@ -24,14 +27,14 @@ cat package.xml-template_pre \ source_ext='(c|cc|h|cpp|hpp|m4|w32|ini|frag|cmake|inl|in|py|gnu|yaml|def|pl|S|s|errordata|go|lds|num|asm|mod|peg|mk|rs|toml|sh)' doc_ext='(md|json|html|dot|graphml|png|gn|sha1|css|rst|)' -special_docs='(LICENSE*|NOTICE|changelog.txt|CHANGELOG|THIRD-PARTY|README*|readme|METADATA|CONTRIBUTORS|UPDATING|doc.config)' +special_docs='(LICENSE*|NOTICE|changelog.txt|CHANGELOG|THIRD-PARTY|README*|readme|METADATA|CONTRIBUTORS|UPDATING|doc.config|THIRD-PARTY-LICENSES.txt)' special_tests='(ci-test.sh|format-check.sh|run_tests*|sanitizer-blacklist.txt|run-clang-tidy.sh|benchmark-build-run.sh|break-tests.sh|generate-coverage.sh|test.xml)' special_src='(gen_api.php|gen_stub.php|CMakeLists.txt|post.sh|postun.sh|Makefile*|build-buildspec.sh|build-deps.sh|objects.txt|go.*|BUILD*|DEPS|install_and_run.sh|codemod.sh|requirements.txt)' -skip_files='(package.xml*|prepare_release.sh|codereview.settings|*.o|*.a|*.obj|*.lib|break-tests-android.sh|whitespace.txt|prepare_package_xml.sh|crypto_test_data.cc|*.pdf|*.svg|*.docx|cbmc-proof.txt|codecov*|litani*|*.toml)' +skip_files='(package.xml*|prepare_release.sh|codereview.settings|*.o|*.a|*.obj|*.lib|break-tests-android.sh|whitespace.txt|prepare_package_xml.sh|crypto_test_data.cc|*.pdf|*.svg|*.docx|cbmc-proof.txt|codecov*|litani*|*.toml|module.modulemap)' special_scripts='(awscrt.stub.php)' -skip_directories='(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|verfication|third_party|docs|generated-src|aws-lc|aws-crt-sys)' +skip_directories='(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|verfication|third_party|docs|generated-src|aws-lc|aws-crt-sys|ecdsa-fuzz-corpus|bin|examples|compliance)' process_file() { if (( $# == 0 )) @@ -140,5 +143,4 @@ do done echo '' -cat package.xml-template_post - +cat $TOOLS_DIR/package.xml-template_post diff --git a/prepare_release.sh b/dev-scripts/prepare_release.sh similarity index 73% rename from prepare_release.sh rename to dev-scripts/prepare_release.sh index 3a9c5f47..fa58c237 100755 --- a/prepare_release.sh +++ b/dev-scripts/prepare_release.sh @@ -11,7 +11,15 @@ EMAIL="${opts[--email]}" VERSION="${opts[--version]}" NOTES="${opts[--notes]}" -./prepare_package_xml.sh --name "${NAME}" --user "${USER}" --email "${EMAIL}" --version "${VERSION}" --notes "${NOTES}" >package.xml + +BASENAME=${0} +TOOLS_DIR=$(dirname ${BASENAME}) +WORK_DIR="${TOOLS_DIR}/.." + +cd "${WORK_DIR}" + +$TOOLS_DIR/cleanup.sh +$TOOLS_DIR/prepare_package_xml.sh --name "${NAME}" --user "${USER}" --email "${EMAIL}" --version "${VERSION}" --notes "${NOTES}" >package.xml if [[ $? -ne 0 ]]; then echo "ERROR PROCESSING review package.xml" exit 1 diff --git a/run_tests b/dev-scripts/run_tests similarity index 100% rename from run_tests rename to dev-scripts/run_tests diff --git a/run_tests.bat b/dev-scripts/run_tests.bat similarity index 100% rename from run_tests.bat rename to dev-scripts/run_tests.bat diff --git a/ext/.gitignore b/ext/.gitignore index 2973c979..32801ef8 100644 --- a/ext/.gitignore +++ b/ext/.gitignore @@ -1,2 +1,3 @@ *.so api.h +awscrt.stub.php \ No newline at end of file From 826974ab252a06a117a13989d3d5666b07c3553c Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 11:47:44 -0800 Subject: [PATCH 08/72] change dir from run test --- composer.json | 2 +- dev-scripts/run_tests | 6 ++++++ dev-scripts/run_tests.bat | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d6318558..f7dbdd93 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "scripts": { "test": "./dev-scripts/run_tests", "test-extension": "@test", - "test-win": "run_tests" + "test-win": ".\\dev-scripts\\run_tests.bat" }, "license": "Apache-2.0" } diff --git a/dev-scripts/run_tests b/dev-scripts/run_tests index cd199743..848840cf 100755 --- a/dev-scripts/run_tests +++ b/dev-scripts/run_tests @@ -2,6 +2,12 @@ set -ex +BASENAME=${0} +TOOLS_DIR=$(dirname ${BASENAME}) +WORK_DIR="${TOOLS_DIR}/.." + +cd "${WORK_DIR}" + launcher= if command -v catchsegv; then launcher=catchsegv diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index d3e0886d..179589f0 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -1,4 +1,6 @@ @echo on +cd .. + %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug From f6314a23e9fdd9a4e17738e05751c707e7ee8da4 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 11:52:08 -0800 Subject: [PATCH 09/72] update the script path from ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bffb43bf..ab7fc7a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,7 +80,7 @@ jobs: phpize ./configure make - ./run_tests + ./dev-scripts/run_tests # linux-arm: # name: ARM (${{ matrix.arch }}) From 1f6f81412b58b1262dbe57103ee12333fe7a4a28 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 13:31:11 -0800 Subject: [PATCH 10/72] create release action when we cut a new release --- .github/workflows/release.yml | 31 ++++++++++++++++++++++++++++ dev-scripts/cleanup.sh | 2 +- dev-scripts/genarate_pecl_package.sh | 7 ------- dev-scripts/prepare_release.sh | 2 ++ 4 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 dev-scripts/genarate_pecl_package.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..ba7a1171 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: Release PECL Preparation + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + package: + name: Prepare package + runs-on: ubuntu-latest + + steps: + - name: Checkout Source + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + + - name: Get release tag + uses: awslabs/aws-crt-builder/.github/actions/release-tag@main + id: tag + + - name: Prepare Package Script + run: dev-scripts/prepare-release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${{ steps.tag.outputs.release_tag }} --notes NOTES + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: pecl_package_${{ steps.tag.outputs.release_tag }} + path: awscrt-${{ steps.tag.outputs.release_tag }}.tgz \ No newline at end of file diff --git a/dev-scripts/cleanup.sh b/dev-scripts/cleanup.sh index 739381dc..ad43122d 100755 --- a/dev-scripts/cleanup.sh +++ b/dev-scripts/cleanup.sh @@ -45,4 +45,4 @@ ext/awscrt.stub.php \ find . -name \*.lo -o -name \*.o | xargs rm -f find . -name \*.la -o -name \*.a | xargs rm -f find . -name \*.so | xargs rm -f -find . -name .libs -a -type d|xargs rm -rf \ No newline at end of file +find . -name .libs -a -type d|xargs rm -rf diff --git a/dev-scripts/genarate_pecl_package.sh b/dev-scripts/genarate_pecl_package.sh deleted file mode 100644 index 197a62d7..00000000 --- a/dev-scripts/genarate_pecl_package.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -BASENAME=${0} -TOOLS_DIR=$(dirname ${BASENAME}) -WORK_DIR="${TOOLS_DIR}/.." - -cd "${WORK_DIR}" \ No newline at end of file diff --git a/dev-scripts/prepare_release.sh b/dev-scripts/prepare_release.sh index fa58c237..0cf237dc 100755 --- a/dev-scripts/prepare_release.sh +++ b/dev-scripts/prepare_release.sh @@ -18,6 +18,8 @@ WORK_DIR="${TOOLS_DIR}/.." cd "${WORK_DIR}" +git submodule update --init --recursive + $TOOLS_DIR/cleanup.sh $TOOLS_DIR/prepare_package_xml.sh --name "${NAME}" --user "${USER}" --email "${EMAIL}" --version "${VERSION}" --notes "${NOTES}" >package.xml if [[ $? -ne 0 ]]; then From 9de1d33dd9926f88476530cfaedfb29f8e3e4c9e Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 14:01:30 -0800 Subject: [PATCH 11/72] more fix --- .clang-format-ignore | 1 - Makefile.frag | 8 ++------ Makefile.frag.w32 | 8 ++------ dev-scripts/prepare_package_xml.sh | 8 +++++++- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.clang-format-ignore b/.clang-format-ignore index 65c5a2b5..de02e700 100644 --- a/.clang-format-ignore +++ b/.clang-format-ignore @@ -1,4 +1,3 @@ # ignore generated files ext/api.h ext/*_arginfo.h -src/api.h diff --git a/Makefile.frag b/Makefile.frag index 4e5a5e53..bf479fbb 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -55,12 +55,8 @@ ifeq ($(GENERATE_STUBS),1) endif # transform/install api.h from FFI lib -src/api.h: crt/aws-crt-ffi/src/api.h - php gen_api.php crt/aws-crt-ffi/src/api.h > src/api.h - -# install api.h to ext/ as well -ext/api.h : src/api.h - cp -v src/api.h ext/api.h +ext/api.h : crt/aws-crt-ffi/src/api.h + php gen_api.php crt/aws-crt-ffi/src/api.h > ext/api.h ext/php_aws_crt.h: ext/awscrt_arginfo.h ext/api.h diff --git a/Makefile.frag.w32 b/Makefile.frag.w32 index 548ea4dc..9ba2450a 100644 --- a/Makefile.frag.w32 +++ b/Makefile.frag.w32 @@ -22,12 +22,8 @@ $(BUILD_DIR)\php_awscrt.dll: $(AWSCRT_DIR)\ext\awscrt.c $(AWSCRT_DIR)\ext\awscrt.c: $(AWSCRT_DIR)\build\libaws-crt-ffi.lib $(AWSCRT_DIR)\ext\api.h $(AWSCRT_DIR)\ext\awscrt_arginfo.h # transform\install api.h from FFI lib -$(AWSCRT_DIR)\src\api.h: $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h - php $(AWSCRT_DIR)\gen_api.php $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h > $(AWSCRT_DIR)\src\api.h - -# install api.h to ext/ as well -$(AWSCRT_DIR)\ext\api.h : $(AWSCRT_DIR)\src\api.h - copy $(AWSCRT_DIR)\src\api.h $(AWSCRT_DIR)\ext\api.h +$(AWSCRT_DIR)\ext\api.h: $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h + php $(AWSCRT_DIR)\gen_api.php $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h > $(AWSCRT_DIR)\ext\api.h # Use PHPUnit to run tests test-awscrt: install $(AWSCRT_DIR)\src\api.h $(BUILD_DIR)\php_awscrt.dll diff --git a/dev-scripts/prepare_package_xml.sh b/dev-scripts/prepare_package_xml.sh index c8c4badf..0395e353 100755 --- a/dev-scripts/prepare_package_xml.sh +++ b/dev-scripts/prepare_package_xml.sh @@ -30,7 +30,7 @@ doc_ext='(md|json|html|dot|graphml|png|gn|sha1|css|rst|)' special_docs='(LICENSE*|NOTICE|changelog.txt|CHANGELOG|THIRD-PARTY|README*|readme|METADATA|CONTRIBUTORS|UPDATING|doc.config|THIRD-PARTY-LICENSES.txt)' special_tests='(ci-test.sh|format-check.sh|run_tests*|sanitizer-blacklist.txt|run-clang-tidy.sh|benchmark-build-run.sh|break-tests.sh|generate-coverage.sh|test.xml)' special_src='(gen_api.php|gen_stub.php|CMakeLists.txt|post.sh|postun.sh|Makefile*|build-buildspec.sh|build-deps.sh|objects.txt|go.*|BUILD*|DEPS|install_and_run.sh|codemod.sh|requirements.txt)' -skip_files='(package.xml*|prepare_release.sh|codereview.settings|*.o|*.a|*.obj|*.lib|break-tests-android.sh|whitespace.txt|prepare_package_xml.sh|crypto_test_data.cc|*.pdf|*.svg|*.docx|cbmc-proof.txt|codecov*|litani*|*.toml|module.modulemap)' +skip_files='(package.xml*|prepare_release.sh|codereview.settings|*.o|*.a|*.obj|*.lib|break-tests-android.sh|whitespace.txt|prepare_package_xml.sh|crypto_test_data.cc|*.pdf|*.svg|*.docx|cbmc-proof.txt|codecov*|litani*|*.toml|module.modulemap|cleanup.sh)' special_scripts='(awscrt.stub.php)' @@ -136,6 +136,12 @@ do echo '' continue fi + # skip the src directory as it is not part of the native extension + if [[ ${a} == 'src' ]] + then + continue + fi + if [[ -f ${a} ]] then process_file "${a}" else process_dir "${a}" From f183523de482e1482174b38985cb2602c32bd3ad Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 14:13:37 -0800 Subject: [PATCH 12/72] make a github action to test pecl before release --- .github/workflows/ci.yml | 23 +++++++++++++++++++++++ .github/workflows/release.yml | 2 +- ext/.gitignore | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab7fc7a8..5c08d23e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -151,3 +151,26 @@ jobs: python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" chmod a+x builder ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream + + pecl-package-test: + runs-on: ubuntu-latest + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Run tests + env: + CC: clang + CXX: clang++ + run: | + dev-scripts/prepare_release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version 1.0.0 --notes NOTES + ls *.tgz + tar zxvf *.tgz + ls \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ba7a1171..4a7009a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: id: tag - name: Prepare Package Script - run: dev-scripts/prepare-release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${{ steps.tag.outputs.release_tag }} --notes NOTES + run: dev-scripts/prepare_release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${{ steps.tag.outputs.release_tag }} --notes NOTES - name: Upload artifacts uses: actions/upload-artifact@v3 diff --git a/ext/.gitignore b/ext/.gitignore index 32801ef8..1f0fc8df 100644 --- a/ext/.gitignore +++ b/ext/.gitignore @@ -1,3 +1,3 @@ *.so api.h -awscrt.stub.php \ No newline at end of file +awscrt.stub.php From 093cf4eb0d307a95fe4c335aecd983040c41f693 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 14:23:53 -0800 Subject: [PATCH 13/72] why not find --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c08d23e..fb937821 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -170,7 +170,8 @@ jobs: CC: clang CXX: clang++ run: | - dev-scripts/prepare_release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version 1.0.0 --notes NOTES + ls + ./dev-scripts/prepare_release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version 1.0.0 --notes NOTES ls *.tgz tar zxvf *.tgz ls \ No newline at end of file From b6a3a29872ba5d3182dfb6d65d67a89f188d83e9 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 14:31:26 -0800 Subject: [PATCH 14/72] use mac --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb937821..364fb9bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -153,7 +153,7 @@ jobs: ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream pecl-package-test: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -166,9 +166,6 @@ jobs: submodules: recursive - name: Run tests - env: - CC: clang - CXX: clang++ run: | ls ./dev-scripts/prepare_release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version 1.0.0 --notes NOTES From 08aa34b8c1e6e8a1d24f464824002885d4371957 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 14:42:07 -0800 Subject: [PATCH 15/72] skip verification --- dev-scripts/prepare_package_xml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-scripts/prepare_package_xml.sh b/dev-scripts/prepare_package_xml.sh index 0395e353..a86db2bf 100755 --- a/dev-scripts/prepare_package_xml.sh +++ b/dev-scripts/prepare_package_xml.sh @@ -34,7 +34,7 @@ skip_files='(package.xml*|prepare_release.sh|codereview.settings|*.o|*.a|*.obj|* special_scripts='(awscrt.stub.php)' -skip_directories='(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|verfication|third_party|docs|generated-src|aws-lc|aws-crt-sys|ecdsa-fuzz-corpus|bin|examples|compliance)' +skip_directories='(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|verfication|third_party|docs|generated-src|aws-lc|aws-crt-sys|ecdsa-fuzz-corpus|bin|examples|compliance|verification)' process_file() { if (( $# == 0 )) From 30155092b20f579ea2759198a9d6270622ba8b78 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 14:54:13 -0800 Subject: [PATCH 16/72] build and test as well --- .github/workflows/ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 364fb9bf..4d141660 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -167,8 +167,9 @@ jobs: - name: Run tests run: | - ls ./dev-scripts/prepare_release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version 1.0.0 --notes NOTES - ls *.tgz - tar zxvf *.tgz - ls \ No newline at end of file + tar -zxf *.tgz + cd awscrt-1.0.0 + python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" + chmod a+x builder + ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream From 279f5d25ed008a0eea35b21b60b8d1261daa2470 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 15:06:47 -0800 Subject: [PATCH 17/72] just make sure it builds --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d141660..005c02b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -170,6 +170,6 @@ jobs: ./dev-scripts/prepare_release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version 1.0.0 --notes NOTES tar -zxf *.tgz cd awscrt-1.0.0 - python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" - chmod a+x builder - ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream + phpize + ./configure + make \ No newline at end of file From a7e8407ff20d8c81a74069ae27197b90ba6d418c Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 15:08:17 -0800 Subject: [PATCH 18/72] use mac to release --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 005c02b3..a8ee648d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -172,4 +172,4 @@ jobs: cd awscrt-1.0.0 phpize ./configure - make \ No newline at end of file + make diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a7009a7..3513a170 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,9 +8,14 @@ on: jobs: package: name: Prepare package - runs-on: ubuntu-latest + runs-on: macos-latest steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + - name: Checkout Source uses: actions/checkout@v3 with: From 02a6591a0339a5706995de6d8f17d3fba2ce45c6 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 15:12:41 -0800 Subject: [PATCH 19/72] trivial --- .github/workflows/release.yml | 2 +- Makefile.frag | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3513a170..97174b28 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,4 +33,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: pecl_package_${{ steps.tag.outputs.release_tag }} - path: awscrt-${{ steps.tag.outputs.release_tag }}.tgz \ No newline at end of file + path: awscrt-${{ steps.tag.outputs.release_tag }}.tgz diff --git a/Makefile.frag b/Makefile.frag index bf479fbb..a1414a76 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -1,6 +1,6 @@ INT_DIR=build/install -GENERATE_STUBS=$(expr `php --version | head -1 | cut -f 2 -d' '` \>= 7.1) +GENERATE_STUBS=$(shell expr `php --version | head -1 | cut -f 2 -d' '` \>= 7.1) CMAKE = cmake3 ifeq (, $(shell which cmake3)) From 7d56d185e82880b00cffb57b73907a2bf8e51d4d Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 22 Feb 2023 15:15:39 -0800 Subject: [PATCH 20/72] oh, it was a typo.. --- dev-scripts/prepare_package_xml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-scripts/prepare_package_xml.sh b/dev-scripts/prepare_package_xml.sh index a86db2bf..29fcff89 100755 --- a/dev-scripts/prepare_package_xml.sh +++ b/dev-scripts/prepare_package_xml.sh @@ -34,7 +34,7 @@ skip_files='(package.xml*|prepare_release.sh|codereview.settings|*.o|*.a|*.obj|* special_scripts='(awscrt.stub.php)' -skip_directories='(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|verfication|third_party|docs|generated-src|aws-lc|aws-crt-sys|ecdsa-fuzz-corpus|bin|examples|compliance|verification)' +skip_directories='(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|third_party|docs|generated-src|aws-lc|aws-crt-sys|ecdsa-fuzz-corpus|bin|examples|compliance|verification)' process_file() { if (( $# == 0 )) From 26ab397cd5c16e1f2b6ed72b2af8cf9a35ab6949 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 14:54:30 -0800 Subject: [PATCH 21/72] windows CI --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++--------------- dev-scripts/run_tests.bat | 18 +++++++++++++++--- php-win.ini | 5 ++++- 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8ee648d..2d31cdaf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,21 +95,31 @@ jobs: # chmod a+x builder # ./builder build -p ${{ env.PACKAGE_NAME }} --target=linux-${{ matrix.arch }} --spec=downstream - # windows-vc16: - # runs-on: windows-latest - # strategy: - # matrix: - # arch: [x64] - # steps: - # - uses: ilammy/msvc-dev-cmd@v1 - # with: - # arch: ${{ matrix.arch }} - # uwp: false - # spectre: true - # - name: Build ${{ env.PACKAGE_NAME }} + consumers - # run: | - # python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" - # python builder.pyz build -p ${{ env.PACKAGE_NAME }} --spec=downstream + windows-vc16: + runs-on: windows-2019 + strategy: + matrix: + arch: [x64] + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - id: setup-php-sdk + uses: cmb69/setup-php-sdk@v0.6 + with: + version: '8.0' + arch: x64 + ts: ts + - uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} + toolset: ${{steps.setup-php-sdk.outputs.toolset}} + - name: Build ${{ env.PACKAGE_NAME }} + consumers + run: | + phpize + .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared + nmake + .\dev-scripts\run_tests # windows-vc14: # runs-on: windows-latest diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index 179589f0..0eed5c60 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -1,6 +1,18 @@ - @echo on +setlocal + +REM Run command to get composer_dir +set "composer_dir=" +for /f "usebackq delims=" %%i in (`where composer.phar`) do set "composer_dir=%%i" -cd .. +REM Check if composer_dir was found +if "%composer_dir%"=="" ( + echo No composer found. + exit /b 1 +) else ( + cd .. + php -c php-win.ini %composer_dir% update + php -c php-win.ini vendor/bin/phpunit tests --debug +) -%PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug +endlocal \ No newline at end of file diff --git a/php-win.ini b/php-win.ini index c6d7db8e..86938f2c 100644 --- a/php-win.ini +++ b/php-win.ini @@ -1,2 +1,5 @@ -extension=php_awscrt.dll +; only works on 64bit build +extension=x64\Release\php_awscrt.dll + extension=php_openssl.dll +extension=php_mbstring.dll From 8208b31f5d645e7aef45725d3d037d2eb5aa50e1 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 15:05:57 -0800 Subject: [PATCH 22/72] get the right directory --- dev-scripts/run_tests.bat | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index 0eed5c60..138926f6 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -1,4 +1,4 @@ -@echo on +@echo off setlocal REM Run command to get composer_dir @@ -11,6 +11,10 @@ if "%composer_dir%"=="" ( exit /b 1 ) else ( cd .. + set "script_dir=%~dp0" + set "work_dir=%script_dir%/.." + cd %work_dir% + php -c php-win.ini %composer_dir% update php -c php-win.ini vendor/bin/phpunit tests --debug ) From 311edc63700f08093929333ad2f9e661e0728003 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 15:17:19 -0800 Subject: [PATCH 23/72] why? --- dev-scripts/run_tests.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index 138926f6..7f21fee2 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -14,6 +14,7 @@ if "%composer_dir%"=="" ( set "script_dir=%~dp0" set "work_dir=%script_dir%/.." cd %work_dir% + ls php -c php-win.ini %composer_dir% update php -c php-win.ini vendor/bin/phpunit tests --debug From 2aae069734e0e6ed79ae5bb3407e965907dc250b Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 15:20:40 -0800 Subject: [PATCH 24/72] this? --- dev-scripts/run_tests.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index 7f21fee2..ae513953 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -10,10 +10,10 @@ if "%composer_dir%"=="" ( echo No composer found. exit /b 1 ) else ( - cd .. set "script_dir=%~dp0" set "work_dir=%script_dir%/.." cd %work_dir% + echo %work_dir% ls php -c php-win.ini %composer_dir% update From 8455b69763880a84f40d2f62265376f84ff1018f Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 15:45:05 -0800 Subject: [PATCH 25/72] why cannot find dll --- dev-scripts/run_tests.bat | 11 ++++++++++- php-win.ini | 6 +++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index ae513953..bf752c59 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -14,10 +14,19 @@ if "%composer_dir%"=="" ( set "work_dir=%script_dir%/.." cd %work_dir% echo %work_dir% - ls + ls x64\Release php -c php-win.ini %composer_dir% update + if %errorlevel% neq 0 ( + echo An error occurred while using composer to get dependence + exit /b %errorlevel% + ) + php -c php-win.ini vendor/bin/phpunit tests --debug + if %errorlevel% neq 0 ( + echo An error occurred while running unittests + exit /b %errorlevel% + ) ) endlocal \ No newline at end of file diff --git a/php-win.ini b/php-win.ini index 86938f2c..f7af29c6 100644 --- a/php-win.ini +++ b/php-win.ini @@ -1,5 +1,5 @@ ; only works on 64bit build -extension=x64\Release\php_awscrt.dll +extension=.\x64\Release\php_awscrt.dll -extension=php_openssl.dll -extension=php_mbstring.dll +; extension=php_openssl.dll +; extension=php_mbstring.dll From babc4bf33040eca5e94a16899571f28ab480e827 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 15:54:23 -0800 Subject: [PATCH 26/72] one more test --- .github/workflows/ci.yml | 1 + dev-scripts/run_tests.bat | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d31cdaf..47918b08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,6 +119,7 @@ jobs: phpize .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared nmake + nmake install .\dev-scripts\run_tests # windows-vc14: diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index bf752c59..b17fc041 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -14,7 +14,7 @@ if "%composer_dir%"=="" ( set "work_dir=%script_dir%/.." cd %work_dir% echo %work_dir% - ls x64\Release + ls x64\ php -c php-win.ini %composer_dir% update if %errorlevel% neq 0 ( From 3ad39d5f3a116885908eae5712e8ee143da33392 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 16:08:35 -0800 Subject: [PATCH 27/72] fine --- .github/workflows/ci.yml | 1 + php-win.ini | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47918b08..0579c33c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,6 +110,7 @@ jobs: version: '8.0' arch: x64 ts: ts + deps: openssl - uses: ilammy/msvc-dev-cmd@v1 with: arch: ${{ matrix.arch }} diff --git a/php-win.ini b/php-win.ini index f7af29c6..82a2508d 100644 --- a/php-win.ini +++ b/php-win.ini @@ -1,5 +1,5 @@ ; only works on 64bit build -extension=.\x64\Release\php_awscrt.dll +extension=.\x64\Release_TS\php_awscrt.dll ; extension=php_openssl.dll ; extension=php_mbstring.dll From 72c24d9ded547f13d39418392547051c1a5f73c9 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 16:24:35 -0800 Subject: [PATCH 28/72] generate php-win.ini --- .github/workflows/ci.yml | 2 +- Makefile.frag.w32 | 8 +++----- php-win.ini | 8 +++----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0579c33c..da0ae233 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,7 +120,7 @@ jobs: phpize .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared nmake - nmake install + nmake generate-php-ini .\dev-scripts\run_tests # windows-vc14: diff --git a/Makefile.frag.w32 b/Makefile.frag.w32 index 9ba2450a..14cd9415 100644 --- a/Makefile.frag.w32 +++ b/Makefile.frag.w32 @@ -1,6 +1,5 @@ CMAKE=cmake.exe -COMPOSER_PHAR=C:\ProgramData\ComposerSetup\bin\composer.phar PHP_BINARY=$(PHP_PREFIX)\php.exe CMAKE_CONFIGURE = $(CMAKE) -DCMAKE_INSTALL_PREFIX=$(AWSCRT_DIR)\build\install -DCMAKE_PREFIX_PATH=$(AWSCRT_DIR)\build\install -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) @@ -25,7 +24,6 @@ $(AWSCRT_DIR)\ext\awscrt.c: $(AWSCRT_DIR)\build\libaws-crt-ffi.lib $(AWSCRT_DIR) $(AWSCRT_DIR)\ext\api.h: $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h php $(AWSCRT_DIR)\gen_api.php $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h > $(AWSCRT_DIR)\ext\api.h -# Use PHPUnit to run tests -test-awscrt: install $(AWSCRT_DIR)\src\api.h $(BUILD_DIR)\php_awscrt.dll - $(PHP_BINARY) -c $(AWSCRT_DIR)\php-win.ini $(COMPOSER_PHAR) --working-dir=$(AWSCRT_DIR) update - $(PHP_BINARY) -c $(AWSCRT_DIR)\php-win.ini $(COMPOSER_PHAR) --working-dir=$(AWSCRT_DIR) run test-win +# Get the dll directory to load +generate-php-ini: + @echo extension=$(BUILD_DIR)\php_awscrt.dll > php-win.ini diff --git a/php-win.ini b/php-win.ini index 82a2508d..31d56211 100644 --- a/php-win.ini +++ b/php-win.ini @@ -1,5 +1,3 @@ -; only works on 64bit build -extension=.\x64\Release_TS\php_awscrt.dll - -; extension=php_openssl.dll -; extension=php_mbstring.dll +extension_dir="ext" +extension=php_openssl.dll +extension=php_mbstring.dll \ No newline at end of file From 7c12d40536ff43486031896a9e796f2edebce4f3 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 16:47:03 -0800 Subject: [PATCH 29/72] get the right php --- .github/workflows/ci.yml | 2 +- dev-scripts/run_tests.bat | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da0ae233..d2b8e882 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,7 +121,7 @@ jobs: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared nmake nmake generate-php-ini - .\dev-scripts\run_tests + .\dev-scripts\run_tests ${{steps.setup-php-sdk.outputs.prefix}}\php # windows-vc14: # runs-on: windows-latest diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index b17fc041..a712b36a 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -5,6 +5,13 @@ REM Run command to get composer_dir set "composer_dir=" for /f "usebackq delims=" %%i in (`where composer.phar`) do set "composer_dir=%%i" +set "PHP_BINARY=php" + +if not "%~1"=="" ( + set "PHP_BINARY=%~1" +) + + REM Check if composer_dir was found if "%composer_dir%"=="" ( echo No composer found. @@ -16,13 +23,13 @@ if "%composer_dir%"=="" ( echo %work_dir% ls x64\ - php -c php-win.ini %composer_dir% update + %PHP_BINARY% -c php-win.ini %composer_dir% update if %errorlevel% neq 0 ( echo An error occurred while using composer to get dependence exit /b %errorlevel% ) - php -c php-win.ini vendor/bin/phpunit tests --debug + %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug if %errorlevel% neq 0 ( echo An error occurred while running unittests exit /b %errorlevel% From a28388fe05129d62ddefbd3d53f1f1a2cd6832f0 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 16:54:00 -0800 Subject: [PATCH 30/72] give me echo --- dev-scripts/run_tests.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index a712b36a..8af0e041 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -1,4 +1,4 @@ -@echo off +@echo on setlocal REM Run command to get composer_dir From ce4a00c264d331c02db8edda80aacb66d82421c9 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 17:14:53 -0800 Subject: [PATCH 31/72] I don't know --- .github/workflows/ci.yml | 2 +- dev-scripts/run_tests.bat | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2b8e882..4ec9a0dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,7 +118,7 @@ jobs: - name: Build ${{ env.PACKAGE_NAME }} + consumers run: | phpize - .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared + .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --with-openssl nmake nmake generate-php-ini .\dev-scripts\run_tests ${{steps.setup-php-sdk.outputs.prefix}}\php diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index 8af0e041..baa20df1 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -23,17 +23,8 @@ if "%composer_dir%"=="" ( echo %work_dir% ls x64\ - %PHP_BINARY% -c php-win.ini %composer_dir% update - if %errorlevel% neq 0 ( - echo An error occurred while using composer to get dependence - exit /b %errorlevel% - ) - - %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug - if %errorlevel% neq 0 ( - echo An error occurred while running unittests - exit /b %errorlevel% - ) + call %PHP_BINARY% -c php-win.ini %composer_dir% update + call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug ) endlocal \ No newline at end of file From 8c66121b2f7d0488454814b51ae81847f286aec8 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 17:45:11 -0800 Subject: [PATCH 32/72] I don't know --- .github/workflows/ci.yml | 2 +- dev-scripts/run_tests.bat | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ec9a0dd..9fbeb6fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,7 +118,7 @@ jobs: - name: Build ${{ env.PACKAGE_NAME }} + consumers run: | phpize - .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --with-openssl + .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl nmake nmake generate-php-ini .\dev-scripts\run_tests ${{steps.setup-php-sdk.outputs.prefix}}\php diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index baa20df1..5611d2c6 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -16,15 +16,14 @@ REM Check if composer_dir was found if "%composer_dir%"=="" ( echo No composer found. exit /b 1 -) else ( - set "script_dir=%~dp0" - set "work_dir=%script_dir%/.." - cd %work_dir% - echo %work_dir% - ls x64\ - - call %PHP_BINARY% -c php-win.ini %composer_dir% update - call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug ) +set "script_dir=%~dp0" +set "work_dir=%script_dir%/.." +cd %work_dir% + +call %PHP_BINARY% -c php-win.ini %composer_dir% update +call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug + + endlocal \ No newline at end of file From e361f031402bbdebf5b0b2cfeba4861d21bd5c00 Mon Sep 17 00:00:00 2001 From: Dengke Tang <815825145@qq.com> Date: Thu, 23 Feb 2023 22:46:12 -0800 Subject: [PATCH 33/72] Windows ci fix (#86) --- .github/workflows/ci.yml | 40 ++++++++++++++++++++------------------- Makefile.frag.w32 | 2 ++ composer.json | 3 +-- dev-scripts/run_tests.bat | 1 - php-win.ini | 2 +- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9fbeb6fa..e67912e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,21 +82,24 @@ jobs: make ./dev-scripts/run_tests - # linux-arm: - # name: ARM (${{ matrix.arch }}) - # runs-on: ubuntu-latest - # strategy: - # matrix: - # arch: [armv6, armv7, arm64] - # steps: - # - name: Build ${{ env.PACKAGE_NAME }} - # run: | - # python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" - # chmod a+x builder - # ./builder build -p ${{ env.PACKAGE_NAME }} --target=linux-${{ matrix.arch }} --spec=downstream + # linux-arm: + # name: ARM (${{ matrix.arch }}) + # runs-on: ubuntu-latest + # strategy: + # matrix: + # arch: [armv6, armv7, arm64] + # steps: + # - name: Build ${{ env.PACKAGE_NAME }} + # run: | + # python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" + # chmod a+x builder + # ./builder build -p ${{ env.PACKAGE_NAME }} --target=linux-${{ matrix.arch }} --spec=downstream windows-vc16: runs-on: windows-2019 + defaults: + run: + shell: cmd # use CMD instead of powershell to catch error from bat script strategy: matrix: arch: [x64] @@ -115,13 +118,12 @@ jobs: with: arch: ${{ matrix.arch }} toolset: ${{steps.setup-php-sdk.outputs.toolset}} - - name: Build ${{ env.PACKAGE_NAME }} + consumers - run: | - phpize - .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl - nmake - nmake generate-php-ini - .\dev-scripts\run_tests ${{steps.setup-php-sdk.outputs.prefix}}\php + # CMD only execute one commend per run + - run: phpize + - run: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl + - run: nmake + - run: nmake generate-php-ini + - run: .\dev-scripts\run_tests ${{steps.setup-php-sdk.outputs.prefix}}\php # windows-vc14: # runs-on: windows-latest diff --git a/Makefile.frag.w32 b/Makefile.frag.w32 index 14cd9415..441abcde 100644 --- a/Makefile.frag.w32 +++ b/Makefile.frag.w32 @@ -27,3 +27,5 @@ $(AWSCRT_DIR)\ext\api.h: $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h # Get the dll directory to load generate-php-ini: @echo extension=$(BUILD_DIR)\php_awscrt.dll > php-win.ini + @echo extension=$(PHP_PREFIX)\ext\php_openssl.dll >> php-win.ini + @echo extension=$(PHP_PREFIX)\ext\php_mbstring.dll >> php-win.ini diff --git a/composer.json b/composer.json index f7dbdd93..6f1e6eeb 100644 --- a/composer.json +++ b/composer.json @@ -15,8 +15,7 @@ }, "minimum-stability": "alpha", "require": { - "php": ">=5.5", - "ext-awscrt": "*" + "php": ">=5.5" }, "require-dev": { "phpunit/phpunit":"^5.6.3" diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index 5611d2c6..e92f1cb9 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -11,7 +11,6 @@ if not "%~1"=="" ( set "PHP_BINARY=%~1" ) - REM Check if composer_dir was found if "%composer_dir%"=="" ( echo No composer found. diff --git a/php-win.ini b/php-win.ini index 31d56211..fb0f7041 100644 --- a/php-win.ini +++ b/php-win.ini @@ -1,3 +1,3 @@ -extension_dir="ext" +extension=php_awscrt.dll extension=php_openssl.dll extension=php_mbstring.dll \ No newline at end of file From b116a189ffb8de0837f7590595556c24de307f8b Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 27 Feb 2023 13:58:48 -0800 Subject: [PATCH 34/72] it should not be needed for the config platform --- composer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/composer.json b/composer.json index 6f1e6eeb..2c1639b0 100644 --- a/composer.json +++ b/composer.json @@ -10,9 +10,6 @@ "email": "aws-sdk-common-runtime@amazon.com" } ], - "config": { - "platform": {"php": "7.4"} - }, "minimum-stability": "alpha", "require": { "php": ">=5.5" From c0ab7116b071bbdf38ea2cfce5fb6eacb695dea4 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 27 Feb 2023 14:09:20 -0800 Subject: [PATCH 35/72] Revert "it should not be needed for the config platform" This reverts commit b116a189ffb8de0837f7590595556c24de307f8b. --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 2c1639b0..6f1e6eeb 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,9 @@ "email": "aws-sdk-common-runtime@amazon.com" } ], + "config": { + "platform": {"php": "7.4"} + }, "minimum-stability": "alpha", "require": { "php": ">=5.5" From c2f584a1eabcea1800cad0b65b6cd5d95d15bbf7 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 27 Feb 2023 15:21:49 -0800 Subject: [PATCH 36/72] remove release.yml and leave it as todo to follow up quick --- .github/workflows/release.yml | 36 ----------------------------------- 1 file changed, 36 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 97174b28..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Release PECL Preparation - -on: - release: - types: [published] - workflow_dispatch: - -jobs: - package: - name: Prepare package - runs-on: macos-latest - - steps: - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.0' - - - name: Checkout Source - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - - name: Get release tag - uses: awslabs/aws-crt-builder/.github/actions/release-tag@main - id: tag - - - name: Prepare Package Script - run: dev-scripts/prepare_release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${{ steps.tag.outputs.release_tag }} --notes NOTES - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: pecl_package_${{ steps.tag.outputs.release_tag }} - path: awscrt-${{ steps.tag.outputs.release_tag }}.tgz From ff20f95232a2f71dcd6fc877039c09f72d46b41b Mon Sep 17 00:00:00 2001 From: Dengke Tang <815825145@qq.com> Date: Mon, 27 Feb 2023 15:33:00 -0800 Subject: [PATCH 37/72] Rewrite script (#87) --- .github/workflows/ci.yml | 10 +- .gitignore | 5 +- builder.json | 2 +- dev-scripts/cleanup.sh | 48 -------- dev-scripts/cleanup_build.py | 59 +++++++++ dev-scripts/prepare_package_xml.sh | 152 ------------------------ dev-scripts/prepare_pecl_package_xml.py | 146 +++++++++++++++++++++++ dev-scripts/prepare_pecl_release.py | 58 +++++++++ dev-scripts/prepare_release.sh | 41 ------- dev-scripts/run_tests.bat | 27 +++-- dev-scripts/{run_tests => run_tests.sh} | 0 php-win.ini | 2 +- 12 files changed, 289 insertions(+), 261 deletions(-) delete mode 100755 dev-scripts/cleanup.sh create mode 100644 dev-scripts/cleanup_build.py delete mode 100755 dev-scripts/prepare_package_xml.sh create mode 100644 dev-scripts/prepare_pecl_package_xml.py create mode 100644 dev-scripts/prepare_pecl_release.py delete mode 100755 dev-scripts/prepare_release.sh rename dev-scripts/{run_tests => run_tests.sh} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e67912e9..4b6f9dd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,7 +80,7 @@ jobs: phpize ./configure make - ./dev-scripts/run_tests + ./dev-scripts/run_tests.sh # linux-arm: # name: ARM (${{ matrix.arch }}) @@ -123,7 +123,7 @@ jobs: - run: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl - run: nmake - run: nmake generate-php-ini - - run: .\dev-scripts\run_tests ${{steps.setup-php-sdk.outputs.prefix}}\php + - run: .\dev-scripts\run_tests.bat ${{steps.setup-php-sdk.outputs.prefix}}\php # windows-vc14: # runs-on: windows-latest @@ -167,7 +167,7 @@ jobs: ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream pecl-package-test: - runs-on: macos-latest + runs-on: ubuntu-latest steps: - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -179,9 +179,9 @@ jobs: with: submodules: recursive - - name: Run tests + - name: Test PECL package build run: | - ./dev-scripts/prepare_release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version 1.0.0 --notes NOTES + python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0 tar -zxf *.tgz cd awscrt-1.0.0 phpize diff --git a/.gitignore b/.gitignore index 7b7b8bf8..f7413f5e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ - # Created by https://www.toptal.com/developers/gitignore/api/autotools,cmake,phpstorm # Edit at https://www.toptal.com/developers/gitignore?templates=autotools,cmake,phpstorm @@ -182,6 +181,8 @@ fabric.properties build/ configure.in configure.ac +configure.bat +configure.js mkinstalldirs run-tests.php Makefile.global @@ -191,6 +192,7 @@ modules/ *.lo config.h config.nice +config.nice.bat *.la Makefile* !Makefile.am @@ -204,6 +206,7 @@ PHP-Parser*/ src/*.so src/*.dylib src/*.dll +/x64/ # ignoring output of package.xml as it needs to be generated from ./prepare_release.sh in each publishing package.xml diff --git a/builder.json b/builder.json index 14763d0c..ec45884b 100644 --- a/builder.json +++ b/builder.json @@ -32,6 +32,6 @@ "NO_INTERACTION": "1" }, "test_steps": [ - ["./dev-scripts/run_tests"] + ["./dev-scripts/run_tests.sh"] ] } diff --git a/dev-scripts/cleanup.sh b/dev-scripts/cleanup.sh deleted file mode 100755 index ad43122d..00000000 --- a/dev-scripts/cleanup.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -BASENAME=${0} -TOOLS_DIR=$(dirname ${BASENAME}) -WORK_DIR="${TOOLS_DIR}/.." - -cd "${WORK_DIR}" - -find . -name \*.tgz -a |xargs rm -rf - -## get rid of anything that phpize, configure and make as well -rm -rf .deps \ -.libs \ -Makefile \ -Makefile.fragments \ -Makefile.global \ -Makefile.objects \ -acinclude.m4 \ -aclocal.m4 \ -autom4te.cache \ -build \ -config.guess \ -config.h \ -config.h.in* \ -config.log \ -config.nice \ -config.status \ -config.sub \ -configure \ -configure.in \ -configure.ac \ -include \ -install-sh \ -libtool \ -ltmain.sh \ -missing \ -mkinstalldirs \ -modules \ -run-tests.php \ -awscrt.la \ -vendor \ -composer.lock \ -ext/awscrt.stub.php \ - -find . -name \*.lo -o -name \*.o | xargs rm -f -find . -name \*.la -o -name \*.a | xargs rm -f -find . -name \*.so | xargs rm -f -find . -name .libs -a -type d|xargs rm -rf diff --git a/dev-scripts/cleanup_build.py b/dev-scripts/cleanup_build.py new file mode 100644 index 00000000..6df535c9 --- /dev/null +++ b/dev-scripts/cleanup_build.py @@ -0,0 +1,59 @@ +import os +import glob +import shutil + +TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) +WORK_DIR = os.path.join(TOOLS_DIR, '..') + +# Remove specified directories +DIRS_TO_REMOVE = [ + '.deps', + '.libs', + 'build', + 'include', + 'modules', + 'vendor', + 'autom4te.cache'] + +# Remove specified files +FILES_TO_REMOVE = [ + 'Makefile', + 'Makefile.fragments', + 'Makefile.global', + 'Makefile.objects', + 'config.guess', + 'config.h', + 'config.h.in', + 'config.log', + 'config.nice', + 'config.status', + 'config.sub', + 'configure', + 'configure.in', + 'configure.ac', + 'install-sh', + 'libtool', + 'ltmain.sh', + 'missing', + 'mkinstalldirs', + 'run-tests.php', + 'awscrt.la', + 'composer.lock', + 'ext/awscrt.stub.php', + 'acinclude.m4', + 'aclocal.m4', + '**/*.lo', + '**/*.o', + '**/*.la', + '**/*.a', + '*.tgz'] + +os.chdir(WORK_DIR) + + +for directory in DIRS_TO_REMOVE: + shutil.rmtree(directory, ignore_errors=True) + +for pattern in FILES_TO_REMOVE: + for filepath in glob.glob(pattern): + os.remove(filepath) diff --git a/dev-scripts/prepare_package_xml.sh b/dev-scripts/prepare_package_xml.sh deleted file mode 100755 index 29fcff89..00000000 --- a/dev-scripts/prepare_package_xml.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/zsh -zparseopts -A opts -name: -user: -email: -version: -notes: -if [[ $# -lt 10 ]] -then - echo "Usage ${0} --name NAME, --user USER --email EMAIL --version VERSION --notes NOTES" - exit 1 -fi -NAME="${opts[--name]}" -USER="${opts[--user]}" -EMAIL="${opts[--email]}" -VERSION="${opts[--version]}" -NOTES="${opts[--notes]}" - -BASENAME=${0} -TOOLS_DIR=$(dirname ${BASENAME}) - -TODAY=$(date -u +%Y-%m-%d) - -cat $TOOLS_DIR/package.xml-template_pre \ - | sed "s/{{{NAME}}}/$NAME/g" \ - | sed "s/{{{USER}}}/$USER/g" \ - | sed "s/{{{EMAIL}}}/$EMAIL/g" \ - | sed "s/{{{TODAY}}}/$TODAY/g" \ - | sed "s/{{{VERSION}}}/$VERSION/g" \ - | sed "s/{{{NOTES}}}/$NOTES/g" - -source_ext='(c|cc|h|cpp|hpp|m4|w32|ini|frag|cmake|inl|in|py|gnu|yaml|def|pl|S|s|errordata|go|lds|num|asm|mod|peg|mk|rs|toml|sh)' -doc_ext='(md|json|html|dot|graphml|png|gn|sha1|css|rst|)' - -special_docs='(LICENSE*|NOTICE|changelog.txt|CHANGELOG|THIRD-PARTY|README*|readme|METADATA|CONTRIBUTORS|UPDATING|doc.config|THIRD-PARTY-LICENSES.txt)' -special_tests='(ci-test.sh|format-check.sh|run_tests*|sanitizer-blacklist.txt|run-clang-tidy.sh|benchmark-build-run.sh|break-tests.sh|generate-coverage.sh|test.xml)' -special_src='(gen_api.php|gen_stub.php|CMakeLists.txt|post.sh|postun.sh|Makefile*|build-buildspec.sh|build-deps.sh|objects.txt|go.*|BUILD*|DEPS|install_and_run.sh|codemod.sh|requirements.txt)' -skip_files='(package.xml*|prepare_release.sh|codereview.settings|*.o|*.a|*.obj|*.lib|break-tests-android.sh|whitespace.txt|prepare_package_xml.sh|crypto_test_data.cc|*.pdf|*.svg|*.docx|cbmc-proof.txt|codecov*|litani*|*.toml|module.modulemap|cleanup.sh)' - -special_scripts='(awscrt.stub.php)' - -skip_directories='(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|third_party|docs|generated-src|aws-lc|aws-crt-sys|ecdsa-fuzz-corpus|bin|examples|compliance|verification)' - -process_file() { - if (( $# == 0 )) - then - echo "ERROR: filename not passed" - exit 1 - fi - if [[ $1 = $~skip_files ]] - then - # This file is not part of the release bundle - return 0 - fi - - echo -n '' - return 0 -} - - -process_dir() { - if (( $# == 0 )) - then - echo "WARNING: dirname not passed" - exit 1 - fi - if [[ "${1}" = $~skip_directories ]] - then - return 0 - fi - echo '' - cd "$1" - for a in * - do - if [[ -f ${a} ]] - then process_file "${a}" - else process_dir "${a}" - fi - done - # Special cases for compiler features placed in tests directories in and s2n - if [[ "${1}" = "s2n" && -d tests ]] - then - echo '' - echo '' - cd tests/features - for a in * - do - process_file "${a}" - done - cd ../.. - echo '' - echo '' - fi - echo '' - cd .. - return 0 -} - -echo '' -for a in * -do - if [[ ${a} == 'tests' ]] - then - echo '' - for b in tests/* - do - echo '' - done - echo '' - continue - fi - # skip the src directory as it is not part of the native extension - if [[ ${a} == 'src' ]] - then - continue - fi - - if [[ -f ${a} ]] - then process_file "${a}" - else process_dir "${a}" - fi -done -echo '' - -cat $TOOLS_DIR/package.xml-template_post diff --git a/dev-scripts/prepare_pecl_package_xml.py b/dev-scripts/prepare_pecl_package_xml.py new file mode 100644 index 00000000..3acbf586 --- /dev/null +++ b/dev-scripts/prepare_pecl_package_xml.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 +import argparse +import os +import re +from datetime import datetime + +parser = argparse.ArgumentParser( + description="Generate package.xml file for a release bundle.") +parser.add_argument("--name", help="Name of the package", required=True) +parser.add_argument( + "--user", help="Username of the package maintainer", required=True) +parser.add_argument( + "--email", help="Email address of the package maintainer", default='aws-sdk-common-runtime@amazon.com') +parser.add_argument( + "--version", help="Version number of the package", required=True) +parser.add_argument( + "--notes", help="Release notes for the package", default='New release') +args = parser.parse_args() + + +name = args.name +user = args.user +email = args.email +version = args.version +notes = args.notes + + +tools_dir = os.path.dirname(os.path.abspath(__file__)) +work_dir = os.path.join(tools_dir, '..') + +os.chdir(work_dir) + +today = datetime.utcnow().strftime("%Y-%m-%d") + +source_ext = "(c|cc|h|cpp|hpp|m4|w32|ini|frag|cmake|inl|in|py|gnu|yaml|def|pl|S|s|errordata|go|lds|num|asm|mod|peg|mk|rs|toml|sh)" +doc_ext = "(md|json|html|dot|graphml|png|gn|sha1|css|rst)" + +special_docs = "(LICENSE.*|NOTICE|changelog.txt|CHANGELOG|THIRD-PARTY|README.*|readme|METADATA|CONTRIBUTORS|UPDATING|doc.config|THIRD-PARTY-LICENSES.txt)" +special_tests = "(ci-test.sh|format-check.sh|run_tests.*|sanitizer-blacklist.txt|run-clang-tidy.sh|benchmark-build-run.sh|break-tests.sh|generate-coverage.sh|test.xml)" +special_src = "(gen_api.php|gen_stub.php|CMakeLists.txt|post.sh|postun.sh|Makefile.*|build-buildspec.sh|build-deps.sh|objects.txt|go.*|BUILD.*|DEPS|install_and_run.sh|codemod.sh|requirements.txt)" +skip_files = "(package.xml.*|prepare_release.sh|codereview.settings|.*\\.o|.*\\.a|.*\\.obj|.*\\.lib|break-tests-android.sh|whitespace.txt|prepare_package_xml.sh|crypto_test_data.cc|.*\\.pdf|.*\\.svg|.*\\.docx|cbmc-proof.txt|codecov.*|litani.*|.*\\.toml|module\\.modulemap|cleanup.sh|^\..*)" + + +special_scripts = "(awscrt.stub.php)" + +skip_directories = "(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|third_party|docs|generated-src|aws-lc|aws-crt-sys|ecdsa-fuzz-corpus|bin|examples|compliance|verification|^\..*)" + +output_file_name = os.path.join(work_dir, 'package.xml') + + +def process_file(file_name, f): + if re.match(skip_files, file_name): + # This file is not part of the release bundle + return + f.write(f'\n') + + +def process_dir(dir_name, f): + if re.match(skip_directories, dir_name): + return + + f.write(f'\n') + os.chdir(dir_name) + for file_name in os.listdir(): + if os.path.isfile(file_name): + process_file(file_name, f) + else: + process_dir(file_name, f) + + # Special cases for compiler features placed in tests directories in and s2n + if dir_name == 's2n' and os.path.isdir('tests'): + f.write('') + f.write('') + os.chdir('tests/features') + for a in os.listdir(): + process_file(a, f) + os.chdir('../..') + f.write('') + f.write('') + + f.write('') + os.chdir('..') + + +# Main code +with open(os.path.join(tools_dir, "package.xml-template_pre"), 'r') as f: + template_pre = f.read() + +template_pre = re.sub(r"{{{NAME}}}", name, template_pre) +template_pre = re.sub(r"{{{USER}}}", user, template_pre) +template_pre = re.sub(r"{{{EMAIL}}}", email, template_pre) +template_pre = re.sub(r"{{{TODAY}}}", today, template_pre) +template_pre = re.sub(r"{{{VERSION}}}", version, template_pre) +template_pre = re.sub(r"{{{NOTES}}}", notes, template_pre) + +with open(output_file_name, "w") as f: + f.write(template_pre) + f.write('\n') + +with open(output_file_name, "a") as f: + for file_name in os.listdir(): + if file_name == 'tests': + f.write('\n') + for test_file in os.listdir('tests'): + f.write( + f'\n') + f.write('\n') + continue + + if file_name == 'src': + # skip the src directory as it is not part of the native extension + continue + + if os.path.isfile(file_name): + process_file(file_name, f) + else: + process_dir(file_name, f) + +with open(output_file_name, "a") as f: + f.write('\n') + with open(os.path.join(tools_dir, "package.xml-template_post"), 'r') as template: + f.write(template.read()) diff --git a/dev-scripts/prepare_pecl_release.py b/dev-scripts/prepare_pecl_release.py new file mode 100644 index 00000000..fd4874b0 --- /dev/null +++ b/dev-scripts/prepare_pecl_release.py @@ -0,0 +1,58 @@ +import argparse +import os +import subprocess +import xml.dom.minidom +import sys + + +parser = argparse.ArgumentParser(description='PECL Package generator') +parser.add_argument("--name", help="Name of the package", required=True) +parser.add_argument( + "--user", help="Username of the package maintainer", required=True) +parser.add_argument( + "--email", help="Email address of the package maintainer", default='aws-sdk-common-runtime@amazon.com') +parser.add_argument( + "--version", help="Version number of the package", required=True) +parser.add_argument( + "--notes", help="Release notes for the package", default='New release') +args = parser.parse_args() + +PACKAGE = 'awscrt' +NAME = args.name +USER = args.user +EMAIL = args.email +VERSION = args.version +NOTES = args.notes + +TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) +WORK_DIR = os.path.join(TOOLS_DIR, '..') + + +def run(args): + print(f"$ {subprocess.list2cmdline(args)}") + subprocess.check_call(args) + + +run(['python3', f'{TOOLS_DIR}/cleanup_build.py']) + +os.chdir(WORK_DIR) + +run(['git', 'submodule', 'update', '--init', '--recursive']) + +try: + run(['python3', f'{TOOLS_DIR}/prepare_pecl_package_xml.py', '--name', NAME, '--user', USER, + '--email', EMAIL, '--version', VERSION, '--notes', NOTES]) +except subprocess.CalledProcessError as e: + sys.exit(f'ERROR PROCESSING review package.xml: {e}') + +with open('package.xml', 'r') as f: + package_xml = f.read() +doc = xml.dom.minidom.parse('package.xml') +doc.encoding = 'UTF-8' +xml_str = doc.toprettyxml(indent=' ', newl='') +with open('package.xml', 'w') as f: + f.write(xml_str) +run(['pear', 'package-validate']) +run(['pear', 'package']) + +print(f'Size of {PACKAGE}-{VERSION}.tgz: {os.path.getsize(f"{PACKAGE}-{VERSION}.tgz") / 1024 / 1024:.2f} MB') diff --git a/dev-scripts/prepare_release.sh b/dev-scripts/prepare_release.sh deleted file mode 100755 index 0cf237dc..00000000 --- a/dev-scripts/prepare_release.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/zsh -zparseopts -A opts -name: -user: -email: -version: -notes: -if [[ $# -lt 10 ]]; then - echo "Usage ${0} --name NAME --user USER --email EMAIL --version VERSION --notes NOTES" - exit 1 -fi -PACKAGE='awscrt' -NAME="${opts[--name]}" -USER="${opts[--user]}" -EMAIL="${opts[--email]}" -VERSION="${opts[--version]}" -NOTES="${opts[--notes]}" - - -BASENAME=${0} -TOOLS_DIR=$(dirname ${BASENAME}) -WORK_DIR="${TOOLS_DIR}/.." - -cd "${WORK_DIR}" - -git submodule update --init --recursive - -$TOOLS_DIR/cleanup.sh -$TOOLS_DIR/prepare_package_xml.sh --name "${NAME}" --user "${USER}" --email "${EMAIL}" --version "${VERSION}" --notes "${NOTES}" >package.xml -if [[ $? -ne 0 ]]; then - echo "ERROR PROCESSING review package.xml" - exit 1 -fi -tidy -xml -m -i package.xml -pear package-validate -if [[ $? -ne 0 ]]; then - echo "ERROR VALIDATING review package.xml" - exit 1 -fi -pear package -if [[ $? -ne 0 ]]; then - echo "ERROR PROCESSING review package.xml" - exit 1 -fi - -echo "Size of ${PACKAGE}-${VERSION}.tgz: " $(du -h "${PACKAGE}-${VERSION}.tgz") diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index e92f1cb9..a071c24c 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -1,9 +1,6 @@ @echo on setlocal -REM Run command to get composer_dir -set "composer_dir=" -for /f "usebackq delims=" %%i in (`where composer.phar`) do set "composer_dir=%%i" set "PHP_BINARY=php" @@ -11,18 +8,24 @@ if not "%~1"=="" ( set "PHP_BINARY=%~1" ) -REM Check if composer_dir was found -if "%composer_dir%"=="" ( - echo No composer found. - exit /b 1 -) - set "script_dir=%~dp0" set "work_dir=%script_dir%/.." cd %work_dir% -call %PHP_BINARY% -c php-win.ini %composer_dir% update -call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug +set vendor_path=vendor +REM Run command to get composer_dir +set "composer_dir=" +for /f "usebackq delims=" %%i in (`where composer.phar`) do set "composer_dir=%%i" +if not exist "%vendor_path%" ( + REM Check if composer_dir was found + if "%composer_dir%"=="" ( + echo No composer found. + exit /b 1 + ) + call %PHP_BINARY% -c php-win.ini %composer_dir% update +) + +call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug -endlocal \ No newline at end of file +endlocal diff --git a/dev-scripts/run_tests b/dev-scripts/run_tests.sh similarity index 100% rename from dev-scripts/run_tests rename to dev-scripts/run_tests.sh diff --git a/php-win.ini b/php-win.ini index fb0f7041..a1bdb788 100644 --- a/php-win.ini +++ b/php-win.ini @@ -1,3 +1,3 @@ extension=php_awscrt.dll extension=php_openssl.dll -extension=php_mbstring.dll \ No newline at end of file +extension=php_mbstring.dll From 77f0fbb164a904be6a47a8079d059da2b03e1f64 Mon Sep 17 00:00:00 2001 From: sunaoka Date: Thu, 9 Jun 2022 11:05:08 +0900 Subject: [PATCH 38/72] Add .gitattributes to trim down the dist --- .gitattributes | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..11782c1d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,26 @@ +.github/ export-ignore +crt/ export-ignore +ext/ export-ignore +tests/ export-ignore +.clang-format export-ignore +.clang-format-ignore export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.gitmodules export-ignore +CONTRIBUTING.md export-ignore +Makefile.frag export-ignore +Makefile.frag.w32 export-ignore +builder.json export-ignore +config.m4 export-ignore +config.w32 export-ignore +format-check.sh export-ignore +gen_api.php export-ignore +gen_stub.php export-ignore +package.xml-template_post export-ignore +package.xml-template_pre export-ignore +php-win.ini export-ignore +php.ini export-ignore +prepare_package_xml.sh export-ignore +prepare_release.sh export-ignore +run_tests export-ignore +run_tests.bat export-ignore From e210901ee96e1fee827c2ab962f694e873bb0162 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 27 Feb 2023 09:23:53 -0800 Subject: [PATCH 39/72] update gitattributes --- .gitattributes | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.gitattributes b/.gitattributes index 11782c1d..8479dcd9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,6 +2,7 @@ crt/ export-ignore ext/ export-ignore tests/ export-ignore +dev-scripts/ export-ignore .clang-format export-ignore .clang-format-ignore export-ignore .gitattributes export-ignore @@ -16,11 +17,5 @@ config.w32 export-ignore format-check.sh export-ignore gen_api.php export-ignore gen_stub.php export-ignore -package.xml-template_post export-ignore -package.xml-template_pre export-ignore php-win.ini export-ignore php.ini export-ignore -prepare_package_xml.sh export-ignore -prepare_release.sh export-ignore -run_tests export-ignore -run_tests.bat export-ignore From 202fd2e90161b0957236ed200c50035f86b8d3ed Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 27 Feb 2023 10:12:45 -0800 Subject: [PATCH 40/72] try if it breaks anything --- Makefile.frag | 1 + Makefile.frag.w32 | 2 +- composer.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.frag b/Makefile.frag index a1414a76..80d636aa 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -21,6 +21,7 @@ CMAKE_CONFIGURE = $(CMAKE) \ -DCMAKE_INSTALL_PREFIX=$(INT_DIR) \ -DBUILD_TESTING=OFF \ -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \ + -DCMAKE_CXX_COMPILER_FORCED=True \ $(CMAKE_USE_OPENSSL) \ $(CMAKE_PREFIX_PATH) CMAKE_BUILD = CMAKE_BUILD_PARALLEL_LEVEL='' $(CMAKE) --build diff --git a/Makefile.frag.w32 b/Makefile.frag.w32 index 441abcde..8c53de1b 100644 --- a/Makefile.frag.w32 +++ b/Makefile.frag.w32 @@ -2,7 +2,7 @@ CMAKE=cmake.exe PHP_BINARY=$(PHP_PREFIX)\php.exe -CMAKE_CONFIGURE = $(CMAKE) -DCMAKE_INSTALL_PREFIX=$(AWSCRT_DIR)\build\install -DCMAKE_PREFIX_PATH=$(AWSCRT_DIR)\build\install -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) +CMAKE_CONFIGURE = $(CMAKE) -DCMAKE_INSTALL_PREFIX=$(AWSCRT_DIR)\build\install -DCMAKE_PREFIX_PATH=$(AWSCRT_DIR)\build\install -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) -DCMAKE_CXX_COMPILER_FORCED=True CMAKE_BUILD = $(CMAKE) --build CMAKE_BUILD_TYPE = Release CMAKE_TARGET = --config $(CMAKE_BUILD_TYPE) --target install diff --git a/composer.json b/composer.json index 6f1e6eeb..b419a13c 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "aws/aws-crt-php", - "homepage": "http://aws.amazon.com/sdkforphp", + "homepage": "https://github.com/awslabs/aws-crt-php", "description": "AWS Common Runtime for PHP", "keywords": ["aws","amazon","sdk","crt"], "type": "library", From ec1dce037f5334aa142df3fca4796c10dffd660a Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 27 Feb 2023 16:35:48 -0800 Subject: [PATCH 41/72] update README --- README.md | 70 +++++++++++++++++++++++++++++++++------------------ composer.json | 3 ++- 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index e7934838..25eedaac 100644 --- a/README.md +++ b/README.md @@ -3,52 +3,74 @@ ## Requirements * PHP 5.5+ on UNIX platforms, 7.2+ on Windows * CMake 3.x -* GCC 4.4+, clang 3.8+ on UNIX, Visual Studio 2017 build tools on Windows +* GCC 4.4+, clang 3.8+ on UNIX, Visual Studio build tools on Windows * Tests require [Composer](https://getcomposer.org) +## Installation + +The package has two different package published to [composer](https://packagist.org/packages/aws/aws-crt-php) and [PECL](https://pecl.php.net/package/awscrt). + +On UNIX, you can get the package from package manager or build from source: + +``` +pecl install awscrt +composer require aws/aws-crt-php +``` + +On Windows, you need to build from source as instruction written below for the native extension `php_awscrt.dll`. And, follow https://www.php.net/manual/en/install.pecl.windows.php#install.pecl.windows.loading to load extension. After that: + +``` +composer require aws/aws-crt-php +``` + ## Building on UNIX ```sh $ git clone --recursive https://github.com/awslabs/aws-crt-php.git $ cd aws-crt-php $ phpize $ ./configure -$ make && make test +$ make +$ ./dev-scripts/run_tests.sh ``` ## Building on Windows -* First, ensure that you are able to build PHP on windows via the PHP SDK (this example assumes installation of the SDK to C:\php-sdk and that you've checked out the PHP source to php-src within the build directory). The following resources are helpful to get PHP building on windows: + +### Requirements for Windows + +* Ensure that you are able to build PHP on windows via the PHP SDK (this example assumes installation of the SDK to C:\php-sdk and that you've checked out the PHP source to php-src within the build directory). The following resources are helpful to get PHP building on windows: + * https://github.com/microsoft/php-sdk-binary-tools - * https://medium.com/@erinus/how-to-build-php-on-windows-a7ad0a87862a - * https://medium.com/@erinus/how-to-build-php-extension-on-windows-d1667290f809 -```bat -""" From VS2017 Command Prompt -> C:\php-sdk\phpsdk-vc15-x64.bat +* Ensure you have "Development package (SDK to develop PHP extensions)" and PHP available from your system path. You can download them from https://windows.php.net/download/. You can check if they are available by running `phpize -v` and `php -v` -C:\php-sdk\ -$ phpsdk_buildtree php- +### Instructions -C:\php-sdk\php-\vc15\x64\ -$ git clone https://github.com/php/php-src.git && cd php-src +From Command Prompt (not powershell). The instruction is based on Visual Studio 2019 on 64bit Windows. -""" This only has to be done once, the first time you set this all up -C:\php-sdk\php-\vc15\x64\php-src -$ phpsdk_deps --update --branch +``` bat +> git clone --recursive https://github.com/awslabs/aws-crt-php.git +> git clone https://github.com/microsoft/php-sdk-binary-tools.git C:\php-sdk +> C:\php-sdk\phpsdk-vs16-x64.bat -C:\php-sdk\php-\vc15\x64\php-src -$ git clone --recursive https://github.com/awslabs/aws-crt-php.git ..\pecl\awscrt +C:\php-sdk\ +$ cd -C:\php-sdk\php-\vc15\x64\php-src -$ buildconf +\ +$ phpize -C:\php-sdk\php-\vc15\x64\php-src -$ configure --enable-cli --with-openssl --enable-awscrt=shared +# --with-prefix only required when your php runtime in system path is different than the runtime you wish to use. +\ +$ configure --enable-awscrt=shared --with-prefix= -C:\php-sdk\php-\vc15\x64\php-src +\ $ nmake -C:\php-sdk\php-\vc15\x64\php-src -$ nmake test-awscrt +\ +$ nmake generate-php-ini + +# check .\php-win.ini, it now has the full path to php_awscrt.dll that you can manually load to your php runtime, or you can run the following command to run tests and load the required native extension for awscrt. +\ +$ .\dev-scripts\run_tests.bat ``` Note: for VS2017, Cmake will default to build for Win32, refer to [here](https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2015%202017.html). If you are building for x64 php, you can set environment variable as follow to let cmake pick x64 compiler. diff --git a/composer.json b/composer.json index b419a13c..41670dd2 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ }, "minimum-stability": "alpha", "require": { - "php": ">=5.5" + "php": ">=5.5", + "ext-awscrt": "*" }, "require-dev": { "phpunit/phpunit":"^5.6.3" From 91f68d97324ceba9799a0d7a8d5f701726d20c3f Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 27 Feb 2023 16:44:59 -0800 Subject: [PATCH 42/72] update README --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 25eedaac..ee7fb40e 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,7 @@ $ ./dev-scripts/run_tests.sh ### Requirements for Windows -* Ensure that you are able to build PHP on windows via the PHP SDK (this example assumes installation of the SDK to C:\php-sdk and that you've checked out the PHP source to php-src within the build directory). The following resources are helpful to get PHP building on windows: - - * https://github.com/microsoft/php-sdk-binary-tools +* Ensure you have the [windows PHP SDK](https://github.com/microsoft/php-sdk-binary-tools) (this example assumes installation of the SDK to C:\php-sdk and that you've checked out the PHP source to php-src within the build directory) and it works well on your machine. * Ensure you have "Development package (SDK to develop PHP extensions)" and PHP available from your system path. You can download them from https://windows.php.net/download/. You can check if they are available by running `phpize -v` and `php -v` From a63ac28fa569fceab6c16cff71633415b1966fc5 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 10:53:25 -0800 Subject: [PATCH 43/72] try CMD to run multiple lines of code --- .github/workflows/ci.yml | 23 ++++++++++++----------- composer.json | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b6f9dd1..bf6cd1bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,11 +40,12 @@ jobs: make - name: Install dependencies + # get path to composer.phar so we can run it with custom php.ini + # Force to install phpunit@4.8.36 to support php@5.5 run: | - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php composer-setup.php - php -c php.ini composer.phar require --dev --ignore-platform-reqs phpunit/phpunit "4.8.36" - php -c php.ini composer.phar update --no-interaction + COMPOSER_PHAR=$(realpath $(which composer)) + php -c php.ini $COMPOSER_PHAR require --dev --ignore-platform-reqs phpunit/phpunit "4.8.36" + php -c php.ini $COMPOSER_PHAR update --no-interaction php-linux-x64: runs-on: ubuntu-latest @@ -111,19 +112,19 @@ jobs: uses: cmb69/setup-php-sdk@v0.6 with: version: '8.0' - arch: x64 + arch: ${{ matrix.arch }} ts: ts deps: openssl - uses: ilammy/msvc-dev-cmd@v1 with: arch: ${{ matrix.arch }} toolset: ${{steps.setup-php-sdk.outputs.toolset}} - # CMD only execute one commend per run - - run: phpize - - run: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl - - run: nmake - - run: nmake generate-php-ini - - run: .\dev-scripts\run_tests.bat ${{steps.setup-php-sdk.outputs.prefix}}\php + - run: | + phpize + .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl + nmake + nmake generate-php-ini + .\dev-scripts\run_tests.bat ${{steps.setup-php-sdk.outputs.prefix}}\php # windows-vc14: # runs-on: windows-latest diff --git a/composer.json b/composer.json index 6f1e6eeb..95127dd6 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit":"^5.6.3" + "phpunit/phpunit":"^4.8.35|^5.6.3" }, "autoload": { "classmap": [ From a9ab031603342067fa3c0a264c1bc96663915d5d Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 11:07:07 -0800 Subject: [PATCH 44/72] try to not force the special version of phpunit --- .github/workflows/ci.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf6cd1bc..c897b9f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,10 +41,8 @@ jobs: - name: Install dependencies # get path to composer.phar so we can run it with custom php.ini - # Force to install phpunit@4.8.36 to support php@5.5 run: | COMPOSER_PHAR=$(realpath $(which composer)) - php -c php.ini $COMPOSER_PHAR require --dev --ignore-platform-reqs phpunit/phpunit "4.8.36" php -c php.ini $COMPOSER_PHAR update --no-interaction php-linux-x64: @@ -119,12 +117,12 @@ jobs: with: arch: ${{ matrix.arch }} toolset: ${{steps.setup-php-sdk.outputs.toolset}} - - run: | - phpize - .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl - nmake - nmake generate-php-ini - .\dev-scripts\run_tests.bat ${{steps.setup-php-sdk.outputs.prefix}}\php + # CMD only execute one commend per run + - run: phpize + - run: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl + - run: nmake + - run: nmake generate-php-ini + - run: .\dev-scripts\run_tests.bat ${{steps.setup-php-sdk.outputs.prefix}}\php # windows-vc14: # runs-on: windows-latest From 6bc427dd4cd977c6faf6f0a4ef405157fc458a6a Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 11:25:02 -0800 Subject: [PATCH 45/72] update comments --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c897b9f8..4586e223 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,7 +117,7 @@ jobs: with: arch: ${{ matrix.arch }} toolset: ${{steps.setup-php-sdk.outputs.toolset}} - # CMD only execute one commend per run + # not sure why CMD can't do multiline run statements - run: phpize - run: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl - run: nmake From c1512f9c7080a8a32ba82a55e6f48d04313f7c30 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 15:37:19 -0800 Subject: [PATCH 46/72] address comments --- Makefile.frag | 1 - Makefile.frag.w32 | 2 +- README.md | 5 +++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.frag b/Makefile.frag index 80d636aa..a1414a76 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -21,7 +21,6 @@ CMAKE_CONFIGURE = $(CMAKE) \ -DCMAKE_INSTALL_PREFIX=$(INT_DIR) \ -DBUILD_TESTING=OFF \ -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \ - -DCMAKE_CXX_COMPILER_FORCED=True \ $(CMAKE_USE_OPENSSL) \ $(CMAKE_PREFIX_PATH) CMAKE_BUILD = CMAKE_BUILD_PARALLEL_LEVEL='' $(CMAKE) --build diff --git a/Makefile.frag.w32 b/Makefile.frag.w32 index 8c53de1b..441abcde 100644 --- a/Makefile.frag.w32 +++ b/Makefile.frag.w32 @@ -2,7 +2,7 @@ CMAKE=cmake.exe PHP_BINARY=$(PHP_PREFIX)\php.exe -CMAKE_CONFIGURE = $(CMAKE) -DCMAKE_INSTALL_PREFIX=$(AWSCRT_DIR)\build\install -DCMAKE_PREFIX_PATH=$(AWSCRT_DIR)\build\install -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) -DCMAKE_CXX_COMPILER_FORCED=True +CMAKE_CONFIGURE = $(CMAKE) -DCMAKE_INSTALL_PREFIX=$(AWSCRT_DIR)\build\install -DCMAKE_PREFIX_PATH=$(AWSCRT_DIR)\build\install -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) CMAKE_BUILD = $(CMAKE) --build CMAKE_BUILD_TYPE = Release CMAKE_TARGET = --config $(CMAKE_BUILD_TYPE) --target install diff --git a/README.md b/README.md index ee7fb40e..f8f3691a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ * GCC 4.4+, clang 3.8+ on UNIX, Visual Studio build tools on Windows * Tests require [Composer](https://getcomposer.org) -## Installation +## Installing with Composer and PECL The package has two different package published to [composer](https://packagist.org/packages/aws/aws-crt-php) and [PECL](https://pecl.php.net/package/awscrt). @@ -23,7 +23,8 @@ On Windows, you need to build from source as instruction written below for the n composer require aws/aws-crt-php ``` -## Building on UNIX +## Building from Github source + ```sh $ git clone --recursive https://github.com/awslabs/aws-crt-php.git $ cd aws-crt-php From b5fec52be13c73c48071a0a94d2386b926acd0fb Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 16:04:49 -0800 Subject: [PATCH 47/72] automate the release process --- .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ ext/crt.c | 4 +++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..e9a73fa8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ + +name: Release PECL Preparation + +# on: +# release: +# types: [published] +# workflow_dispatch: + +# TO test +on: + push: + branches-ignore: + - 'main' + +jobs: + package: + name: Prepare package + runs-on: ubuntu-latest + + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + + - name: Checkout Source + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Get release tag + uses: awslabs/aws-crt-builder/.github/actions/release-tag@main + id: tag + + - name: Prepare Package Script + # Update the version in code and generate the package. + run: | + sed -i "s/#define CRT_VERSION \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/#define CRT_VERSION \"${{ steps.tag.outputs.release_tag }}\"/g" ext/crt.c + dev-scripts/prepare_release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${{ steps.tag.outputs.release_tag }} --notes NOTES + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: pecl_package_${{ steps.tag.outputs.release_tag }} + path: awscrt-${{ steps.tag.outputs.release_tag }}.tgz \ No newline at end of file diff --git a/ext/crt.c b/ext/crt.c index b71dd79f..eea20deb 100644 --- a/ext/crt.c +++ b/ext/crt.c @@ -263,6 +263,8 @@ static PHP_GINIT_FUNCTION(awscrt) { awscrt_globals->log_level = 0; } +#define CRT_VERSION “0.1.0” + zend_module_entry awscrt_module_entry = { STANDARD_MODULE_HEADER, "awscrt", @@ -272,7 +274,7 @@ zend_module_entry awscrt_module_entry = { NULL, /* RINIT */ NULL, /* RSHUTDOWN */ NULL, /* MINFO */ - NO_VERSION_YET, + CRT_VERSION, PHP_MODULE_GLOBALS(awscrt), PHP_GINIT(awscrt), NULL, /* GSHUTDOWN */ From 21b8f0052a76c678f3dec017d2a8b0a591708bd5 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 16:08:24 -0800 Subject: [PATCH 48/72] test --- .github/workflows/release.yml | 2 +- ext/crt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e9a73fa8..066ec08c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: # Update the version in code and generate the package. run: | sed -i "s/#define CRT_VERSION \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/#define CRT_VERSION \"${{ steps.tag.outputs.release_tag }}\"/g" ext/crt.c - dev-scripts/prepare_release.sh --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${{ steps.tag.outputs.release_tag }} --notes NOTES + python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${{ steps.tag.outputs.release_tag }} - name: Upload artifacts uses: actions/upload-artifact@v3 diff --git a/ext/crt.c b/ext/crt.c index eea20deb..c6053a1e 100644 --- a/ext/crt.c +++ b/ext/crt.c @@ -263,7 +263,7 @@ static PHP_GINIT_FUNCTION(awscrt) { awscrt_globals->log_level = 0; } -#define CRT_VERSION “0.1.0” +#define CRT_VERSION "0.1.0" zend_module_entry awscrt_module_entry = { STANDARD_MODULE_HEADER, From 1226b906c66e0a0bbd7b5b2d87ce926f0f579f29 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 16:16:27 -0800 Subject: [PATCH 49/72] more --- .github/workflows/ci.yml | 376 +++++++++++++++++----------------- .github/workflows/release.yml | 5 + 2 files changed, 193 insertions(+), 188 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4586e223..cbaf22bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,188 +1,188 @@ -name: CI - -on: - push: - branches-ignore: - - 'main' - -env: - BUILDER_VERSION: v0.8.18 - BUILDER_SOURCE: releases - BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net - PACKAGE_NAME: aws-crt-php - LINUX_BASE_IMAGE: ubuntu-16-x64 - RUN: ${{ github.run_id }}-${{ github.run_number }} - -jobs: - php-5_5-linux-x64: - name: php-linux-x64 (5.5) - runs-on: ubuntu-latest - steps: - - name: Setup PHP with Xdebug - uses: shivammathur/setup-php@v2 - with: - coverage: xdebug - php-version: 5.5 - ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false - - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: Build for PHP 5.5 - env: - CC: clang - CXX: clang++ - run: | - phpize - ./configure - make - - - name: Install dependencies - # get path to composer.phar so we can run it with custom php.ini - run: | - COMPOSER_PHAR=$(realpath $(which composer)) - php -c php.ini $COMPOSER_PHAR update --no-interaction - - php-linux-x64: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: - - "5.6" - - "7.0" - - "7.1" - - "7.2" - - "7.3" - - "7.4" - - "8.0" - steps: - - name: Setup PHP with Xdebug - uses: shivammathur/setup-php@v2 - with: - coverage: xdebug - php-version: ${{matrix.version}} - ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false - - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: Run tests - env: - CC: clang - CXX: clang++ - run: | - phpize - ./configure - make - ./dev-scripts/run_tests.sh - - # linux-arm: - # name: ARM (${{ matrix.arch }}) - # runs-on: ubuntu-latest - # strategy: - # matrix: - # arch: [armv6, armv7, arm64] - # steps: - # - name: Build ${{ env.PACKAGE_NAME }} - # run: | - # python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" - # chmod a+x builder - # ./builder build -p ${{ env.PACKAGE_NAME }} --target=linux-${{ matrix.arch }} --spec=downstream - - windows-vc16: - runs-on: windows-2019 - defaults: - run: - shell: cmd # use CMD instead of powershell to catch error from bat script - strategy: - matrix: - arch: [x64] - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - id: setup-php-sdk - uses: cmb69/setup-php-sdk@v0.6 - with: - version: '8.0' - arch: ${{ matrix.arch }} - ts: ts - deps: openssl - - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: ${{ matrix.arch }} - toolset: ${{steps.setup-php-sdk.outputs.toolset}} - # not sure why CMD can't do multiline run statements - - run: phpize - - run: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl - - run: nmake - - run: nmake generate-php-ini - - run: .\dev-scripts\run_tests.bat ${{steps.setup-php-sdk.outputs.prefix}}\php - - # windows-vc14: - # runs-on: windows-latest - # strategy: - # matrix: - # arch: [x86, x64] - # steps: - # - uses: ilammy/msvc-dev-cmd@v1 - # with: - # toolset: 14.0 - # arch: ${{ matrix.arch }} - # uwp: false - # spectre: true - # - name: Build ${{ env.PACKAGE_NAME }} + consumers - # run: | - # python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" - # python builder.pyz build -p ${{ env.PACKAGE_NAME }} downstream - - macos: - runs-on: macos-${{ matrix.version }} - strategy: - matrix: - version: [10.15] - steps: - # Force PHP to 8.0 - # Doing this because tests fail in PHP 8.1 (default on macos Github Runner as of Dec 2021) - # due to the old version of PHPUnit we're using. - # We're using an old PHPUnit because it's compatible our min supported PHP 5.5. - # Quick fix is to force PHP version back to 8.0, which can still run our tests without error. - # A real solution is to get our tests working on all PHP versions - # (maybe don't use PHPUnit, maybe raise our min supported PHP version so we can upgrade, - # or maybe use PHPUnit-Polyfills so we can use a modern PHPUnit with old PHP) - - name: Setup PHP 8.0 - uses: shivammathur/setup-php@v2 - with: - php-version: '8.0' - - name: Build PHP 8 extension and test - run: | - python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" - chmod a+x builder - ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream - - pecl-package-test: - runs-on: ubuntu-latest - steps: - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.0' - - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: Test PECL package build - run: | - python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0 - tar -zxf *.tgz - cd awscrt-1.0.0 - phpize - ./configure - make +# name: CI + +# on: +# push: +# branches-ignore: +# - 'main' + +# env: +# BUILDER_VERSION: v0.8.18 +# BUILDER_SOURCE: releases +# BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net +# PACKAGE_NAME: aws-crt-php +# LINUX_BASE_IMAGE: ubuntu-16-x64 +# RUN: ${{ github.run_id }}-${{ github.run_number }} + +# jobs: +# php-5_5-linux-x64: +# name: php-linux-x64 (5.5) +# runs-on: ubuntu-latest +# steps: +# - name: Setup PHP with Xdebug +# uses: shivammathur/setup-php@v2 +# with: +# coverage: xdebug +# php-version: 5.5 +# ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false + +# - name: Checkout +# uses: actions/checkout@v2 +# with: +# submodules: recursive + +# - name: Build for PHP 5.5 +# env: +# CC: clang +# CXX: clang++ +# run: | +# phpize +# ./configure +# make + +# - name: Install dependencies +# # get path to composer.phar so we can run it with custom php.ini +# run: | +# COMPOSER_PHAR=$(realpath $(which composer)) +# php -c php.ini $COMPOSER_PHAR update --no-interaction + +# php-linux-x64: +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# version: +# - "5.6" +# - "7.0" +# - "7.1" +# - "7.2" +# - "7.3" +# - "7.4" +# - "8.0" +# steps: +# - name: Setup PHP with Xdebug +# uses: shivammathur/setup-php@v2 +# with: +# coverage: xdebug +# php-version: ${{matrix.version}} +# ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false + +# - name: Checkout +# uses: actions/checkout@v2 +# with: +# submodules: recursive + +# - name: Run tests +# env: +# CC: clang +# CXX: clang++ +# run: | +# phpize +# ./configure +# make +# ./dev-scripts/run_tests.sh + +# # linux-arm: +# # name: ARM (${{ matrix.arch }}) +# # runs-on: ubuntu-latest +# # strategy: +# # matrix: +# # arch: [armv6, armv7, arm64] +# # steps: +# # - name: Build ${{ env.PACKAGE_NAME }} +# # run: | +# # python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" +# # chmod a+x builder +# # ./builder build -p ${{ env.PACKAGE_NAME }} --target=linux-${{ matrix.arch }} --spec=downstream + +# windows-vc16: +# runs-on: windows-2019 +# defaults: +# run: +# shell: cmd # use CMD instead of powershell to catch error from bat script +# strategy: +# matrix: +# arch: [x64] +# steps: +# - uses: actions/checkout@v3 +# with: +# submodules: recursive +# - id: setup-php-sdk +# uses: cmb69/setup-php-sdk@v0.6 +# with: +# version: '8.0' +# arch: ${{ matrix.arch }} +# ts: ts +# deps: openssl +# - uses: ilammy/msvc-dev-cmd@v1 +# with: +# arch: ${{ matrix.arch }} +# toolset: ${{steps.setup-php-sdk.outputs.toolset}} +# # not sure why CMD can't do multiline run statements +# - run: phpize +# - run: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl +# - run: nmake +# - run: nmake generate-php-ini +# - run: .\dev-scripts\run_tests.bat ${{steps.setup-php-sdk.outputs.prefix}}\php + +# # windows-vc14: +# # runs-on: windows-latest +# # strategy: +# # matrix: +# # arch: [x86, x64] +# # steps: +# # - uses: ilammy/msvc-dev-cmd@v1 +# # with: +# # toolset: 14.0 +# # arch: ${{ matrix.arch }} +# # uwp: false +# # spectre: true +# # - name: Build ${{ env.PACKAGE_NAME }} + consumers +# # run: | +# # python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" +# # python builder.pyz build -p ${{ env.PACKAGE_NAME }} downstream + +# macos: +# runs-on: macos-${{ matrix.version }} +# strategy: +# matrix: +# version: [10.15] +# steps: +# # Force PHP to 8.0 +# # Doing this because tests fail in PHP 8.1 (default on macos Github Runner as of Dec 2021) +# # due to the old version of PHPUnit we're using. +# # We're using an old PHPUnit because it's compatible our min supported PHP 5.5. +# # Quick fix is to force PHP version back to 8.0, which can still run our tests without error. +# # A real solution is to get our tests working on all PHP versions +# # (maybe don't use PHPUnit, maybe raise our min supported PHP version so we can upgrade, +# # or maybe use PHPUnit-Polyfills so we can use a modern PHPUnit with old PHP) +# - name: Setup PHP 8.0 +# uses: shivammathur/setup-php@v2 +# with: +# php-version: '8.0' +# - name: Build PHP 8 extension and test +# run: | +# python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" +# chmod a+x builder +# ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream + +# pecl-package-test: +# runs-on: ubuntu-latest +# steps: +# - name: Setup PHP +# uses: shivammathur/setup-php@v2 +# with: +# php-version: '8.0' + +# - name: Checkout +# uses: actions/checkout@v2 +# with: +# submodules: recursive + +# - name: Test PECL package build +# run: | +# python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0 +# tar -zxf *.tgz +# cd awscrt-1.0.0 +# phpize +# ./configure +# make diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 066ec08c..3001c1fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,11 @@ jobs: - name: Prepare Package Script # Update the version in code and generate the package. run: | + version=$(git describe --tags --abbrev=0) + version_without_v=$(echo ${version} | cut -f2 -dv) + echo "${version_without_v}" > VERSION + echo $VERSION + echo ${{ steps.tag.outputs.release_tag }} sed -i "s/#define CRT_VERSION \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/#define CRT_VERSION \"${{ steps.tag.outputs.release_tag }}\"/g" ext/crt.c python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${{ steps.tag.outputs.release_tag }} From 071de01f6d8e65fd3fa8d3afc12581ab36617aa5 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 16:18:46 -0800 Subject: [PATCH 50/72] why git describe doesn't work --- .github/workflows/release.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3001c1fc..7226f2cd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,10 +35,7 @@ jobs: - name: Prepare Package Script # Update the version in code and generate the package. run: | - version=$(git describe --tags --abbrev=0) - version_without_v=$(echo ${version} | cut -f2 -dv) - echo "${version_without_v}" > VERSION - echo $VERSION + ls echo ${{ steps.tag.outputs.release_tag }} sed -i "s/#define CRT_VERSION \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/#define CRT_VERSION \"${{ steps.tag.outputs.release_tag }}\"/g" ext/crt.c python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${{ steps.tag.outputs.release_tag }} From e4ae7108c520cd597ac8e05115f53ee290263ea9 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 17:14:55 -0800 Subject: [PATCH 51/72] test --- .github/workflows/release.yml | 8 +------- dev-scripts/update_version.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 7 deletions(-) create mode 100755 dev-scripts/update_version.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7226f2cd..61cb7015 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,16 +28,10 @@ jobs: with: submodules: recursive - - name: Get release tag - uses: awslabs/aws-crt-builder/.github/actions/release-tag@main - id: tag - - name: Prepare Package Script # Update the version in code and generate the package. run: | - ls - echo ${{ steps.tag.outputs.release_tag }} - sed -i "s/#define CRT_VERSION \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/#define CRT_VERSION \"${{ steps.tag.outputs.release_tag }}\"/g" ext/crt.c + dev-scripts/update_version.sh python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${{ steps.tag.outputs.release_tag }} - name: Upload artifacts diff --git a/dev-scripts/update_version.sh b/dev-scripts/update_version.sh new file mode 100755 index 00000000..12034359 --- /dev/null +++ b/dev-scripts/update_version.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -ex + +BASENAME=${0} +TOOLS_DIR=$(dirname ${BASENAME}) +WORK_DIR="${TOOLS_DIR}/.." + +cd "${WORK_DIR}" + +version_with_v=$(git describe --tags --abbrev=0) +VERSION=$(echo ${version_with_v} | cut -f2 -dv) +sed -i "s/#define CRT_VERSION .*/#define CRT_VERSION \"$VERSION\"/g" ext/crt.c + +export VERSION="${VERSION}" From 7b1909a88b2f7e71adcc9c41c10b9def6e56f223 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 17:17:38 -0800 Subject: [PATCH 52/72] using v2? --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 61cb7015..8362b8ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: php-version: '8.0' - name: Checkout Source - uses: actions/checkout@v3 + uses: actions/checkout@v2 with: submodules: recursive From 232cc72008385560a8e5ba65e88db9851907fb45 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 17:19:39 -0800 Subject: [PATCH 53/72] why? --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8362b8ef..de565daa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,11 +26,13 @@ jobs: - name: Checkout Source uses: actions/checkout@v2 with: + fetch-depth: 0 submodules: recursive - name: Prepare Package Script # Update the version in code and generate the package. run: | + ls .git dev-scripts/update_version.sh python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${{ steps.tag.outputs.release_tag }} From 12fc7e06c426547e7af35b12932e0784c6015187 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 17:23:14 -0800 Subject: [PATCH 54/72] test with this --- .github/workflows/release.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de565daa..6b686498 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: php-version: '8.0' - name: Checkout Source - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 submodules: recursive @@ -32,12 +32,14 @@ jobs: - name: Prepare Package Script # Update the version in code and generate the package. run: | - ls .git - dev-scripts/update_version.sh - python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${{ steps.tag.outputs.release_tag }} + version_with_v=$(git describe --tags --abbrev=0) + VERSION=$(echo ${version_with_v} | cut -f2 -dv) + sed -i "s/#define CRT_VERSION .*/#define CRT_VERSION \"$VERSION\"/g" ext/crt.c + export VERSION="${VERSION}" + python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${VERSION} - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: pecl_package_${{ steps.tag.outputs.release_tag }} - path: awscrt-${{ steps.tag.outputs.release_tag }}.tgz \ No newline at end of file + name: pecl_package_${VERSION} + path: awscrt-${VERSION} \ No newline at end of file From 508cf9a63650b2eff642fcaa2702352fa3b3ab35 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 17:30:02 -0800 Subject: [PATCH 55/72] bad naming --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b686498..5cab1376 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,4 +42,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: pecl_package_${VERSION} - path: awscrt-${VERSION} \ No newline at end of file + path: awscrt-${VERSION}.tgz \ No newline at end of file From 1cb0cf28eff6b7ddf91da333dedbeca1e4e1b828 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 17:34:50 -0800 Subject: [PATCH 56/72] this? --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5cab1376..b9b57181 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,5 +41,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: pecl_package_${VERSION} - path: awscrt-${VERSION}.tgz \ No newline at end of file + name: pecl_package_$VERSION + path: awscrt-$VERSION.tgz \ No newline at end of file From 8bf63c40b26018497182e629ae989f85e51a8f5a Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 17:41:54 -0800 Subject: [PATCH 57/72] use github output --- .github/workflows/release.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9b57181..8ff138bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,16 +30,17 @@ jobs: submodules: recursive - name: Prepare Package Script + id: prepare-package # Update the version in code and generate the package. run: | version_with_v=$(git describe --tags --abbrev=0) VERSION=$(echo ${version_with_v} | cut -f2 -dv) sed -i "s/#define CRT_VERSION .*/#define CRT_VERSION \"$VERSION\"/g" ext/crt.c - export VERSION="${VERSION}" + echo "VERSION="${VERSION}" >> $GITHUB_OUTPUT python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${VERSION} - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: pecl_package_$VERSION - path: awscrt-$VERSION.tgz \ No newline at end of file + name: pecl_package_${{ steps.prepare-package.outputs.VERSION }} + path: awscrt-${{ steps.prepare-package.outputs.VERSION }}.tgz \ No newline at end of file From c41f667d997184591e14d02b765d99db41a907f7 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 17:45:44 -0800 Subject: [PATCH 58/72] fix? --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8ff138bd..7aa852ab 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: version_with_v=$(git describe --tags --abbrev=0) VERSION=$(echo ${version_with_v} | cut -f2 -dv) sed -i "s/#define CRT_VERSION .*/#define CRT_VERSION \"$VERSION\"/g" ext/crt.c - echo "VERSION="${VERSION}" >> $GITHUB_OUTPUT + echo "VERSION=\"${VERSION}\"" >> $GITHUB_OUTPUT python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${VERSION} - name: Upload artifacts From a9f7c2069e668199f4ae1d4fa2eae37cdce9ee63 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 17:47:24 -0800 Subject: [PATCH 59/72] remove the " --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7aa852ab..2b222e96 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: version_with_v=$(git describe --tags --abbrev=0) VERSION=$(echo ${version_with_v} | cut -f2 -dv) sed -i "s/#define CRT_VERSION .*/#define CRT_VERSION \"$VERSION\"/g" ext/crt.c - echo "VERSION=\"${VERSION}\"" >> $GITHUB_OUTPUT + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${VERSION} - name: Upload artifacts From fc49d948987617598a9d3eb1fc0502e91b53f7ce Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 28 Feb 2023 18:11:19 -0800 Subject: [PATCH 60/72] undo the ci change --- .github/workflows/ci.yml | 376 +++++++++++++++++++-------------------- 1 file changed, 188 insertions(+), 188 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbaf22bd..4586e223 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,188 +1,188 @@ -# name: CI - -# on: -# push: -# branches-ignore: -# - 'main' - -# env: -# BUILDER_VERSION: v0.8.18 -# BUILDER_SOURCE: releases -# BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net -# PACKAGE_NAME: aws-crt-php -# LINUX_BASE_IMAGE: ubuntu-16-x64 -# RUN: ${{ github.run_id }}-${{ github.run_number }} - -# jobs: -# php-5_5-linux-x64: -# name: php-linux-x64 (5.5) -# runs-on: ubuntu-latest -# steps: -# - name: Setup PHP with Xdebug -# uses: shivammathur/setup-php@v2 -# with: -# coverage: xdebug -# php-version: 5.5 -# ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false - -# - name: Checkout -# uses: actions/checkout@v2 -# with: -# submodules: recursive - -# - name: Build for PHP 5.5 -# env: -# CC: clang -# CXX: clang++ -# run: | -# phpize -# ./configure -# make - -# - name: Install dependencies -# # get path to composer.phar so we can run it with custom php.ini -# run: | -# COMPOSER_PHAR=$(realpath $(which composer)) -# php -c php.ini $COMPOSER_PHAR update --no-interaction - -# php-linux-x64: -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# version: -# - "5.6" -# - "7.0" -# - "7.1" -# - "7.2" -# - "7.3" -# - "7.4" -# - "8.0" -# steps: -# - name: Setup PHP with Xdebug -# uses: shivammathur/setup-php@v2 -# with: -# coverage: xdebug -# php-version: ${{matrix.version}} -# ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false - -# - name: Checkout -# uses: actions/checkout@v2 -# with: -# submodules: recursive - -# - name: Run tests -# env: -# CC: clang -# CXX: clang++ -# run: | -# phpize -# ./configure -# make -# ./dev-scripts/run_tests.sh - -# # linux-arm: -# # name: ARM (${{ matrix.arch }}) -# # runs-on: ubuntu-latest -# # strategy: -# # matrix: -# # arch: [armv6, armv7, arm64] -# # steps: -# # - name: Build ${{ env.PACKAGE_NAME }} -# # run: | -# # python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" -# # chmod a+x builder -# # ./builder build -p ${{ env.PACKAGE_NAME }} --target=linux-${{ matrix.arch }} --spec=downstream - -# windows-vc16: -# runs-on: windows-2019 -# defaults: -# run: -# shell: cmd # use CMD instead of powershell to catch error from bat script -# strategy: -# matrix: -# arch: [x64] -# steps: -# - uses: actions/checkout@v3 -# with: -# submodules: recursive -# - id: setup-php-sdk -# uses: cmb69/setup-php-sdk@v0.6 -# with: -# version: '8.0' -# arch: ${{ matrix.arch }} -# ts: ts -# deps: openssl -# - uses: ilammy/msvc-dev-cmd@v1 -# with: -# arch: ${{ matrix.arch }} -# toolset: ${{steps.setup-php-sdk.outputs.toolset}} -# # not sure why CMD can't do multiline run statements -# - run: phpize -# - run: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl -# - run: nmake -# - run: nmake generate-php-ini -# - run: .\dev-scripts\run_tests.bat ${{steps.setup-php-sdk.outputs.prefix}}\php - -# # windows-vc14: -# # runs-on: windows-latest -# # strategy: -# # matrix: -# # arch: [x86, x64] -# # steps: -# # - uses: ilammy/msvc-dev-cmd@v1 -# # with: -# # toolset: 14.0 -# # arch: ${{ matrix.arch }} -# # uwp: false -# # spectre: true -# # - name: Build ${{ env.PACKAGE_NAME }} + consumers -# # run: | -# # python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" -# # python builder.pyz build -p ${{ env.PACKAGE_NAME }} downstream - -# macos: -# runs-on: macos-${{ matrix.version }} -# strategy: -# matrix: -# version: [10.15] -# steps: -# # Force PHP to 8.0 -# # Doing this because tests fail in PHP 8.1 (default on macos Github Runner as of Dec 2021) -# # due to the old version of PHPUnit we're using. -# # We're using an old PHPUnit because it's compatible our min supported PHP 5.5. -# # Quick fix is to force PHP version back to 8.0, which can still run our tests without error. -# # A real solution is to get our tests working on all PHP versions -# # (maybe don't use PHPUnit, maybe raise our min supported PHP version so we can upgrade, -# # or maybe use PHPUnit-Polyfills so we can use a modern PHPUnit with old PHP) -# - name: Setup PHP 8.0 -# uses: shivammathur/setup-php@v2 -# with: -# php-version: '8.0' -# - name: Build PHP 8 extension and test -# run: | -# python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" -# chmod a+x builder -# ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream - -# pecl-package-test: -# runs-on: ubuntu-latest -# steps: -# - name: Setup PHP -# uses: shivammathur/setup-php@v2 -# with: -# php-version: '8.0' - -# - name: Checkout -# uses: actions/checkout@v2 -# with: -# submodules: recursive - -# - name: Test PECL package build -# run: | -# python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0 -# tar -zxf *.tgz -# cd awscrt-1.0.0 -# phpize -# ./configure -# make +name: CI + +on: + push: + branches-ignore: + - 'main' + +env: + BUILDER_VERSION: v0.8.18 + BUILDER_SOURCE: releases + BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net + PACKAGE_NAME: aws-crt-php + LINUX_BASE_IMAGE: ubuntu-16-x64 + RUN: ${{ github.run_id }}-${{ github.run_number }} + +jobs: + php-5_5-linux-x64: + name: php-linux-x64 (5.5) + runs-on: ubuntu-latest + steps: + - name: Setup PHP with Xdebug + uses: shivammathur/setup-php@v2 + with: + coverage: xdebug + php-version: 5.5 + ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false + + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Build for PHP 5.5 + env: + CC: clang + CXX: clang++ + run: | + phpize + ./configure + make + + - name: Install dependencies + # get path to composer.phar so we can run it with custom php.ini + run: | + COMPOSER_PHAR=$(realpath $(which composer)) + php -c php.ini $COMPOSER_PHAR update --no-interaction + + php-linux-x64: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + version: + - "5.6" + - "7.0" + - "7.1" + - "7.2" + - "7.3" + - "7.4" + - "8.0" + steps: + - name: Setup PHP with Xdebug + uses: shivammathur/setup-php@v2 + with: + coverage: xdebug + php-version: ${{matrix.version}} + ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false + + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Run tests + env: + CC: clang + CXX: clang++ + run: | + phpize + ./configure + make + ./dev-scripts/run_tests.sh + + # linux-arm: + # name: ARM (${{ matrix.arch }}) + # runs-on: ubuntu-latest + # strategy: + # matrix: + # arch: [armv6, armv7, arm64] + # steps: + # - name: Build ${{ env.PACKAGE_NAME }} + # run: | + # python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" + # chmod a+x builder + # ./builder build -p ${{ env.PACKAGE_NAME }} --target=linux-${{ matrix.arch }} --spec=downstream + + windows-vc16: + runs-on: windows-2019 + defaults: + run: + shell: cmd # use CMD instead of powershell to catch error from bat script + strategy: + matrix: + arch: [x64] + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - id: setup-php-sdk + uses: cmb69/setup-php-sdk@v0.6 + with: + version: '8.0' + arch: ${{ matrix.arch }} + ts: ts + deps: openssl + - uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} + toolset: ${{steps.setup-php-sdk.outputs.toolset}} + # not sure why CMD can't do multiline run statements + - run: phpize + - run: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl + - run: nmake + - run: nmake generate-php-ini + - run: .\dev-scripts\run_tests.bat ${{steps.setup-php-sdk.outputs.prefix}}\php + + # windows-vc14: + # runs-on: windows-latest + # strategy: + # matrix: + # arch: [x86, x64] + # steps: + # - uses: ilammy/msvc-dev-cmd@v1 + # with: + # toolset: 14.0 + # arch: ${{ matrix.arch }} + # uwp: false + # spectre: true + # - name: Build ${{ env.PACKAGE_NAME }} + consumers + # run: | + # python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" + # python builder.pyz build -p ${{ env.PACKAGE_NAME }} downstream + + macos: + runs-on: macos-${{ matrix.version }} + strategy: + matrix: + version: [10.15] + steps: + # Force PHP to 8.0 + # Doing this because tests fail in PHP 8.1 (default on macos Github Runner as of Dec 2021) + # due to the old version of PHPUnit we're using. + # We're using an old PHPUnit because it's compatible our min supported PHP 5.5. + # Quick fix is to force PHP version back to 8.0, which can still run our tests without error. + # A real solution is to get our tests working on all PHP versions + # (maybe don't use PHPUnit, maybe raise our min supported PHP version so we can upgrade, + # or maybe use PHPUnit-Polyfills so we can use a modern PHPUnit with old PHP) + - name: Setup PHP 8.0 + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + - name: Build PHP 8 extension and test + run: | + python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" + chmod a+x builder + ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream + + pecl-package-test: + runs-on: ubuntu-latest + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Test PECL package build + run: | + python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0 + tar -zxf *.tgz + cd awscrt-1.0.0 + phpize + ./configure + make From c1ffe7df740c95ec99f80e470cfee3cdafb7d3cf Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 1 Mar 2023 09:43:27 -0800 Subject: [PATCH 61/72] remove not used script --- dev-scripts/update_version.sh | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100755 dev-scripts/update_version.sh diff --git a/dev-scripts/update_version.sh b/dev-scripts/update_version.sh deleted file mode 100755 index 12034359..00000000 --- a/dev-scripts/update_version.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -BASENAME=${0} -TOOLS_DIR=$(dirname ${BASENAME}) -WORK_DIR="${TOOLS_DIR}/.." - -cd "${WORK_DIR}" - -version_with_v=$(git describe --tags --abbrev=0) -VERSION=$(echo ${version_with_v} | cut -f2 -dv) -sed -i "s/#define CRT_VERSION .*/#define CRT_VERSION \"$VERSION\"/g" ext/crt.c - -export VERSION="${VERSION}" From a57784153cc9f9b2a0a1d34967b54740a84cc91b Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 13 Mar 2023 15:15:20 -0700 Subject: [PATCH 62/72] the `awscrt.stub.php` is part of source --- dev-scripts/prepare_pecl_package_xml.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/dev-scripts/prepare_pecl_package_xml.py b/dev-scripts/prepare_pecl_package_xml.py index 3acbf586..4a7f8739 100644 --- a/dev-scripts/prepare_pecl_package_xml.py +++ b/dev-scripts/prepare_pecl_package_xml.py @@ -37,13 +37,10 @@ special_docs = "(LICENSE.*|NOTICE|changelog.txt|CHANGELOG|THIRD-PARTY|README.*|readme|METADATA|CONTRIBUTORS|UPDATING|doc.config|THIRD-PARTY-LICENSES.txt)" special_tests = "(ci-test.sh|format-check.sh|run_tests.*|sanitizer-blacklist.txt|run-clang-tidy.sh|benchmark-build-run.sh|break-tests.sh|generate-coverage.sh|test.xml)" -special_src = "(gen_api.php|gen_stub.php|CMakeLists.txt|post.sh|postun.sh|Makefile.*|build-buildspec.sh|build-deps.sh|objects.txt|go.*|BUILD.*|DEPS|install_and_run.sh|codemod.sh|requirements.txt)" +special_src = "(gen_api.php|gen_stub.php|CMakeLists.txt|post.sh|postun.sh|Makefile.*|build-buildspec.sh|build-deps.sh|objects.txt|go.*|BUILD.*|DEPS|install_and_run.sh|codemod.sh|requirements.txt|awscrt.stub.php)" skip_files = "(package.xml.*|prepare_release.sh|codereview.settings|.*\\.o|.*\\.a|.*\\.obj|.*\\.lib|break-tests-android.sh|whitespace.txt|prepare_package_xml.sh|crypto_test_data.cc|.*\\.pdf|.*\\.svg|.*\\.docx|cbmc-proof.txt|codecov.*|litani.*|.*\\.toml|module\\.modulemap|cleanup.sh|^\..*)" - -special_scripts = "(awscrt.stub.php)" - -skip_directories = "(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|third_party|docs|generated-src|aws-lc|aws-crt-sys|ecdsa-fuzz-corpus|bin|examples|compliance|verification|^\..*)" +skip_directories = "(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|third_party|docs|generated-src|aws-lc|aws-crt-sys|ecdsa-fuzz-corpus|bin|examples|compliance|verification|dev-scripts|^\..*)" output_file_name = os.path.join(work_dir, 'package.xml') @@ -54,9 +51,7 @@ def process_file(file_name, f): return f.write(f'=5.5", - "ext-awscrt": "*" + "php": ">=5.5" }, "require-dev": { "phpunit/phpunit":"^4.8.35||^5.6.3||^9.5", From 9fc2753d35155190629f14d9e65bc0bc7f590a13 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 13 Mar 2023 16:14:32 -0700 Subject: [PATCH 64/72] another guess --- Makefile.frag | 4 +--- ext/.gitignore | 1 - awscrt.stub.php => ext/awscrt.stub.php | 0 3 files changed, 1 insertion(+), 4 deletions(-) rename awscrt.stub.php => ext/awscrt.stub.php (100%) diff --git a/Makefile.frag b/Makefile.frag index a1414a76..47edcf13 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -46,10 +46,8 @@ ext/awscrt.lo: ext/awscrt.c ext/awscrt.c: build/aws-crt-ffi-static/libaws-crt-ffi.a ext/api.h ext/awscrt_arginfo.h -ext/awscrt_arginfo.h: awscrt.stub.php gen_stub.php +ext/awscrt_arginfo.h: ext/awscrt.stub.php gen_stub.php ifeq ($(GENERATE_STUBS),1) - # install awscrt.stub.php to ext/ - cp -v awscrt.stub.php ext/awscrt.stub.php # generate awscrt_arginfo.h php gen_stub.php --minimal-arginfo ext/awscrt.stub.php endif diff --git a/ext/.gitignore b/ext/.gitignore index 1f0fc8df..2973c979 100644 --- a/ext/.gitignore +++ b/ext/.gitignore @@ -1,3 +1,2 @@ *.so api.h -awscrt.stub.php diff --git a/awscrt.stub.php b/ext/awscrt.stub.php similarity index 100% rename from awscrt.stub.php rename to ext/awscrt.stub.php From 2abca716be0042d7f352a4929b447924a8785565 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 13 Mar 2023 16:18:20 -0700 Subject: [PATCH 65/72] don't delete it --- dev-scripts/cleanup_build.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dev-scripts/cleanup_build.py b/dev-scripts/cleanup_build.py index cc103725..b9320a25 100644 --- a/dev-scripts/cleanup_build.py +++ b/dev-scripts/cleanup_build.py @@ -40,7 +40,6 @@ 'awscrt.la', 'awscrt.dep', 'composer.lock', - 'ext/awscrt.stub.php', 'acinclude.m4', 'aclocal.m4', '**/*.lo', From 2af88eed43678d5f35b7429c7b2fb09c6fbccd62 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 14 Mar 2023 09:30:37 -0700 Subject: [PATCH 66/72] aha --- Makefile.frag | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/Makefile.frag b/Makefile.frag index 47edcf13..a0708bfb 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -1,5 +1,5 @@ -INT_DIR=build/install +INT_DIR=$(builddir)/install GENERATE_STUBS=$(shell expr `php --version | head -1 | cut -f 2 -d' '` \>= 7.1) CMAKE = cmake3 @@ -18,6 +18,8 @@ ifneq (OFF,$(USE_OPENSSL)) endif CMAKE_CONFIGURE = $(CMAKE) \ + -DCMAKE_SOURCE_DIR=$(srcdir) \ + -DCMAKE_BINARY_DIR=$(builddir) \ -DCMAKE_INSTALL_PREFIX=$(INT_DIR) \ -DBUILD_TESTING=OFF \ -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \ @@ -31,37 +33,46 @@ all: extension .PHONY: all extension # configure for static aws-crt-ffi.a -build/aws-crt-ffi-static/CMakeCache.txt: - $(CMAKE_CONFIGURE) -Hcrt/aws-crt-ffi -Bbuild/aws-crt-ffi-static -DBUILD_SHARED_LIBS=OFF +$(builddir)/aws-crt-ffi-static/CMakeCache.txt: + $(CMAKE_CONFIGURE) -H$(srcdir)/crt/aws-crt-ffi -B$(builddir)/aws-crt-ffi-static -DBUILD_SHARED_LIBS=OFF # build static libaws-crt-ffi.a -build/aws-crt-ffi-static/libaws-crt-ffi.a: build/aws-crt-ffi-static/CMakeCache.txt - $(CMAKE_BUILD) build/aws-crt-ffi-static $(CMAKE_TARGET) +$(builddir)/aws-crt-ffi-static/libaws-crt-ffi.a: $(builddir)/aws-crt-ffi-static/CMakeCache.txt + $(CMAKE_BUILD) $(builddir)/aws-crt-ffi-static $(CMAKE_TARGET) # PHP extension target -extension: ext/awscrt.lo +extension: $(builddir)/ext/awscrt.lo # Force the crt object target to depend on the CRT static library -ext/awscrt.lo: ext/awscrt.c +$(builddir)/ext/awscrt.lo: $(builddir)/ext/awscrt.c -ext/awscrt.c: build/aws-crt-ffi-static/libaws-crt-ffi.a ext/api.h ext/awscrt_arginfo.h +$(builddir)/ext/awscrt.c: $(builddir)/aws-crt-ffi-static/libaws-crt-ffi.a $(builddir)/ext/api.h $(builddir)/ext/awscrt_arginfo.h -ext/awscrt_arginfo.h: ext/awscrt.stub.php gen_stub.php +$(builddir)/ext/awscrt_arginfo.h: $(srcdir)/ext/awscrt.stub.php $(srcdir)/gen_stub.php ifeq ($(GENERATE_STUBS),1) # generate awscrt_arginfo.h - php gen_stub.php --minimal-arginfo ext/awscrt.stub.php + mkdir -p $(builddir)/ext && php $(srcdir)/gen_stub.php --minimal-arginfo $(srcdir)/ext/awscrt.stub.php endif # transform/install api.h from FFI lib -ext/api.h : crt/aws-crt-ffi/src/api.h - php gen_api.php crt/aws-crt-ffi/src/api.h > ext/api.h +$(srcdir)/src/api.h: $(srcdir)/crt/aws-crt-ffi/src/api.h + php $(srcdir)/gen_api.php $(srcdir)/crt/aws-crt-ffi/src/api.h > $(srcdir)/src/api.h -ext/php_aws_crt.h: ext/awscrt_arginfo.h ext/api.h +# install api.h to ext/ as well +$(builddir)/ext/api.h : $(srcdir)/src/api.h + mkdir -p $(builddir)/ext && cp -v $(srcdir)/src/api.h $(srcdir)/ext/api.h + +$(builddir)/ext/php_aws_crt.h: $(srcdir)/ext/awscrt_arginfo.h $(srcdir)/ext/api.h vendor/bin/phpunit: + cp -v $(srcdir)/composer.json $(builddir) composer update test-extension: vendor/bin/phpunit extension + cp -v $(srcdir)/composer.json $(builddir) + cp -vr $(srcdir)/src $(builddir) + cp -vr $(srcdir)/tests $(builddir) + cp -v $(srcdir)/run_tests $(builddir) composer run test-extension # Use PHPUnit to run tests From bb224803b791d4788864728e86e8d1933af91a88 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 14 Mar 2023 11:09:40 -0700 Subject: [PATCH 67/72] build install? --- Makefile.frag | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.frag b/Makefile.frag index a0708bfb..7a523dfc 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -1,5 +1,5 @@ -INT_DIR=$(builddir)/install +INT_DIR=$(builddir)/build/install GENERATE_STUBS=$(shell expr `php --version | head -1 | cut -f 2 -d' '` \>= 7.1) CMAKE = cmake3 @@ -55,12 +55,12 @@ ifeq ($(GENERATE_STUBS),1) endif # transform/install api.h from FFI lib -$(srcdir)/src/api.h: $(srcdir)/crt/aws-crt-ffi/src/api.h - php $(srcdir)/gen_api.php $(srcdir)/crt/aws-crt-ffi/src/api.h > $(srcdir)/src/api.h +$(srcdir)/ext/api.h: $(srcdir)/crt/aws-crt-ffi/src/api.h + php $(srcdir)/gen_api.php $(srcdir)/crt/aws-crt-ffi/src/api.h > $(srcdir)/ext/api.h # install api.h to ext/ as well -$(builddir)/ext/api.h : $(srcdir)/src/api.h - mkdir -p $(builddir)/ext && cp -v $(srcdir)/src/api.h $(srcdir)/ext/api.h +$(builddir)/ext/api.h : $(srcdir)/ext/api.h + mkdir -p $(builddir)/ext $(builddir)/ext/php_aws_crt.h: $(srcdir)/ext/awscrt_arginfo.h $(srcdir)/ext/api.h From e6c0d8066a42a87a997d3a311e3dcb9bcb56ea5e Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Tue, 14 Mar 2023 11:39:59 -0700 Subject: [PATCH 68/72] make the build cleaner --- .gitignore | 1 + Makefile.frag | 13 +++++++------ dev-scripts/cleanup_build.py | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 1eefe244..ed2e677a 100644 --- a/.gitignore +++ b/.gitignore @@ -179,6 +179,7 @@ fabric.properties .deps .libs/ build/ +cmake_build/ configure.in configure.ac configure.bat diff --git a/Makefile.frag b/Makefile.frag index 7a523dfc..b09def50 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -1,5 +1,6 @@ INT_DIR=$(builddir)/build/install +CMAKE_BUILD_DIR=$(builddir)/cmake_build GENERATE_STUBS=$(shell expr `php --version | head -1 | cut -f 2 -d' '` \>= 7.1) CMAKE = cmake3 @@ -19,7 +20,7 @@ endif CMAKE_CONFIGURE = $(CMAKE) \ -DCMAKE_SOURCE_DIR=$(srcdir) \ - -DCMAKE_BINARY_DIR=$(builddir) \ + -DCMAKE_BINARY_DIR=$(CMAKE_BUILD_DIR) \ -DCMAKE_INSTALL_PREFIX=$(INT_DIR) \ -DBUILD_TESTING=OFF \ -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \ @@ -33,12 +34,12 @@ all: extension .PHONY: all extension # configure for static aws-crt-ffi.a -$(builddir)/aws-crt-ffi-static/CMakeCache.txt: - $(CMAKE_CONFIGURE) -H$(srcdir)/crt/aws-crt-ffi -B$(builddir)/aws-crt-ffi-static -DBUILD_SHARED_LIBS=OFF +$(CMAKE_BUILD_DIR)/aws-crt-ffi-static/CMakeCache.txt: + $(CMAKE_CONFIGURE) -H$(srcdir)/crt/aws-crt-ffi -B$(CMAKE_BUILD_DIR)/aws-crt-ffi-static -DBUILD_SHARED_LIBS=OFF # build static libaws-crt-ffi.a -$(builddir)/aws-crt-ffi-static/libaws-crt-ffi.a: $(builddir)/aws-crt-ffi-static/CMakeCache.txt - $(CMAKE_BUILD) $(builddir)/aws-crt-ffi-static $(CMAKE_TARGET) +$(CMAKE_BUILD_DIR)/aws-crt-ffi-static/libaws-crt-ffi.a: $(CMAKE_BUILD_DIR)/aws-crt-ffi-static/CMakeCache.txt + $(CMAKE_BUILD) $(CMAKE_BUILD_DIR)/aws-crt-ffi-static $(CMAKE_TARGET) # PHP extension target extension: $(builddir)/ext/awscrt.lo @@ -46,7 +47,7 @@ extension: $(builddir)/ext/awscrt.lo # Force the crt object target to depend on the CRT static library $(builddir)/ext/awscrt.lo: $(builddir)/ext/awscrt.c -$(builddir)/ext/awscrt.c: $(builddir)/aws-crt-ffi-static/libaws-crt-ffi.a $(builddir)/ext/api.h $(builddir)/ext/awscrt_arginfo.h +$(builddir)/ext/awscrt.c: $(CMAKE_BUILD_DIR)/aws-crt-ffi-static/libaws-crt-ffi.a $(builddir)/ext/api.h $(builddir)/ext/awscrt_arginfo.h $(builddir)/ext/awscrt_arginfo.h: $(srcdir)/ext/awscrt.stub.php $(srcdir)/gen_stub.php ifeq ($(GENERATE_STUBS),1) diff --git a/dev-scripts/cleanup_build.py b/dev-scripts/cleanup_build.py index b9320a25..3e540447 100644 --- a/dev-scripts/cleanup_build.py +++ b/dev-scripts/cleanup_build.py @@ -10,6 +10,7 @@ '.deps', '.libs', 'build', + 'cmake_build', 'include', 'modules', 'vendor', From 8637ff74e7dceac0c8b338abe1bef9e1496399c9 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 15 Mar 2023 08:48:58 -0700 Subject: [PATCH 69/72] looks like working! --- .github/workflows/ci.yml | 6 +----- dev-scripts/cleanup_build.py | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d0cba6d..a9cf40f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -183,8 +183,4 @@ jobs: - name: Test PECL package build run: | python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0 - tar -zxf *.tgz - cd awscrt-1.0.0 - phpize - ./configure - make + pecl install awscrt-1.0.0.tgz diff --git a/dev-scripts/cleanup_build.py b/dev-scripts/cleanup_build.py index 3e540447..cfff8b1a 100644 --- a/dev-scripts/cleanup_build.py +++ b/dev-scripts/cleanup_build.py @@ -39,7 +39,7 @@ 'mkinstalldirs', 'run-tests.php', 'awscrt.la', - 'awscrt.dep', + 'ext/awscrt.dep', 'composer.lock', 'acinclude.m4', 'aclocal.m4', From 75633f591811f2bb5daf2a374d673b69602fbe55 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 15 Mar 2023 10:03:13 -0700 Subject: [PATCH 70/72] maybe sudo? --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9cf40f7..562f1e88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -183,4 +183,4 @@ jobs: - name: Test PECL package build run: | python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0 - pecl install awscrt-1.0.0.tgz + sudo pecl install awscrt-1.0.0.tgz From c9efe03fb5d94b38b66ddc741be041b8652ea1a2 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 15 Mar 2023 10:34:35 -0700 Subject: [PATCH 71/72] let the prepare script to update the version --- .github/workflows/release.yml | 15 ++++----------- dev-scripts/prepare_pecl_release.py | 21 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b222e96..ccf4c98b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,16 +1,10 @@ name: Release PECL Preparation -# on: -# release: -# types: [published] -# workflow_dispatch: - -# TO test on: - push: - branches-ignore: - - 'main' + release: + types: [published] + workflow_dispatch: jobs: package: @@ -35,7 +29,6 @@ jobs: run: | version_with_v=$(git describe --tags --abbrev=0) VERSION=$(echo ${version_with_v} | cut -f2 -dv) - sed -i "s/#define CRT_VERSION .*/#define CRT_VERSION \"$VERSION\"/g" ext/crt.c echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${VERSION} @@ -43,4 +36,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: pecl_package_${{ steps.prepare-package.outputs.VERSION }} - path: awscrt-${{ steps.prepare-package.outputs.VERSION }}.tgz \ No newline at end of file + path: awscrt-${{ steps.prepare-package.outputs.VERSION }}.tgz diff --git a/dev-scripts/prepare_pecl_release.py b/dev-scripts/prepare_pecl_release.py index fd4874b0..8f8b9197 100644 --- a/dev-scripts/prepare_pecl_release.py +++ b/dev-scripts/prepare_pecl_release.py @@ -3,6 +3,11 @@ import subprocess import xml.dom.minidom import sys +import re + +# get the github tag without the leading 'v' +git_tag = subprocess.run( + ["git", "describe", "--tags", "--abbrev=0"], capture_output=True).stdout.decode('utf-8').strip()[1:] parser = argparse.ArgumentParser(description='PECL Package generator') @@ -12,7 +17,7 @@ parser.add_argument( "--email", help="Email address of the package maintainer", default='aws-sdk-common-runtime@amazon.com') parser.add_argument( - "--version", help="Version number of the package", required=True) + "--version", help="Version number of the package", default=git_tag) parser.add_argument( "--notes", help="Release notes for the package", default='New release') args = parser.parse_args() @@ -27,6 +32,9 @@ TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) WORK_DIR = os.path.join(TOOLS_DIR, '..') +print(f'using version: {VERSION}') +print(f'using notes: {NOTES}') + def run(args): print(f"$ {subprocess.list2cmdline(args)}") @@ -39,6 +47,17 @@ def run(args): run(['git', 'submodule', 'update', '--init', '--recursive']) +# replace the version number in the ext/crt.c file +data = "" +with open("ext/crt.c", "r") as c_file: + for line in c_file: + line = re.sub("#define CRT_VERSION .*", + f"#define CRT_VERSION \"{VERSION}\"", line) + data += line +with open("ext/crt.c", "w") as c_file: + c_file.write(data) + + try: run(['python3', f'{TOOLS_DIR}/prepare_pecl_package_xml.py', '--name', NAME, '--user', USER, '--email', EMAIL, '--version', VERSION, '--notes', NOTES]) From 31f80f46a502a5886b4a7e4c4944cafb39457e83 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Wed, 15 Mar 2023 10:52:24 -0700 Subject: [PATCH 72/72] don't actually need to copy things around? --- Makefile.frag | 5 ----- composer.json | 2 +- ext/crt.c | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Makefile.frag b/Makefile.frag index b09def50..4eb26f57 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -66,14 +66,9 @@ $(builddir)/ext/api.h : $(srcdir)/ext/api.h $(builddir)/ext/php_aws_crt.h: $(srcdir)/ext/awscrt_arginfo.h $(srcdir)/ext/api.h vendor/bin/phpunit: - cp -v $(srcdir)/composer.json $(builddir) composer update test-extension: vendor/bin/phpunit extension - cp -v $(srcdir)/composer.json $(builddir) - cp -vr $(srcdir)/src $(builddir) - cp -vr $(srcdir)/tests $(builddir) - cp -v $(srcdir)/run_tests $(builddir) composer run test-extension # Use PHPUnit to run tests diff --git a/composer.json b/composer.json index 387721ee..13e7ac65 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "ext-awscrt": "Make sure you install awscrt native extension to use any of the functionality." }, "scripts": { - "test": "./dev-scripts/run_tests", + "test": "./dev-scripts/run_tests.sh", "test-extension": "@test", "test-win": ".\\dev-scripts\\run_tests.bat" }, diff --git a/ext/crt.c b/ext/crt.c index c6053a1e..3202abef 100644 --- a/ext/crt.c +++ b/ext/crt.c @@ -263,7 +263,7 @@ static PHP_GINIT_FUNCTION(awscrt) { awscrt_globals->log_level = 0; } -#define CRT_VERSION "0.1.0" +#define CRT_VERSION "1.0.4" zend_module_entry awscrt_module_entry = { STANDARD_MODULE_HEADER,