mirror of
https://github.com/awslabs/aws-crt-php.git
synced 2026-08-18 01:57:13 +00:00
PECL release follow up (#90)
This commit is contained in:
@@ -183,8 +183,4 @@ jobs:
|
|||||||
- name: Test PECL package build
|
- name: Test PECL package build
|
||||||
run: |
|
run: |
|
||||||
python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0
|
python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --version 1.0.0
|
||||||
tar -zxf *.tgz
|
sudo pecl install awscrt-1.0.0.tgz
|
||||||
cd awscrt-1.0.0
|
|
||||||
phpize
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
|
||||||
|
name: Release PECL Preparation
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
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)
|
||||||
|
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
python3 dev-scripts/prepare_pecl_release.py --name aws-crt --user aws-crt --email [email protected] --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
|
||||||
@@ -179,6 +179,7 @@ fabric.properties
|
|||||||
.deps
|
.deps
|
||||||
.libs/
|
.libs/
|
||||||
build/
|
build/
|
||||||
|
cmake_build/
|
||||||
configure.in
|
configure.in
|
||||||
configure.ac
|
configure.ac
|
||||||
configure.bat
|
configure.bat
|
||||||
|
|||||||
+20
-15
@@ -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)
|
GENERATE_STUBS=$(shell expr `php --version | head -1 | cut -f 2 -d' '` \>= 7.1)
|
||||||
|
|
||||||
CMAKE = cmake3
|
CMAKE = cmake3
|
||||||
@@ -18,6 +19,8 @@ ifneq (OFF,$(USE_OPENSSL))
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
CMAKE_CONFIGURE = $(CMAKE) \
|
CMAKE_CONFIGURE = $(CMAKE) \
|
||||||
|
-DCMAKE_SOURCE_DIR=$(srcdir) \
|
||||||
|
-DCMAKE_BINARY_DIR=$(CMAKE_BUILD_DIR) \
|
||||||
-DCMAKE_INSTALL_PREFIX=$(INT_DIR) \
|
-DCMAKE_INSTALL_PREFIX=$(INT_DIR) \
|
||||||
-DBUILD_TESTING=OFF \
|
-DBUILD_TESTING=OFF \
|
||||||
-DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
|
-DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
|
||||||
@@ -31,34 +34,36 @@ all: extension
|
|||||||
.PHONY: all extension
|
.PHONY: all extension
|
||||||
|
|
||||||
# configure for static aws-crt-ffi.a
|
# configure for static aws-crt-ffi.a
|
||||||
build/aws-crt-ffi-static/CMakeCache.txt:
|
$(CMAKE_BUILD_DIR)/aws-crt-ffi-static/CMakeCache.txt:
|
||||||
$(CMAKE_CONFIGURE) -Hcrt/aws-crt-ffi -Bbuild/aws-crt-ffi-static -DBUILD_SHARED_LIBS=OFF
|
$(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 static libaws-crt-ffi.a
|
||||||
build/aws-crt-ffi-static/libaws-crt-ffi.a: build/aws-crt-ffi-static/CMakeCache.txt
|
$(CMAKE_BUILD_DIR)/aws-crt-ffi-static/libaws-crt-ffi.a: $(CMAKE_BUILD_DIR)/aws-crt-ffi-static/CMakeCache.txt
|
||||||
$(CMAKE_BUILD) build/aws-crt-ffi-static $(CMAKE_TARGET)
|
$(CMAKE_BUILD) $(CMAKE_BUILD_DIR)/aws-crt-ffi-static $(CMAKE_TARGET)
|
||||||
|
|
||||||
# PHP extension 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
|
# 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)
|
ifeq ($(GENERATE_STUBS),1)
|
||||||
# install awscrt.stub.php to ext/
|
|
||||||
cp -v awscrt.stub.php ext/awscrt.stub.php
|
|
||||||
# generate awscrt_arginfo.h
|
# 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
|
endif
|
||||||
|
|
||||||
# transform/install api.h from FFI lib
|
# transform/install api.h from FFI lib
|
||||||
ext/api.h : crt/aws-crt-ffi/src/api.h
|
$(srcdir)/ext/api.h: $(srcdir)/crt/aws-crt-ffi/src/api.h
|
||||||
php gen_api.php crt/aws-crt-ffi/src/api.h > ext/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:
|
vendor/bin/phpunit:
|
||||||
composer update
|
composer update
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@
|
|||||||
"ext-awscrt": "Make sure you install awscrt native extension to use any of the functionality."
|
"ext-awscrt": "Make sure you install awscrt native extension to use any of the functionality."
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "./dev-scripts/run_tests",
|
"test": "./dev-scripts/run_tests.sh",
|
||||||
"test-extension": "@test",
|
"test-extension": "@test",
|
||||||
"test-win": ".\\dev-scripts\\run_tests.bat"
|
"test-win": ".\\dev-scripts\\run_tests.bat"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ DIRS_TO_REMOVE = [
|
|||||||
'.deps',
|
'.deps',
|
||||||
'.libs',
|
'.libs',
|
||||||
'build',
|
'build',
|
||||||
|
'cmake_build',
|
||||||
'include',
|
'include',
|
||||||
'modules',
|
'modules',
|
||||||
'vendor',
|
'vendor',
|
||||||
@@ -38,9 +39,8 @@ FILES_TO_REMOVE = [
|
|||||||
'mkinstalldirs',
|
'mkinstalldirs',
|
||||||
'run-tests.php',
|
'run-tests.php',
|
||||||
'awscrt.la',
|
'awscrt.la',
|
||||||
'awscrt.dep',
|
'ext/awscrt.dep',
|
||||||
'composer.lock',
|
'composer.lock',
|
||||||
'ext/awscrt.stub.php',
|
|
||||||
'acinclude.m4',
|
'acinclude.m4',
|
||||||
'aclocal.m4',
|
'aclocal.m4',
|
||||||
'**/*.lo',
|
'**/*.lo',
|
||||||
|
|||||||
@@ -37,13 +37,10 @@ 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_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_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|^\..*)"
|
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|^\..*)"
|
||||||
|
|
||||||
|
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|^\..*)"
|
||||||
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')
|
output_file_name = os.path.join(work_dir, 'package.xml')
|
||||||
|
|
||||||
@@ -54,9 +51,7 @@ def process_file(file_name, f):
|
|||||||
return
|
return
|
||||||
f.write(f'<file name="{file_name}" role="')
|
f.write(f'<file name="{file_name}" role="')
|
||||||
# Special cases
|
# Special cases
|
||||||
if re.match(special_scripts, file_name):
|
if re.match(special_docs, file_name):
|
||||||
f.write('script')
|
|
||||||
elif re.match(special_docs, file_name):
|
|
||||||
f.write('doc')
|
f.write('doc')
|
||||||
elif re.match(special_tests, file_name):
|
elif re.match(special_tests, file_name):
|
||||||
f.write('test')
|
f.write('test')
|
||||||
|
|||||||
@@ -3,6 +3,11 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
# get the github tag without the leading 'v'
|
||||||
|
git_tag = subprocess.run(
|
||||||
|
["git", "describe", "--tags", "--abbrev=0"], capture_output=True).stdout.decode('utf-8').strip()[1:]
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='PECL Package generator')
|
parser = argparse.ArgumentParser(description='PECL Package generator')
|
||||||
@@ -12,7 +17,7 @@ parser.add_argument(
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--email", help="Email address of the package maintainer", default='[email protected]')
|
"--email", help="Email address of the package maintainer", default='[email protected]')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--version", help="Version number of the package", required=True)
|
"--version", help="Version number of the package", default=git_tag)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--notes", help="Release notes for the package", default='New release')
|
"--notes", help="Release notes for the package", default='New release')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@@ -27,6 +32,9 @@ NOTES = args.notes
|
|||||||
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
WORK_DIR = os.path.join(TOOLS_DIR, '..')
|
WORK_DIR = os.path.join(TOOLS_DIR, '..')
|
||||||
|
|
||||||
|
print(f'using version: {VERSION}')
|
||||||
|
print(f'using notes: {NOTES}')
|
||||||
|
|
||||||
|
|
||||||
def run(args):
|
def run(args):
|
||||||
print(f"$ {subprocess.list2cmdline(args)}")
|
print(f"$ {subprocess.list2cmdline(args)}")
|
||||||
@@ -39,6 +47,17 @@ os.chdir(WORK_DIR)
|
|||||||
|
|
||||||
run(['git', 'submodule', 'update', '--init', '--recursive'])
|
run(['git', 'submodule', 'update', '--init', '--recursive'])
|
||||||
|
|
||||||
|
# replace the version number in the ext/crt.c file
|
||||||
|
data = ""
|
||||||
|
with open("ext/crt.c", "r") as c_file:
|
||||||
|
for line in c_file:
|
||||||
|
line = re.sub("#define CRT_VERSION .*",
|
||||||
|
f"#define CRT_VERSION \"{VERSION}\"", line)
|
||||||
|
data += line
|
||||||
|
with open("ext/crt.c", "w") as c_file:
|
||||||
|
c_file.write(data)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
run(['python3', f'{TOOLS_DIR}/prepare_pecl_package_xml.py', '--name', NAME, '--user', USER,
|
run(['python3', f'{TOOLS_DIR}/prepare_pecl_package_xml.py', '--name', NAME, '--user', USER,
|
||||||
'--email', EMAIL, '--version', VERSION, '--notes', NOTES])
|
'--email', EMAIL, '--version', VERSION, '--notes', NOTES])
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
*.so
|
*.so
|
||||||
api.h
|
api.h
|
||||||
awscrt.stub.php
|
|
||||||
|
|||||||
@@ -263,6 +263,8 @@ static PHP_GINIT_FUNCTION(awscrt) {
|
|||||||
awscrt_globals->log_level = 0;
|
awscrt_globals->log_level = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CRT_VERSION "1.0.4"
|
||||||
|
|
||||||
zend_module_entry awscrt_module_entry = {
|
zend_module_entry awscrt_module_entry = {
|
||||||
STANDARD_MODULE_HEADER,
|
STANDARD_MODULE_HEADER,
|
||||||
"awscrt",
|
"awscrt",
|
||||||
@@ -272,7 +274,7 @@ zend_module_entry awscrt_module_entry = {
|
|||||||
NULL, /* RINIT */
|
NULL, /* RINIT */
|
||||||
NULL, /* RSHUTDOWN */
|
NULL, /* RSHUTDOWN */
|
||||||
NULL, /* MINFO */
|
NULL, /* MINFO */
|
||||||
NO_VERSION_YET,
|
CRT_VERSION,
|
||||||
PHP_MODULE_GLOBALS(awscrt),
|
PHP_MODULE_GLOBALS(awscrt),
|
||||||
PHP_GINIT(awscrt),
|
PHP_GINIT(awscrt),
|
||||||
NULL, /* GSHUTDOWN */
|
NULL, /* GSHUTDOWN */
|
||||||
|
|||||||
Reference in New Issue
Block a user