From 4d0a79b2272e409d1986e69715793bab3c674efc Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 18:12:31 -0800 Subject: [PATCH 01/33] what's the extension available --- .github/workflows/ci.yml | 124 ++++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 61 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9fbeb6f..23ce68d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,73 +14,73 @@ env: 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 + # 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: Checkout + # uses: actions/checkout@v2 + # with: + # submodules: recursive - - name: Build for PHP 5.5 - env: - CC: clang - CXX: clang++ - run: | - phpize - ./configure - make + # - name: Build for PHP 5.5 + # env: + # CC: clang + # CXX: clang++ + # 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 require --dev --ignore-platform-reqs phpunit/phpunit "4.8.36" - php -c php.ini composer.phar update --no-interaction + # - 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: - 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 + # 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: Checkout + # uses: actions/checkout@v2 + # with: + # submodules: recursive - - name: Run tests - env: - CC: clang - CXX: clang++ - run: | - phpize - ./configure - make - ./dev-scripts/run_tests + # - name: Run tests + # env: + # CC: clang + # CXX: clang++ + # run: | + # phpize + # ./configure + # make + # ./dev-scripts/run_tests # linux-arm: # name: ARM (${{ matrix.arch }}) @@ -117,6 +117,8 @@ jobs: toolset: ${{steps.setup-php-sdk.outputs.toolset}} - name: Build ${{ env.PACKAGE_NAME }} + consumers run: | + ls php-bin + ls php-bin/ext phpize .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl nmake From acf8cb072ad818cc42764de8de1be4c5d4cd1b4d Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 18:25:36 -0800 Subject: [PATCH 02/33] try this out --- .github/workflows/ci.yml | 84 +++++++++++++++++++-------------------- composer.json | 3 +- dev-scripts/run_tests.bat | 3 +- 3 files changed, 44 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23ce68d..af5f7fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,48 +142,48 @@ jobs: # 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 + # 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: macos-latest - steps: - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.0' + # pecl-package-test: + # runs-on: macos-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: Checkout + # uses: actions/checkout@v2 + # with: + # submodules: recursive - - name: Run tests - 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 - tar -zxf *.tgz - cd awscrt-1.0.0 - phpize - ./configure - make + # - name: Run tests + # 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 + # tar -zxf *.tgz + # cd awscrt-1.0.0 + # phpize + # ./configure + # make diff --git a/composer.json b/composer.json index f7dbdd9..6f1e6ee 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 5611d2c..a7b1eef 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. @@ -22,7 +21,7 @@ set "script_dir=%~dp0" set "work_dir=%script_dir%/.." cd %work_dir% -call %PHP_BINARY% -c php-win.ini %composer_dir% update +composer update call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug From 4718d07921924719a3b4fad8f62e1a6fd47df7d1 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 18:36:28 -0800 Subject: [PATCH 03/33] update from outside the bat? --- .github/workflows/ci.yml | 1 + dev-scripts/run_tests.bat | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af5f7fc..fcec817 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,6 +123,7 @@ jobs: .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl nmake nmake generate-php-ini + composer update --ignore-platform-req=ext-awscrt .\dev-scripts\run_tests ${{steps.setup-php-sdk.outputs.prefix}}\php # windows-vc14: diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index a7b1eef..fff4913 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -21,7 +21,6 @@ set "script_dir=%~dp0" set "work_dir=%script_dir%/.." cd %work_dir% -composer update call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug From f098c102f0d17818133b82e1bab517b57b746b58 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 21:26:42 -0800 Subject: [PATCH 04/33] get the full path of the extension --- .github/workflows/ci.yml | 4 +--- Makefile.frag.w32 | 2 ++ dev-scripts/run_tests.bat | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcec817..00252df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,13 +117,11 @@ jobs: toolset: ${{steps.setup-php-sdk.outputs.toolset}} - name: Build ${{ env.PACKAGE_NAME }} + consumers run: | - ls php-bin - ls php-bin/ext phpize .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl nmake nmake generate-php-ini - composer update --ignore-platform-req=ext-awscrt + type .\php-win.ini .\dev-scripts\run_tests ${{steps.setup-php-sdk.outputs.prefix}}\php # windows-vc14: diff --git a/Makefile.frag.w32 b/Makefile.frag.w32 index 14cd941..b37987b 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)\php_openssl.dll >> php-win.ini + @echo extension=$(PHP_PREFIX)\php_mbstring.dll >> php-win.ini diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index fff4913..e92f1cb 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -21,6 +21,7 @@ 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 From 987d5a07a7ce3117801540a63aa48a5523463a0d Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 21:32:57 -0800 Subject: [PATCH 05/33] forgot ext --- Makefile.frag.w32 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.frag.w32 b/Makefile.frag.w32 index b37987b..441abcd 100644 --- a/Makefile.frag.w32 +++ b/Makefile.frag.w32 @@ -27,5 +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)\php_openssl.dll >> php-win.ini - @echo extension=$(PHP_PREFIX)\php_mbstring.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 From 7be4c7c888f16b51a09f45813b51a1406c0dd22f Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 21:41:23 -0800 Subject: [PATCH 06/33] finally, get the window CI running --- .github/workflows/ci.yml | 230 +++++++++++++++++++-------------------- php-win.ini | 2 +- 2 files changed, 116 insertions(+), 116 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00252df..70212c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,86 +14,86 @@ env: 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 + 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: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive - # - name: Build for PHP 5.5 - # env: - # CC: clang - # CXX: clang++ - # run: | - # phpize - # ./configure - # make + - name: Build for PHP 5.5 + env: + CC: clang + CXX: clang++ + 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 require --dev --ignore-platform-reqs phpunit/phpunit "4.8.36" - # php -c php.ini composer.phar update --no-interaction + - 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: - # 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 + 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: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive - # - name: Run tests - # env: - # CC: clang - # CXX: clang++ - # run: | - # phpize - # ./configure - # make - # ./dev-scripts/run_tests + - name: Run tests + env: + CC: clang + CXX: clang++ + run: | + phpize + ./configure + 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 @@ -141,48 +141,48 @@ jobs: # 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 + 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: macos-latest - # steps: - # - name: Setup PHP - # uses: shivammathur/setup-php@v2 - # with: - # php-version: '8.0' + pecl-package-test: + runs-on: macos-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: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive - # - name: Run tests - # 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 - # tar -zxf *.tgz - # cd awscrt-1.0.0 - # phpize - # ./configure - # make + - name: Run tests + 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 + tar -zxf *.tgz + cd awscrt-1.0.0 + phpize + ./configure + make diff --git a/php-win.ini b/php-win.ini index 31d5621..fb0f704 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 5667b284ad1480f6396557a21b7000a7180d369c Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 21:45:38 -0800 Subject: [PATCH 07/33] try if it catches the error --- .github/workflows/ci.yml | 3 +++ Makefile.frag.w32 | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70212c8..fc611be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,6 +97,9 @@ jobs: windows-vc16: runs-on: windows-2019 + defaults: + run: + shell: cmd # TODO: does this matter make the error out? strategy: matrix: arch: [x64] diff --git a/Makefile.frag.w32 b/Makefile.frag.w32 index 441abcd..3090286 100644 --- a/Makefile.frag.w32 +++ b/Makefile.frag.w32 @@ -27,5 +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)\php_openssl.dll >> php-win.ini @echo extension=$(PHP_PREFIX)\ext\php_mbstring.dll >> php-win.ini From 9e95d7fc0afb79656dd85bd25b6d81ad0833dfc4 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 21:46:54 -0800 Subject: [PATCH 08/33] keep the arm linux out --- .github/workflows/ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc611be..c2e7ff5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,18 +82,18 @@ 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 From 7ac1c8abb04b2825ecee191982dffb125f7fc0ff Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 21:58:36 -0800 Subject: [PATCH 09/33] what happened? --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2e7ff5..15a94c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,9 +97,6 @@ jobs: windows-vc16: runs-on: windows-2019 - defaults: - run: - shell: cmd # TODO: does this matter make the error out? strategy: matrix: arch: [x64] @@ -119,6 +116,7 @@ jobs: arch: ${{ matrix.arch }} toolset: ${{steps.setup-php-sdk.outputs.toolset}} - name: Build ${{ env.PACKAGE_NAME }} + consumers + shell: cmd run: | phpize .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl From 79b877203a0485a200ad89c4c6512ea599833b39 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 22:03:34 -0800 Subject: [PATCH 10/33] why --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15a94c7..9c2ec31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -116,7 +116,6 @@ jobs: arch: ${{ matrix.arch }} toolset: ${{steps.setup-php-sdk.outputs.toolset}} - name: Build ${{ env.PACKAGE_NAME }} + consumers - shell: cmd run: | phpize .\configure --with-prefix=${{steps.setup-php-sdk.outputs.prefix}} --enable-awscrt=shared --enable-cli --enable-openssl From 830ac2d84176ee15eeb2a999f75c415de46b1a1a Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 22:23:04 -0800 Subject: [PATCH 11/33] keep every step separate? --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c2ec31..68222b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,6 +97,9 @@ jobs: windows-vc16: runs-on: windows-2019 + defaults: + run: + shell: cmd # TODO: does this matter? strategy: matrix: arch: [x64] @@ -115,14 +118,11 @@ 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 - type .\php-win.ini - .\dev-scripts\run_tests ${{steps.setup-php-sdk.outputs.prefix}}\php + - 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 From 4d5420dffcb04748c0e5febd826c3dcedb85f998 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 22:30:30 -0800 Subject: [PATCH 12/33] done --- .github/workflows/ci.yml | 3 ++- Makefile.frag.w32 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68222b2..e67912e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: runs-on: windows-2019 defaults: run: - shell: cmd # TODO: does this matter? + shell: cmd # use CMD instead of powershell to catch error from bat script strategy: matrix: arch: [x64] @@ -118,6 +118,7 @@ jobs: 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 diff --git a/Makefile.frag.w32 b/Makefile.frag.w32 index 3090286..441abcd 100644 --- a/Makefile.frag.w32 +++ b/Makefile.frag.w32 @@ -27,5 +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)\php_openssl.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 From cdef4b7ef1531465d2be8930f1e2bc4825f1d67e Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Fri, 24 Feb 2023 15:39:09 -0800 Subject: [PATCH 13/33] update helper scripts and more --- .github/workflows/ci.yml | 6 +- dev-scripts/cleanup.sh | 48 -------- dev-scripts/cleanup_build.py | 40 +++++++ dev-scripts/prepare_package_xml.sh | 152 ------------------------ dev-scripts/prepare_pecl_package_xml.py | 147 +++++++++++++++++++++++ dev-scripts/prepare_pecl_release.py | 47 ++++++++ dev-scripts/prepare_release.sh | 41 ------- dev-scripts/run_tests.bat | 26 ++-- dev-scripts/{run_tests => run_tests.sh} | 0 dev-scripts/test.py | 9 ++ php-win.ini | 2 +- 11 files changed, 262 insertions(+), 256 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%) create mode 100644 dev-scripts/test.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e67912e..0ed8153 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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/dev-scripts/cleanup.sh b/dev-scripts/cleanup.sh deleted file mode 100755 index ad43122..0000000 --- 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 0000000..41cafaf --- /dev/null +++ b/dev-scripts/cleanup_build.py @@ -0,0 +1,40 @@ +import os +import glob +import shutil + +TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) +WORK_DIR = os.path.join(TOOLS_DIR, '..') + + +def remove_files(files): + for file in files: + if os.path.exists(file): + os.remove(file) + + +os.chdir(WORK_DIR) + +# Remove specified directories +dirs_to_remove = ['.deps', '.libs', 'build', 'include', 'modules', 'vendor'] +for directory in dirs_to_remove: + shutil.rmtree(directory, ignore_errors=True) + +# Remove specified files +files_to_remove = ['Makefile', 'Makefile.fragments', 'Makefile.global', 'Makefile.objects', + 'config.guess', 'config.h', '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', + 'autom4te.cache'] + +# Remove all .lo and .o files +files_to_remove += glob.glob(os.path.join(WORK_DIR, '**/*.lo')) +files_to_remove += glob.glob(os.path.join(WORK_DIR, '**/*.o')) + +# Remove all .la and .a files +files_to_remove += glob.glob(os.path.join(WORK_DIR, '**/*.la')) +files_to_remove += glob.glob(os.path.join(WORK_DIR, '**/*.a')) +# Remove all .tgz files +files_to_remove += glob.glob(os.path.join(WORK_DIR, '*.tgz')) + +remove_files(files_to_remove) diff --git a/dev-scripts/prepare_package_xml.sh b/dev-scripts/prepare_package_xml.sh deleted file mode 100755 index 29fcff8..0000000 --- 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 0000000..f5e3c37 --- /dev/null +++ b/dev-scripts/prepare_pecl_package_xml.py @@ -0,0 +1,147 @@ +#!/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') + + if dir_name == 'tests' and os.path.isdir('tests'): + f.write('\n') + f.write('\n') + os.chdir('tests/features') + for file_name in os.listdir(): + process_file(file_name) + os.chdir('../..') + f.write('\n') + f.write('\n') + + else: + 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) + + f.write('\n') + 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 0000000..1bbfc5e --- /dev/null +++ b/dev-scripts/prepare_pecl_release.py @@ -0,0 +1,47 @@ +import argparse +import os +import subprocess + + +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, '..') + +subprocess.run(['python3', f'{TOOLS_DIR}/cleanup_build.py'], check=True) + +os.chdir(WORK_DIR) + +subprocess.run(['git', 'submodule', 'update', + '--init', '--recursive'], check=True) + +subprocess.run(['python3', f'{TOOLS_DIR}/prepare_pecl_package_xml.py', '--name', NAME, '--user', USER, + '--email', EMAIL, '--version', VERSION, '--notes', NOTES], check=True) +try: + with open('package.xml', 'r') as f: + package_xml = f.read() + subprocess.run(['tidy', '-xml', '-m', '-i', 'package.xml'], check=True) + subprocess.run(['pear', 'package-validate'], check=True) + subprocess.run(['pear', 'package'], check=True) +except subprocess.CalledProcessError as e: + print(f'ERROR PROCESSING review package.xml: {e}') + exit(1) + +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 0cf237d..0000000 --- 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 e92f1cb..28e152f 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,25 @@ 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% +set vendor_path=vendor + +if not exist "%vendor_path%" ( + REM Run command to get composer_dir + set "composer_dir=" + for /f "usebackq delims=" %%i in (`where composer.phar`) do set "composer_dir=%%i" + + 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/dev-scripts/test.py b/dev-scripts/test.py new file mode 100644 index 0000000..09499dd --- /dev/null +++ b/dev-scripts/test.py @@ -0,0 +1,9 @@ +import os + +# get the absolute path of the script file +script_path = os.path.abspath(__file__) + +# get the directory of the script file +script_dir = os.path.dirname(script_path) + +print("Directory of the script file:", script_dir) diff --git a/php-win.ini b/php-win.ini index fb0f704..a1bdb78 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 4e15b06c849776a43ed902ef8c36e4c8c25041ca Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Fri, 24 Feb 2023 15:52:07 -0800 Subject: [PATCH 14/33] replace tidy with python --- dev-scripts/prepare_pecl_release.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev-scripts/prepare_pecl_release.py b/dev-scripts/prepare_pecl_release.py index 1bbfc5e..a510b59 100644 --- a/dev-scripts/prepare_pecl_release.py +++ b/dev-scripts/prepare_pecl_release.py @@ -1,6 +1,7 @@ import argparse import os import subprocess +import xml.dom.minidom parser = argparse.ArgumentParser(description='PECL Package generator') @@ -37,7 +38,11 @@ subprocess.run(['python3', f'{TOOLS_DIR}/prepare_pecl_package_xml.py', '--name', try: with open('package.xml', 'r') as f: package_xml = f.read() - subprocess.run(['tidy', '-xml', '-m', '-i', 'package.xml'], check=True) + 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) subprocess.run(['pear', 'package-validate'], check=True) subprocess.run(['pear', 'package'], check=True) except subprocess.CalledProcessError as e: From ff83a2672f2c3006a58594719d0b3e29ddc12276 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 18:12:31 -0800 Subject: [PATCH 15/33] what's the extension available --- .github/workflows/ci.yml | 122 +++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e67912e..84d55f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,73 +14,73 @@ env: 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 + # 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: Checkout + # uses: actions/checkout@v2 + # with: + # submodules: recursive - - name: Build for PHP 5.5 - env: - CC: clang - CXX: clang++ - run: | - phpize - ./configure - make + # - name: Build for PHP 5.5 + # env: + # CC: clang + # CXX: clang++ + # 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 require --dev --ignore-platform-reqs phpunit/phpunit "4.8.36" - php -c php.ini composer.phar update --no-interaction + # - 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: - 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 + # 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: Checkout + # uses: actions/checkout@v2 + # with: + # submodules: recursive - - name: Run tests - env: - CC: clang - CXX: clang++ - run: | - phpize - ./configure - make - ./dev-scripts/run_tests + # - name: Run tests + # env: + # CC: clang + # CXX: clang++ + # run: | + # phpize + # ./configure + # make + # ./dev-scripts/run_tests # linux-arm: # name: ARM (${{ matrix.arch }}) From 3f8f0d36b21fbf48b29d1db71b725cf89fc85a8b Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 18:25:36 -0800 Subject: [PATCH 16/33] try this out --- .github/workflows/ci.yml | 84 +++++++++++++++++++-------------------- dev-scripts/run_tests.bat | 2 +- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84d55f8..79804c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,48 +142,48 @@ jobs: # 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 + # 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: macos-latest - steps: - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.0' + # pecl-package-test: + # runs-on: macos-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: Checkout + # uses: actions/checkout@v2 + # with: + # submodules: recursive - - name: Run tests - 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 - tar -zxf *.tgz - cd awscrt-1.0.0 - phpize - ./configure - make + # - name: Run tests + # 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 + # tar -zxf *.tgz + # cd awscrt-1.0.0 + # phpize + # ./configure + # make diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index e92f1cb..a7b1eef 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -21,7 +21,7 @@ set "script_dir=%~dp0" set "work_dir=%script_dir%/.." cd %work_dir% -call %PHP_BINARY% -c php-win.ini %composer_dir% update +composer update call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug From 20a905444ed14abad856606ea3a7c5399d4ef210 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 18:36:28 -0800 Subject: [PATCH 17/33] update from outside the bat? --- dev-scripts/run_tests.bat | 1 - 1 file changed, 1 deletion(-) diff --git a/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index a7b1eef..fff4913 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -21,7 +21,6 @@ set "script_dir=%~dp0" set "work_dir=%script_dir%/.." cd %work_dir% -composer update call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug From 6bc3012adf6d5087c6d4e3b8bf0667d3925fbb3b Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 21:26:42 -0800 Subject: [PATCH 18/33] get the full path of the extension --- 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 fff4913..e92f1cb 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -21,6 +21,7 @@ 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 From 1453f4c98ff3fdb5f38caffa51f28b5afa18a128 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 21:41:23 -0800 Subject: [PATCH 19/33] finally, get the window CI running --- .github/workflows/ci.yml | 206 +++++++++++++++++++-------------------- 1 file changed, 103 insertions(+), 103 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79804c8..e67912e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,73 +14,73 @@ env: 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 + 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: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive - # - name: Build for PHP 5.5 - # env: - # CC: clang - # CXX: clang++ - # run: | - # phpize - # ./configure - # make + - name: Build for PHP 5.5 + env: + CC: clang + CXX: clang++ + 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 require --dev --ignore-platform-reqs phpunit/phpunit "4.8.36" - # php -c php.ini composer.phar update --no-interaction + - 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: - # 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 + 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: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive - # - name: Run tests - # env: - # CC: clang - # CXX: clang++ - # run: | - # phpize - # ./configure - # make - # ./dev-scripts/run_tests + - name: Run tests + env: + CC: clang + CXX: clang++ + run: | + phpize + ./configure + make + ./dev-scripts/run_tests # linux-arm: # name: ARM (${{ matrix.arch }}) @@ -142,48 +142,48 @@ jobs: # 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 + 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: macos-latest - # steps: - # - name: Setup PHP - # uses: shivammathur/setup-php@v2 - # with: - # php-version: '8.0' + pecl-package-test: + runs-on: macos-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: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive - # - name: Run tests - # 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 - # tar -zxf *.tgz - # cd awscrt-1.0.0 - # phpize - # ./configure - # make + - name: Run tests + 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 + tar -zxf *.tgz + cd awscrt-1.0.0 + phpize + ./configure + make From 4f0e4ab6e584f522078a7eb3a773accd5e0255d7 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 21:45:38 -0800 Subject: [PATCH 20/33] try if it catches the error --- Makefile.frag.w32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.frag.w32 b/Makefile.frag.w32 index 441abcd..3090286 100644 --- a/Makefile.frag.w32 +++ b/Makefile.frag.w32 @@ -27,5 +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)\php_openssl.dll >> php-win.ini @echo extension=$(PHP_PREFIX)\ext\php_mbstring.dll >> php-win.ini From 3096484d419d01972186e7367912b99173d183f0 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 22:03:34 -0800 Subject: [PATCH 21/33] why --- .github/workflows/ci.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e67912e..8471098 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,12 +118,14 @@ jobs: 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 ${{steps.setup-php-sdk.outputs.prefix}}\php + - 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 + type .\php-win.ini + .\dev-scripts\run_tests ${{steps.setup-php-sdk.outputs.prefix}}\php # windows-vc14: # runs-on: windows-latest From 7a9a9eadb425dc61428989895d10cf9f5f6c4810 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 22:23:04 -0800 Subject: [PATCH 22/33] keep every step separate? --- .github/workflows/ci.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8471098..68222b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: runs-on: windows-2019 defaults: run: - shell: cmd # use CMD instead of powershell to catch error from bat script + shell: cmd # TODO: does this matter? strategy: matrix: arch: [x64] @@ -118,14 +118,11 @@ 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 - type .\php-win.ini - .\dev-scripts\run_tests ${{steps.setup-php-sdk.outputs.prefix}}\php + - 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 From 260a543f77f09eb31147559468a3cd6bdab3a564 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Thu, 23 Feb 2023 22:30:30 -0800 Subject: [PATCH 23/33] done --- .github/workflows/ci.yml | 3 ++- Makefile.frag.w32 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68222b2..e67912e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: runs-on: windows-2019 defaults: run: - shell: cmd # TODO: does this matter? + shell: cmd # use CMD instead of powershell to catch error from bat script strategy: matrix: arch: [x64] @@ -118,6 +118,7 @@ jobs: 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 diff --git a/Makefile.frag.w32 b/Makefile.frag.w32 index 3090286..441abcd 100644 --- a/Makefile.frag.w32 +++ b/Makefile.frag.w32 @@ -27,5 +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)\php_openssl.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 From 6a4a8b750eb5c6de0e81c846f730ae1d91741102 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Fri, 24 Feb 2023 15:39:09 -0800 Subject: [PATCH 24/33] update helper scripts and more --- .github/workflows/ci.yml | 6 +- dev-scripts/cleanup.sh | 48 -------- dev-scripts/cleanup_build.py | 40 +++++++ dev-scripts/prepare_package_xml.sh | 152 ------------------------ dev-scripts/prepare_pecl_package_xml.py | 147 +++++++++++++++++++++++ dev-scripts/prepare_pecl_release.py | 47 ++++++++ dev-scripts/prepare_release.sh | 41 ------- dev-scripts/run_tests.bat | 26 ++-- dev-scripts/{run_tests => run_tests.sh} | 0 dev-scripts/test.py | 9 ++ php-win.ini | 2 +- 11 files changed, 262 insertions(+), 256 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%) create mode 100644 dev-scripts/test.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e67912e..0ed8153 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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/dev-scripts/cleanup.sh b/dev-scripts/cleanup.sh deleted file mode 100755 index ad43122..0000000 --- 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 0000000..41cafaf --- /dev/null +++ b/dev-scripts/cleanup_build.py @@ -0,0 +1,40 @@ +import os +import glob +import shutil + +TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) +WORK_DIR = os.path.join(TOOLS_DIR, '..') + + +def remove_files(files): + for file in files: + if os.path.exists(file): + os.remove(file) + + +os.chdir(WORK_DIR) + +# Remove specified directories +dirs_to_remove = ['.deps', '.libs', 'build', 'include', 'modules', 'vendor'] +for directory in dirs_to_remove: + shutil.rmtree(directory, ignore_errors=True) + +# Remove specified files +files_to_remove = ['Makefile', 'Makefile.fragments', 'Makefile.global', 'Makefile.objects', + 'config.guess', 'config.h', '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', + 'autom4te.cache'] + +# Remove all .lo and .o files +files_to_remove += glob.glob(os.path.join(WORK_DIR, '**/*.lo')) +files_to_remove += glob.glob(os.path.join(WORK_DIR, '**/*.o')) + +# Remove all .la and .a files +files_to_remove += glob.glob(os.path.join(WORK_DIR, '**/*.la')) +files_to_remove += glob.glob(os.path.join(WORK_DIR, '**/*.a')) +# Remove all .tgz files +files_to_remove += glob.glob(os.path.join(WORK_DIR, '*.tgz')) + +remove_files(files_to_remove) diff --git a/dev-scripts/prepare_package_xml.sh b/dev-scripts/prepare_package_xml.sh deleted file mode 100755 index 29fcff8..0000000 --- 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 0000000..f5e3c37 --- /dev/null +++ b/dev-scripts/prepare_pecl_package_xml.py @@ -0,0 +1,147 @@ +#!/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') + + if dir_name == 'tests' and os.path.isdir('tests'): + f.write('\n') + f.write('\n') + os.chdir('tests/features') + for file_name in os.listdir(): + process_file(file_name) + os.chdir('../..') + f.write('\n') + f.write('\n') + + else: + 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) + + f.write('\n') + 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 0000000..1bbfc5e --- /dev/null +++ b/dev-scripts/prepare_pecl_release.py @@ -0,0 +1,47 @@ +import argparse +import os +import subprocess + + +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, '..') + +subprocess.run(['python3', f'{TOOLS_DIR}/cleanup_build.py'], check=True) + +os.chdir(WORK_DIR) + +subprocess.run(['git', 'submodule', 'update', + '--init', '--recursive'], check=True) + +subprocess.run(['python3', f'{TOOLS_DIR}/prepare_pecl_package_xml.py', '--name', NAME, '--user', USER, + '--email', EMAIL, '--version', VERSION, '--notes', NOTES], check=True) +try: + with open('package.xml', 'r') as f: + package_xml = f.read() + subprocess.run(['tidy', '-xml', '-m', '-i', 'package.xml'], check=True) + subprocess.run(['pear', 'package-validate'], check=True) + subprocess.run(['pear', 'package'], check=True) +except subprocess.CalledProcessError as e: + print(f'ERROR PROCESSING review package.xml: {e}') + exit(1) + +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 0cf237d..0000000 --- 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 e92f1cb..28e152f 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,25 @@ 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% +set vendor_path=vendor + +if not exist "%vendor_path%" ( + REM Run command to get composer_dir + set "composer_dir=" + for /f "usebackq delims=" %%i in (`where composer.phar`) do set "composer_dir=%%i" + + 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/dev-scripts/test.py b/dev-scripts/test.py new file mode 100644 index 0000000..09499dd --- /dev/null +++ b/dev-scripts/test.py @@ -0,0 +1,9 @@ +import os + +# get the absolute path of the script file +script_path = os.path.abspath(__file__) + +# get the directory of the script file +script_dir = os.path.dirname(script_path) + +print("Directory of the script file:", script_dir) diff --git a/php-win.ini b/php-win.ini index fb0f704..a1bdb78 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 b3a9181cc8123f62e9de596fc2cf31b8a7caa959 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Fri, 24 Feb 2023 15:52:07 -0800 Subject: [PATCH 25/33] replace tidy with python --- dev-scripts/prepare_pecl_release.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev-scripts/prepare_pecl_release.py b/dev-scripts/prepare_pecl_release.py index 1bbfc5e..a510b59 100644 --- a/dev-scripts/prepare_pecl_release.py +++ b/dev-scripts/prepare_pecl_release.py @@ -1,6 +1,7 @@ import argparse import os import subprocess +import xml.dom.minidom parser = argparse.ArgumentParser(description='PECL Package generator') @@ -37,7 +38,11 @@ subprocess.run(['python3', f'{TOOLS_DIR}/prepare_pecl_package_xml.py', '--name', try: with open('package.xml', 'r') as f: package_xml = f.read() - subprocess.run(['tidy', '-xml', '-m', '-i', 'package.xml'], check=True) + 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) subprocess.run(['pear', 'package-validate'], check=True) subprocess.run(['pear', 'package'], check=True) except subprocess.CalledProcessError as e: From 9986f4d08f150c12ec3ae2f79cf09a7de6cf661f Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Sat, 25 Feb 2023 00:01:12 -0800 Subject: [PATCH 26/33] handle the case with features in tests --- dev-scripts/prepare_pecl_package_xml.py | 31 ++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/dev-scripts/prepare_pecl_package_xml.py b/dev-scripts/prepare_pecl_package_xml.py index f5e3c37..b21001b 100644 --- a/dev-scripts/prepare_pecl_package_xml.py +++ b/dev-scripts/prepare_pecl_package_xml.py @@ -84,26 +84,25 @@ def process_dir(dir_name, f): 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) - if dir_name == 'tests' and os.path.isdir('tests'): - f.write('\n') - f.write('\n') + # 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 file_name in os.listdir(): - process_file(file_name) + for a in os.listdir(): + process_file(a) os.chdir('../..') - f.write('\n') - f.write('\n') + f.write('') + f.write('') - else: - 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) - - f.write('\n') + f.write('') os.chdir('..') From d780f51fb4b34fa5a26d2cd7c95d7061504a88eb Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Sat, 25 Feb 2023 00:06:26 -0800 Subject: [PATCH 27/33] missing one arg --- dev-scripts/prepare_pecl_package_xml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-scripts/prepare_pecl_package_xml.py b/dev-scripts/prepare_pecl_package_xml.py index b21001b..3acbf58 100644 --- a/dev-scripts/prepare_pecl_package_xml.py +++ b/dev-scripts/prepare_pecl_package_xml.py @@ -97,7 +97,7 @@ def process_dir(dir_name, f): f.write('') os.chdir('tests/features') for a in os.listdir(): - process_file(a) + process_file(a, f) os.chdir('../..') f.write('') f.write('') From d296e61f2352106e18307caaa58be9c902a37082 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Sat, 25 Feb 2023 00:10:35 -0800 Subject: [PATCH 28/33] fix stuff --- .github/workflows/ci.yml | 4 ++-- dev-scripts/test.py | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 dev-scripts/test.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ed8153..4b6f9dd 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 diff --git a/dev-scripts/test.py b/dev-scripts/test.py deleted file mode 100644 index 09499dd..0000000 --- a/dev-scripts/test.py +++ /dev/null @@ -1,9 +0,0 @@ -import os - -# get the absolute path of the script file -script_path = os.path.abspath(__file__) - -# get the directory of the script file -script_dir = os.path.dirname(script_path) - -print("Directory of the script file:", script_dir) From 33f6c7aaf8270738d0837e670200875951997b00 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Sat, 25 Feb 2023 00:21:35 -0800 Subject: [PATCH 29/33] fix batch script and add gitignore for windowa --- .gitignore | 5 ++++- dev-scripts/run_tests.bat | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 7b7b8bf..f7413f5 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/dev-scripts/run_tests.bat b/dev-scripts/run_tests.bat index 28e152f..a071c24 100644 --- a/dev-scripts/run_tests.bat +++ b/dev-scripts/run_tests.bat @@ -13,20 +13,19 @@ set "work_dir=%script_dir%/.." cd %work_dir% 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 Run command to get composer_dir - set "composer_dir=" - for /f "usebackq delims=" %%i in (`where composer.phar`) do set "composer_dir=%%i" - 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 %composer_dir% update call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug endlocal From 2f3b933e0d30c34a83889720d7dd8e61e0c89015 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 27 Feb 2023 08:44:32 -0800 Subject: [PATCH 30/33] fix another naming --- builder.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder.json b/builder.json index 14763d0..ec45884 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"] ] } From b31bebd690f6d7babf4277029b363caeff9615ed Mon Sep 17 00:00:00 2001 From: sunaoka Date: Thu, 9 Jun 2022 11:05:08 +0900 Subject: [PATCH 31/33] 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 0000000..11782c1 --- /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 a329fec8991acbd143ee8fa253b2bdfa12ce2c4e Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 27 Feb 2023 09:23:53 -0800 Subject: [PATCH 32/33] update gitattributes --- .gitattributes | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.gitattributes b/.gitattributes index 11782c1..8479dcd 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 09a990ce27e9c0420434fad2414064dc6c7d1945 Mon Sep 17 00:00:00 2001 From: Dengke Tang Date: Mon, 27 Feb 2023 10:12:45 -0800 Subject: [PATCH 33/33] 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 a1414a7..80d636a 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 441abcd..8c53de1 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 6f1e6ee..b419a13 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",