Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PECL publish #85

Merged
merged 41 commits into from Mar 1, 2023
Merged

Fix PECL publish #85

merged 41 commits into from Mar 1, 2023

Conversation

TingDaoK
Copy link
Contributor

@TingDaoK TingDaoK commented Feb 22, 2023

ISSUE:

  • PECL will remove the php files from subdirectory while installing.

Fix:

  • Move the php script that help to generate sub to main directory
  • Fixed a bunch of error during prepare package for pecl
  • Load the native extension before calling composer
  • add github action to create the tar file after cut the release
  • restructure a bit to be more clear

Windows issue:

  • We have a fixed composer path from makefile. And using the makefile to create a script to run tests.
  • We don't have CI

Fix:

  • Use Makefile to get the path to the shared libs (extensions) via: generate-php-ini
  • Updated run_tests.bat to get the path to composer.phar and accept passing in php path to override the default php
  • Do the same thing we did for linux.

TODO:

  • update README for windows and composer, PECL and releasing fixes for composer -- Composer update 2 #89
  • Rewrite Scripts from shell script to python for multiple platform - Rewrite script #87
  • Automate release process - PECL release follow up #90
  • Supports for PHP 8.1/8.2
  • Make the native extension required for composer Maybe not do this, or aws-sdk-php will break as it requires the composer package from crt, but not the native extension. Or, aws-sdk-php should take aws-crt-php an optional dependency instead (suggest instead of require)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Comment on lines 44 to 45
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this necessary?

ubuntu-latest comes with composer preinstalled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To have composer.phar in the same directory. So, that we don't need to script to get the path of composer.phar.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

installing composer twice seems like it could have weird consequences. let's just find the path. maybe something like?:

# get path to composer.phar so we can run it with custom php.ini
COMPOSER_PHAR=$(realpath $(which composer))
php -c php.ini $COMPOSER_PHAR require ...

.github/workflows/ci.yml Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
dev-scripts/cleanup.sh Outdated Show resolved Hide resolved
dev-scripts/run_tests.bat Outdated Show resolved Hide resolved
php-win.ini Outdated Show resolved Hide resolved
dev-scripts/prepare_release.sh Outdated Show resolved Hide resolved
dev-scripts/prepare_package_xml.sh Outdated Show resolved Hide resolved
@@ -45,6 +39,13 @@ jobs:
./configure
make
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debateable: // TODO run tests (if we are officially supporting 5.5 for now)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should ask when we can drop support for older versions of PHP. If it's something like 1-2 months away, we can drop support now and sdk-php can pick up new changes later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave the php version related stuff as a follow up item, I have listed some TODOs in the description of the PR.

Comment on lines +51 to +52
# install awscrt.stub.php to ext/
cp -v awscrt.stub.php ext/awscrt.stub.php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? We moved this to the main folder instead of ext/ and making a copy here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PECL removes .php from subdirectory, but not from the root directory. So, move it outside the ext/ is the easiest way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this in ext/? I am just confused about why do we need this file at two places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        # generate awscrt_arginfo.h
	php gen_stub.php --minimal-arginfo ext/awscrt.stub.php

This part will generate the awscrt_arginfo.h into the same folder as awscrt.stub.php.
The gen_sub.php is from the PHP build scripts, I didn't dig deep into it. We need awscrt_arginfo.h in ext/, so I just copy it around here.

Comment on lines 111 to 116
uses: cmb69/setup-php-sdk@v0.6
with:
version: '8.0'
arch: x64
ts: ts
deps: openssl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confused: What is this action? I could not find anything about it using a quick Google search (https://github.com/marketplace?type=actions&query=Setup+PHP+). Can you please add some documentation for why we need a different action for Windows CI? It appears that shivammathur/setup-php@v2 also supports Windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I didn't dig deep. I followed the PR initialed from Mike, https://github.com/awslabs/aws-crt-php/pull/77/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR114.
And I believe Mike found it from https://github.com/Imagick/imagick/blob/master/.github/workflows/windows.yml

I was really just want to have something working...

shell: cmd # use CMD instead of powershell to catch error from bat script
strategy:
matrix:
arch: [x64]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confused: Why only x64? Is this a todo for 32bit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe should leave it as a TODO. Again, just being lazy as no current ask and it's probably work.

.github/workflows/ci.yml Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
composer.json Show resolved Hide resolved
Copy link
Contributor

@graebm graebm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix & ship

Comment on lines 44 to 45
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

installing composer twice seems like it could have weird consequences. let's just find the path. maybe something like?:

# get path to composer.phar so we can run it with custom php.ini
COMPOSER_PHAR=$(realpath $(which composer))
php -c php.ini $COMPOSER_PHAR require ...

.github/workflows/ci.yml Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
dev-scripts/cleanup_build.py Show resolved Hide resolved
@TingDaoK TingDaoK merged commit 442f385 into main Mar 1, 2023
@TingDaoK TingDaoK deleted the native-extension-rewrite branch March 1, 2023 22:56
@TingDaoK TingDaoK mentioned this pull request Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants