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

PECL release follow up #90

Merged
merged 76 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from 73 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
e5e998a
require composer to load awscrt extension
TingDaoK Feb 21, 2023
31a5785
load extension before run composer
TingDaoK Feb 22, 2023
82abc2d
make test after the composer nonsense
TingDaoK Feb 22, 2023
1a0efbf
try to just use make test?
TingDaoK Feb 22, 2023
17b6a93
run test
TingDaoK Feb 22, 2023
9ff650e
clean up
TingDaoK Feb 22, 2023
9de07ef
restructure
TingDaoK Feb 22, 2023
826974a
change dir from run test
TingDaoK Feb 22, 2023
f6314a2
update the script path from ci
TingDaoK Feb 22, 2023
1f6f814
create release action when we cut a new release
TingDaoK Feb 22, 2023
9de1d33
more fix
TingDaoK Feb 22, 2023
f183523
make a github action to test pecl before release
TingDaoK Feb 22, 2023
093cf4e
why not find
TingDaoK Feb 22, 2023
b6a3a29
use mac
TingDaoK Feb 22, 2023
08aa34b
skip verification
TingDaoK Feb 22, 2023
3015509
build and test as well
TingDaoK Feb 22, 2023
279f5d2
just make sure it builds
TingDaoK Feb 22, 2023
a7e8407
use mac to release
TingDaoK Feb 22, 2023
02a6591
trivial
TingDaoK Feb 22, 2023
7d56d18
oh, it was a typo..
TingDaoK Feb 22, 2023
26ab397
windows CI
TingDaoK Feb 23, 2023
8208b31
get the right directory
TingDaoK Feb 23, 2023
311edc6
why?
TingDaoK Feb 23, 2023
2aae069
this?
TingDaoK Feb 23, 2023
8455b69
why cannot find dll
TingDaoK Feb 23, 2023
babc4bf
one more test
TingDaoK Feb 23, 2023
3ad39d5
fine
TingDaoK Feb 24, 2023
72c24d9
generate php-win.ini
TingDaoK Feb 24, 2023
7c12d40
get the right php
TingDaoK Feb 24, 2023
a28388f
give me echo
TingDaoK Feb 24, 2023
ce4a00c
I don't know
TingDaoK Feb 24, 2023
8c66121
I don't know
TingDaoK Feb 24, 2023
e361f03
Windows ci fix (#86)
TingDaoK Feb 24, 2023
b116a18
it should not be needed for the config platform
TingDaoK Feb 27, 2023
c0ab711
Revert "it should not be needed for the config platform"
TingDaoK Feb 27, 2023
c2f584a
remove release.yml and leave it as todo to follow up quick
TingDaoK Feb 27, 2023
ff20f95
Rewrite script (#87)
TingDaoK Feb 27, 2023
b4d352c
Merge branch 'native-extension-rewrite' of github.com:awslabs/aws-crt…
TingDaoK Feb 27, 2023
77f0fbb
Add .gitattributes to trim down the dist
sunaoka Jun 9, 2022
e210901
update gitattributes
TingDaoK Feb 27, 2023
202fd2e
try if it breaks anything
TingDaoK Feb 27, 2023
ec1dce0
update README
TingDaoK Feb 28, 2023
91f68d9
update README
TingDaoK Feb 28, 2023
a63ac28
try CMD to run multiple lines of code
TingDaoK Feb 28, 2023
a9ab031
try to not force the special version of phpunit
TingDaoK Feb 28, 2023
6bc427d
update comments
TingDaoK Feb 28, 2023
f9513c2
Merge branch 'native-extension-rewrite' into composer-update-2
TingDaoK Feb 28, 2023
c1512f9
address comments
TingDaoK Feb 28, 2023
b5fec52
automate the release process
TingDaoK Mar 1, 2023
21b8f00
test
TingDaoK Mar 1, 2023
1226b90
more
TingDaoK Mar 1, 2023
071de01
why git describe doesn't work
TingDaoK Mar 1, 2023
e4ae710
test
TingDaoK Mar 1, 2023
7b1909a
using v2?
TingDaoK Mar 1, 2023
232cc72
why?
TingDaoK Mar 1, 2023
12fc7e0
test with this
TingDaoK Mar 1, 2023
508cf9a
bad naming
TingDaoK Mar 1, 2023
1cb0cf2
this?
TingDaoK Mar 1, 2023
8bf63c4
use github output
TingDaoK Mar 1, 2023
c41f667
fix?
TingDaoK Mar 1, 2023
a9f7c20
remove the "
TingDaoK Mar 1, 2023
fc49d94
undo the ci change
TingDaoK Mar 1, 2023
c1ffe7d
remove not used script
TingDaoK Mar 1, 2023
00f1598
Merge branch 'main' into auto-release
TingDaoK Mar 2, 2023
1924852
Merge branch 'main' into auto-release
TingDaoK Mar 10, 2023
a577841
the `awscrt.stub.php` is part of source
TingDaoK Mar 13, 2023
2dd3fea
ignore ext-awscrt
TingDaoK Mar 13, 2023
9fc2753
another guess
TingDaoK Mar 13, 2023
2abca71
don't delete it
TingDaoK Mar 13, 2023
2af88ee
aha
TingDaoK Mar 14, 2023
bb22480
build install?
TingDaoK Mar 14, 2023
e6c0d80
make the build cleaner
TingDaoK Mar 14, 2023
8637ff7
looks like working!
TingDaoK Mar 15, 2023
75633f5
maybe sudo?
TingDaoK Mar 15, 2023
c9efe03
let the prepare script to update the version
TingDaoK Mar 15, 2023
31f80f4
don't actually need to copy things around?
TingDaoK Mar 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,4 @@ jobs:
- name: Test PECL package build
run: |
python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0
tar -zxf *.tgz
cd awscrt-1.0.0
phpize
./configure
make
pecl install awscrt-1.0.0.tgz
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

name: Release PECL Preparation

# on:
# release:
# types: [published]
# workflow_dispatch:

# TO test
on:
push:
branches-ignore:
- 'main'

jobs:
package:
name: Prepare package
runs-on: ubuntu-latest

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'

- name: Checkout Source
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Prepare Package Script
id: prepare-package
# Update the version in code and generate the package.
run: |
version_with_v=$(git describe --tags --abbrev=0)
VERSION=$(echo ${version_with_v} | cut -f2 -dv)
sed -i "s/#define CRT_VERSION .*/#define CRT_VERSION \"$VERSION\"/g" ext/crt.c
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email aws-sdk-common-runtime@amazon.com --version ${VERSION}

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: pecl_package_${{ steps.prepare-package.outputs.VERSION }}
path: awscrt-${{ steps.prepare-package.outputs.VERSION }}.tgz
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ fabric.properties
.deps
.libs/
build/
cmake_build/
configure.in
configure.ac
configure.bat
Expand Down
40 changes: 25 additions & 15 deletions Makefile.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

INT_DIR=build/install
INT_DIR=$(builddir)/build/install
CMAKE_BUILD_DIR=$(builddir)/cmake_build
GENERATE_STUBS=$(shell expr `php --version | head -1 | cut -f 2 -d' '` \>= 7.1)

CMAKE = cmake3
Expand All @@ -18,6 +19,8 @@ ifneq (OFF,$(USE_OPENSSL))
endif

CMAKE_CONFIGURE = $(CMAKE) \
-DCMAKE_SOURCE_DIR=$(srcdir) \
-DCMAKE_BINARY_DIR=$(CMAKE_BUILD_DIR) \
-DCMAKE_INSTALL_PREFIX=$(INT_DIR) \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
Expand All @@ -31,39 +34,46 @@ all: extension
.PHONY: all extension

# configure for static aws-crt-ffi.a
build/aws-crt-ffi-static/CMakeCache.txt:
$(CMAKE_CONFIGURE) -Hcrt/aws-crt-ffi -Bbuild/aws-crt-ffi-static -DBUILD_SHARED_LIBS=OFF
$(CMAKE_BUILD_DIR)/aws-crt-ffi-static/CMakeCache.txt:
$(CMAKE_CONFIGURE) -H$(srcdir)/crt/aws-crt-ffi -B$(CMAKE_BUILD_DIR)/aws-crt-ffi-static -DBUILD_SHARED_LIBS=OFF

# build static libaws-crt-ffi.a
build/aws-crt-ffi-static/libaws-crt-ffi.a: build/aws-crt-ffi-static/CMakeCache.txt
$(CMAKE_BUILD) build/aws-crt-ffi-static $(CMAKE_TARGET)
$(CMAKE_BUILD_DIR)/aws-crt-ffi-static/libaws-crt-ffi.a: $(CMAKE_BUILD_DIR)/aws-crt-ffi-static/CMakeCache.txt
$(CMAKE_BUILD) $(CMAKE_BUILD_DIR)/aws-crt-ffi-static $(CMAKE_TARGET)

# PHP extension target
extension: ext/awscrt.lo
extension: $(builddir)/ext/awscrt.lo

# Force the crt object target to depend on the CRT static library
ext/awscrt.lo: ext/awscrt.c
$(builddir)/ext/awscrt.lo: $(builddir)/ext/awscrt.c

ext/awscrt.c: build/aws-crt-ffi-static/libaws-crt-ffi.a ext/api.h ext/awscrt_arginfo.h
$(builddir)/ext/awscrt.c: $(CMAKE_BUILD_DIR)/aws-crt-ffi-static/libaws-crt-ffi.a $(builddir)/ext/api.h $(builddir)/ext/awscrt_arginfo.h

ext/awscrt_arginfo.h: awscrt.stub.php gen_stub.php
$(builddir)/ext/awscrt_arginfo.h: $(srcdir)/ext/awscrt.stub.php $(srcdir)/gen_stub.php
ifeq ($(GENERATE_STUBS),1)
# install awscrt.stub.php to ext/
cp -v awscrt.stub.php ext/awscrt.stub.php
# generate awscrt_arginfo.h
php gen_stub.php --minimal-arginfo ext/awscrt.stub.php
mkdir -p $(builddir)/ext && php $(srcdir)/gen_stub.php --minimal-arginfo $(srcdir)/ext/awscrt.stub.php
endif

# transform/install api.h from FFI lib
ext/api.h : crt/aws-crt-ffi/src/api.h
php gen_api.php crt/aws-crt-ffi/src/api.h > ext/api.h
$(srcdir)/ext/api.h: $(srcdir)/crt/aws-crt-ffi/src/api.h
php $(srcdir)/gen_api.php $(srcdir)/crt/aws-crt-ffi/src/api.h > $(srcdir)/ext/api.h

ext/php_aws_crt.h: ext/awscrt_arginfo.h ext/api.h
# install api.h to ext/ as well
$(builddir)/ext/api.h : $(srcdir)/ext/api.h
mkdir -p $(builddir)/ext

$(builddir)/ext/php_aws_crt.h: $(srcdir)/ext/awscrt_arginfo.h $(srcdir)/ext/api.h

vendor/bin/phpunit:
cp -v $(srcdir)/composer.json $(builddir)
composer update

test-extension: vendor/bin/phpunit extension
cp -v $(srcdir)/composer.json $(builddir)
cp -vr $(srcdir)/src $(builddir)
cp -vr $(srcdir)/tests $(builddir)
cp -v $(srcdir)/run_tests $(builddir)
composer run test-extension

# Use PHPUnit to run tests
Expand Down
4 changes: 2 additions & 2 deletions dev-scripts/cleanup_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'.deps',
'.libs',
'build',
'cmake_build',
'include',
'modules',
'vendor',
Expand Down Expand Up @@ -38,9 +39,8 @@
'mkinstalldirs',
'run-tests.php',
'awscrt.la',
'awscrt.dep',
'ext/awscrt.dep',
'composer.lock',
'ext/awscrt.stub.php',
'acinclude.m4',
'aclocal.m4',
'**/*.lo',
Expand Down
11 changes: 3 additions & 8 deletions dev-scripts/prepare_pecl_package_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@

special_docs = "(LICENSE.*|NOTICE|changelog.txt|CHANGELOG|THIRD-PARTY|README.*|readme|METADATA|CONTRIBUTORS|UPDATING|doc.config|THIRD-PARTY-LICENSES.txt)"
special_tests = "(ci-test.sh|format-check.sh|run_tests.*|sanitizer-blacklist.txt|run-clang-tidy.sh|benchmark-build-run.sh|break-tests.sh|generate-coverage.sh|test.xml)"
special_src = "(gen_api.php|gen_stub.php|CMakeLists.txt|post.sh|postun.sh|Makefile.*|build-buildspec.sh|build-deps.sh|objects.txt|go.*|BUILD.*|DEPS|install_and_run.sh|codemod.sh|requirements.txt)"
special_src = "(gen_api.php|gen_stub.php|CMakeLists.txt|post.sh|postun.sh|Makefile.*|build-buildspec.sh|build-deps.sh|objects.txt|go.*|BUILD.*|DEPS|install_and_run.sh|codemod.sh|requirements.txt|awscrt.stub.php)"
skip_files = "(package.xml.*|prepare_release.sh|codereview.settings|.*\\.o|.*\\.a|.*\\.obj|.*\\.lib|break-tests-android.sh|whitespace.txt|prepare_package_xml.sh|crypto_test_data.cc|.*\\.pdf|.*\\.svg|.*\\.docx|cbmc-proof.txt|codecov.*|litani.*|.*\\.toml|module\\.modulemap|cleanup.sh|^\..*)"


special_scripts = "(awscrt.stub.php)"

skip_directories = "(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|third_party|docs|generated-src|aws-lc|aws-crt-sys|ecdsa-fuzz-corpus|bin|examples|compliance|verification|^\..*)"
skip_directories = "(tests|test|AWSCRTAndroidTestRunner|docker-images|codebuild|fuzz|third_party|docs|generated-src|aws-lc|aws-crt-sys|ecdsa-fuzz-corpus|bin|examples|compliance|verification|dev-scripts|^\..*)"

output_file_name = os.path.join(work_dir, 'package.xml')

Expand All @@ -54,9 +51,7 @@ def process_file(file_name, f):
return
f.write(f'<file name="{file_name}" role="')
# Special cases
if re.match(special_scripts, file_name):
f.write('script')
elif re.match(special_docs, file_name):
if re.match(special_docs, file_name):
f.write('doc')
elif re.match(special_tests, file_name):
f.write('test')
Expand Down
1 change: 0 additions & 1 deletion ext/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
*.so
api.h
awscrt.stub.php
File renamed without changes.
4 changes: 3 additions & 1 deletion ext/crt.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ static PHP_GINIT_FUNCTION(awscrt) {
awscrt_globals->log_level = 0;
}

#define CRT_VERSION "0.1.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is obviously not the proper version ?

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, it's not. I was hoping to automate the release process and update this to real version here


Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend you use the normalized PHP_AWSCRT_VERSION macro name, and define it in some header in package root directory, so this version will be checked by pecl during upload

See https://github.com/php/web-pecl/blob/master/public_html/release-upload.php#L140

zend_module_entry awscrt_module_entry = {
STANDARD_MODULE_HEADER,
"awscrt",
Expand All @@ -272,7 +274,7 @@ zend_module_entry awscrt_module_entry = {
NULL, /* RINIT */
NULL, /* RSHUTDOWN */
NULL, /* MINFO */
NO_VERSION_YET,
CRT_VERSION,
PHP_MODULE_GLOBALS(awscrt),
PHP_GINIT(awscrt),
NULL, /* GSHUTDOWN */
Expand Down