mirror of
https://github.com/awslabs/aws-crt-php.git
synced 2026-08-18 01:57:13 +00:00
update helper scripts and more
This commit is contained in:
@@ -167,7 +167,7 @@ jobs:
|
|||||||
./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream
|
./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream
|
||||||
|
|
||||||
pecl-package-test:
|
pecl-package-test:
|
||||||
runs-on: macos-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
@@ -179,9 +179,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Run tests
|
- name: Test PECL package build
|
||||||
run: |
|
run: |
|
||||||
./dev-scripts/prepare_release.sh --name aws-crt --user aws-crt --email [email protected] --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
|
tar -zxf *.tgz
|
||||||
cd awscrt-1.0.0
|
cd awscrt-1.0.0
|
||||||
phpize
|
phpize
|
||||||
|
|||||||
@@ -5,55 +5,36 @@ import shutil
|
|||||||
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, '..')
|
||||||
|
|
||||||
# Remove specified directories
|
|
||||||
DIRS_TO_REMOVE = [
|
|
||||||
'.deps',
|
|
||||||
'.libs',
|
|
||||||
'build',
|
|
||||||
'include',
|
|
||||||
'modules',
|
|
||||||
'vendor',
|
|
||||||
'autom4te.cache']
|
|
||||||
|
|
||||||
# Remove specified files
|
def remove_files(files):
|
||||||
FILES_TO_REMOVE = [
|
for file in files:
|
||||||
'Makefile',
|
if os.path.exists(file):
|
||||||
'Makefile.fragments',
|
os.remove(file)
|
||||||
'Makefile.global',
|
|
||||||
'Makefile.objects',
|
|
||||||
'config.guess',
|
|
||||||
'config.h',
|
|
||||||
'config.h.in',
|
|
||||||
'config.log',
|
|
||||||
'config.nice',
|
|
||||||
'config.status',
|
|
||||||
'config.sub',
|
|
||||||
'configure',
|
|
||||||
'configure.in',
|
|
||||||
'configure.ac',
|
|
||||||
'install-sh',
|
|
||||||
'libtool',
|
|
||||||
'ltmain.sh',
|
|
||||||
'missing',
|
|
||||||
'mkinstalldirs',
|
|
||||||
'run-tests.php',
|
|
||||||
'awscrt.la',
|
|
||||||
'composer.lock',
|
|
||||||
'ext/awscrt.stub.php',
|
|
||||||
'acinclude.m4',
|
|
||||||
'aclocal.m4',
|
|
||||||
'**/*.lo',
|
|
||||||
'**/*.o',
|
|
||||||
'**/*.la',
|
|
||||||
'**/*.a',
|
|
||||||
'*.tgz']
|
|
||||||
|
|
||||||
os.chdir(WORK_DIR)
|
os.chdir(WORK_DIR)
|
||||||
|
|
||||||
|
# Remove specified directories
|
||||||
for directory in DIRS_TO_REMOVE:
|
dirs_to_remove = ['.deps', '.libs', 'build', 'include', 'modules', 'vendor']
|
||||||
|
for directory in dirs_to_remove:
|
||||||
shutil.rmtree(directory, ignore_errors=True)
|
shutil.rmtree(directory, ignore_errors=True)
|
||||||
|
|
||||||
for pattern in FILES_TO_REMOVE:
|
# Remove specified files
|
||||||
for filepath in glob.glob(pattern):
|
files_to_remove = ['Makefile', 'Makefile.fragments', 'Makefile.global', 'Makefile.objects',
|
||||||
os.remove(filepath)
|
'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)
|
||||||
|
|||||||
@@ -84,6 +84,18 @@ def process_dir(dir_name, f):
|
|||||||
return
|
return
|
||||||
|
|
||||||
f.write(f'<dir name="{dir_name}">\n')
|
f.write(f'<dir name="{dir_name}">\n')
|
||||||
|
|
||||||
|
if dir_name == 'tests' and os.path.isdir('tests'):
|
||||||
|
f.write('<dir name="tests">\n')
|
||||||
|
f.write('<dir name="features">\n')
|
||||||
|
os.chdir('tests/features')
|
||||||
|
for file_name in os.listdir():
|
||||||
|
process_file(file_name)
|
||||||
|
os.chdir('../..')
|
||||||
|
f.write('</dir>\n')
|
||||||
|
f.write('</dir>\n')
|
||||||
|
|
||||||
|
else:
|
||||||
os.chdir(dir_name)
|
os.chdir(dir_name)
|
||||||
for file_name in os.listdir():
|
for file_name in os.listdir():
|
||||||
if os.path.isfile(file_name):
|
if os.path.isfile(file_name):
|
||||||
@@ -91,18 +103,7 @@ def process_dir(dir_name, f):
|
|||||||
else:
|
else:
|
||||||
process_dir(file_name, f)
|
process_dir(file_name, f)
|
||||||
|
|
||||||
# Special cases for compiler features placed in tests directories in and s2n
|
f.write('</dir>\n')
|
||||||
if dir_name == 's2n' and os.path.isdir('tests'):
|
|
||||||
f.write('<dir name="tests">')
|
|
||||||
f.write('<dir name="features">')
|
|
||||||
os.chdir('tests/features')
|
|
||||||
for a in os.listdir():
|
|
||||||
process_file(a, f)
|
|
||||||
os.chdir('../..')
|
|
||||||
f.write('</dir>')
|
|
||||||
f.write('</dir>')
|
|
||||||
|
|
||||||
f.write('</dir>')
|
|
||||||
os.chdir('..')
|
os.chdir('..')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import xml.dom.minidom
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='PECL Package generator')
|
parser = argparse.ArgumentParser(description='PECL Package generator')
|
||||||
@@ -27,32 +25,23 @@ 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, '..')
|
||||||
|
|
||||||
|
subprocess.run(['python3', f'{TOOLS_DIR}/cleanup_build.py'], check=True)
|
||||||
def run(args):
|
|
||||||
print(f"$ {subprocess.list2cmdline(args)}")
|
|
||||||
subprocess.check_call(args)
|
|
||||||
|
|
||||||
|
|
||||||
run(['python3', f'{TOOLS_DIR}/cleanup_build.py'])
|
|
||||||
|
|
||||||
os.chdir(WORK_DIR)
|
os.chdir(WORK_DIR)
|
||||||
|
|
||||||
run(['git', 'submodule', 'update', '--init', '--recursive'])
|
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:
|
try:
|
||||||
run(['python3', f'{TOOLS_DIR}/prepare_pecl_package_xml.py', '--name', NAME, '--user', USER,
|
|
||||||
'--email', EMAIL, '--version', VERSION, '--notes', NOTES])
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
sys.exit(f'ERROR PROCESSING review package.xml: {e}')
|
|
||||||
|
|
||||||
with open('package.xml', 'r') as f:
|
with open('package.xml', 'r') as f:
|
||||||
package_xml = f.read()
|
package_xml = f.read()
|
||||||
doc = xml.dom.minidom.parse('package.xml')
|
subprocess.run(['tidy', '-xml', '-m', '-i', 'package.xml'], check=True)
|
||||||
doc.encoding = 'UTF-8'
|
subprocess.run(['pear', 'package-validate'], check=True)
|
||||||
xml_str = doc.toprettyxml(indent=' ', newl='')
|
subprocess.run(['pear', 'package'], check=True)
|
||||||
with open('package.xml', 'w') as f:
|
except subprocess.CalledProcessError as e:
|
||||||
f.write(xml_str)
|
print(f'ERROR PROCESSING review package.xml: {e}')
|
||||||
run(['pear', 'package-validate'])
|
exit(1)
|
||||||
run(['pear', 'package'])
|
|
||||||
|
|
||||||
print(f'Size of {PACKAGE}-{VERSION}.tgz: {os.path.getsize(f"{PACKAGE}-{VERSION}.tgz") / 1024 / 1024:.2f} MB')
|
print(f'Size of {PACKAGE}-{VERSION}.tgz: {os.path.getsize(f"{PACKAGE}-{VERSION}.tgz") / 1024 / 1024:.2f} MB')
|
||||||
|
|||||||
@@ -12,6 +12,20 @@ set "script_dir=%~dp0"
|
|||||||
set "work_dir=%script_dir%/.."
|
set "work_dir=%script_dir%/.."
|
||||||
cd %work_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 %composer_dir% update
|
||||||
call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug
|
call %PHP_BINARY% -c php-win.ini vendor/bin/phpunit tests --debug
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
Reference in New Issue
Block a user