Refactoring laravel worker architecture #101
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test-ThinkPHP | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test-unix: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
php: [ '8.1', '8.2', '8.3' ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 安装环境 (Setup PHP) | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: posix, sockets, pcntl, openssl, curl, ev, fileinfo, sqlite3 | |
- name: 安装框架 (Install ThinkPHP) | |
run: | | |
composer install | |
composer create-project topthink/think thinkphp-app | |
- name: 安装引擎 (Initialize ripple) | |
working-directory: thinkphp-app | |
run: | | |
composer require cloudtay/ripple-driver | |
cp -r ../src vendor/cloudtay/ripple-driver/ | |
- name: 初始化测试路由 (Initialize Test Route) | |
working-directory: thinkphp-app | |
run: | | |
echo "RIP_HTTP_WORKERS=1" >> .env | |
cp ./vendor/cloudtay/ripple-driver/src/ThinkPHP/Tests/routes-test.php route/test.php | |
- name: 启动引擎服务 (Start Server) | |
working-directory: thinkphp-app | |
run: | | |
php think ripple:server start & | |
sleep 1 | |
- name: 压力测试 (Run Stress testing) | |
working-directory: thinkphp-app | |
run: | | |
ab -n 1000 -c 20 -k http://127.0.0.1:8008/ | |
- name: 内存泄漏测试 (Run Memory leak testing) | |
run: ./vendor/bin/phpunit | |
- name: 关闭服务 (Stop Server) | |
working-directory: thinkphp-app | |
run: php think ripple:server stop |