重构 Model Meta 的注解管理 (#701) #12
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: ci | |
on: | |
push: | |
paths-ignore: | |
- "doc/**" | |
- "mddoc/**" | |
- "res/**" | |
- "split-repository/**" | |
- "website/**" | |
- ".markdownlint.json" | |
- "README.md" | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
ci-linux: | |
name: Linux Swoole-${{ matrix.swoole.version }} RoadRunner-${{ matrix.roadrunner }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
swoole: | |
- version: php8.2-swoole-5.1 | |
- version: php8.1-swoole-5.1 | |
- version: php8.2-swoole-5.0 | |
- version: php8.1-swoole-5.0 | |
roadrunner: [2.7.*] | |
env: | |
ENV_SERVICE: swoole | |
REPOSITORY_OWNER: ${{ github.repository_owner }} | |
IMAGE_VERSION: ${{ matrix.swoole.version }} | |
MYSQL_DOCKER_VERSION: "8.0" | |
REDIS_SERVER_HOST: redis | |
ROADRUNNER_DOCKER_VERSION: ${{ matrix.roadrunner }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare1 | |
run: | | |
echo "REPOSITORY_OWNER=${REPOSITORY_OWNER,,}" >>${GITHUB_ENV} | |
mkdir -p /tmp/base_cache/composer | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/base_cache/composer | |
key: ${{ runner.os }}-composer-${{ env.IMAGE_VERSION }}-${{ hashFiles('*/composer.json', 'src/Components/*/composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-composer-${{ env.IMAGE_VERSION }}- | |
${{ runner.os }}-composer- | |
- name: Prepare2 | |
uses: ./.github/actions/ci-prepare | |
with: | |
env: ${{ env.ENV_SERVICE }} | |
- name: Test | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test | |
- name: Test connection-center | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-connection-center | |
- name: Test database | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-database | |
- name: Test swoole | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-swoole | |
- name: Test workerman | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-workerman | |
- name: Test workerman-gateway | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-workerman-gateway | |
- name: Test roadrunner | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-roadrunner | |
- name: Test fpm | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-fpm | |
- name: Test jwt | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-jwt | |
- name: Test queue | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-queue | |
- name: Test amqp | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-amqp | |
- name: Test kafka | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-kafka | |
- name: Test grpc | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-grpc | |
- name: Test snowflake | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-snowflake | |
- name: Test mqtt | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-mqtt | |
- name: Test smarty | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-smarty | |
- name: Test pgsql | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-pgsql | |
- name: Test phar | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-phar | |
- name: Test model | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-model | |
- name: Print logs | |
if: failure() | |
run: docker exec ${ENV_SERVICE} php .github/print-logs.php | |
ci-unix: | |
name: Linux Swoole-${{ matrix.swoole.version }} RoadRunner-${{ matrix.roadrunner }} With Redis UnixSocket | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
swoole: | |
- version: php8.2-swoole-5.1 | |
roadrunner: [2.7.*] | |
env: | |
ENV_SERVICE: swoole | |
REPOSITORY_OWNER: ${{ github.repository_owner }} | |
IMAGE_VERSION: ${{ matrix.swoole.version }} | |
MYSQL_DOCKER_VERSION: "8.0" | |
REDIS_SERVER_HOST: /tmp/docker/redis.sock | |
ROADRUNNER_DOCKER_VERSION: ${{ matrix.roadrunner }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare1 | |
run: | | |
echo "REPOSITORY_OWNER=${REPOSITORY_OWNER,,}" >>${GITHUB_ENV} | |
mkdir -p /tmp/base_cache/composer | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/base_cache/composer | |
key: ${{ runner.os }}-composer-${{ env.IMAGE_VERSION }}-${{ hashFiles('*/composer.json', 'src/Components/*/composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-composer-${{ env.IMAGE_VERSION }}- | |
${{ runner.os }}-composer- | |
- name: Prepare2 | |
uses: ./.github/actions/ci-prepare | |
with: | |
env: ${{ env.ENV_SERVICE }} | |
- name: Test | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test | |
- name: Test connection-center | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-connection-center | |
- name: Test database | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-database | |
- name: Test swoole | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-swoole | |
- name: Test workerman | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-workerman | |
- name: Test workerman-gateway | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-workerman-gateway | |
- name: Test roadrunner | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-roadrunner | |
- name: Test fpm | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-fpm | |
- name: Test jwt | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-jwt | |
- name: Test queue | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-queue | |
- name: Test amqp | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-amqp | |
- name: Test kafka | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-kafka | |
- name: Test grpc | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-grpc | |
- name: Test snowflake | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-snowflake | |
- name: Test mqtt | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-mqtt | |
- name: Test smarty | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-smarty | |
- name: Test pgsql | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-pgsql | |
- name: Test model | |
if: ${{ env.test_prepared && always() }} | |
run: docker exec ${ENV_SERVICE} composer test-model | |
- name: Print logs | |
if: failure() | |
run: docker exec ${ENV_SERVICE} php .github/print-logs.php | |
ci-swoole-cli: | |
name: Swoole-cli-${{ matrix.swoole-cli }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
swoole-cli: [v5.0.3] | |
env: | |
MYSQL_DOCKER_VERSION: "8.0" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Services | |
shell: bash | |
run: | | |
sudo apt update && sudo apt install -y rsync | |
docker compose -f ./.github/docker-compose.yml up -d mysql postgres redis rabbitmq kafka1 | |
echo "127.0.0.1 kafka1" | sudo tee -a /etc/hosts | |
- name: Setup swoole-cli | |
run: .github/script/install-swoole-cli.sh ${{ matrix.swoole-cli }} | |
- name: Check Version | |
run: | | |
swoole-cli -v | |
php -v | |
php -m | |
composer -V | |
php --ri swoole | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-swoole-cli-${{ matrix.swoole-cli }}-${{ hashFiles('*/composer.json', 'src/Components/*/composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-composer-swoole-cli-${{ matrix.swoole-cli }}- | |
${{ runner.os }}-composer-swoole-cli- | |
${{ runner.os }}-composer- | |
- name: Prepare | |
run: | | |
echo "::group::Composer install" | |
composer config -g process-timeout 600 | |
composer update --prefer-dist --no-progress | |
echo "::endgroup::" | |
echo "::group::Kafka prepare" | |
.github/prepare-kafka.sh | |
echo "::endgroup::" | |
echo "::group::Table Init" | |
docker exec mysql mysql -uroot -p -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';flush privileges;" | |
tests/db/install-db.sh | |
docker exec postgres psql -d db_imi_test -U root -f /imi/.github/pgsql.sql | |
echo "::endgroup::" | |
echo "test_prepared=1" >> $GITHUB_ENV | |
- name: Test | |
if: ${{ env.test_prepared && always() }} | |
run: composer test | |
- name: Test connection-center | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-connection-center | |
- name: Test database | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-database | |
- name: Test swoole | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-swoole | |
- name: Test workerman | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-workerman | |
- name: Test workerman-gateway | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-workerman-gateway | |
- name: Test jwt | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-jwt | |
- name: Test queue | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-queue | |
- name: Test amqp | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-amqp | |
- name: Test kafka | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-kafka | |
- name: Test grpc | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-grpc | |
- name: Test snowflake | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-snowflake | |
- name: Test mqtt | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-mqtt | |
- name: Test smarty | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-smarty | |
# - name: Test pgsql | |
# if: ${{ matrix.swoole-cli == 'v5.0.3' && env.test_prepared && always() }} | |
# run: composer test-pgsql | |
- name: Test phar | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-phar | |
- name: Test model | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-model | |
- name: Print logs | |
if: failure() | |
run: php .github/print-logs.php | |
ci-macos: | |
name: MacOS PHP-${{ matrix.php }} Swoole-${{ matrix.swoole }} RoadRunner-${{ matrix.roadrunner }} | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ["8.1", "8.2"] | |
swoole: [v5.1.0, v5.0.3] | |
roadrunner: [2.7.*] | |
env: | |
MYSQL_SERVER_PASSWORD: "root" | |
PHP_VERSION: ${{ matrix.php }} | |
IMI_TEST_AMQP_SERVER_UTIL: 0 | |
IMI_ROADRUNNER_BINARY: ${{ github.workspace }}/rr | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ROADRUNNER_DOCKER_VERSION: ${{ matrix.roadrunner }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup MySQL | |
uses: shogo82148/actions-setup-mysql@v1 | |
with: | |
mysql-version: "8.0" | |
root-password: root | |
my-cnf: | | |
socket=/tmp/mysql.sock | |
- name: Setup Redis | |
uses: shogo82148/actions-setup-redis@v1 | |
with: | |
redis-version: "6.x" | |
# MacOS Arm64 下需要下面的修复,否则无法编译成功 | |
- name: Fix include | |
run: | | |
sudo ln -s $(brew --prefix pcre2)/include/pcre2.h /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ | |
- name: Get Openssl Dir | |
id: opecssl-dir | |
run: echo "path=$(brew --prefix openssl@1.1)" >> $GITHUB_OUTPUT | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: pecl | |
extensions: > | |
apcu, bcmath, curl, openssl, mbstring, intl, json, redis, mysqli, pdo, pdo_mysql, sockets, zip, :opcache, | |
swoole-swoole/swoole-src@${{ matrix.swoole }} | |
env: | |
SWOOLE_CONFIGURE_OPTS: > | |
--enable-openssl | |
--with-openssl-dir=${{ steps.opecssl-dir.outputs.path }} | |
--enable-http2 | |
--enable-mysqlnd | |
--enable-swoole-json | |
--enable-swoole-curl | |
- name: Check Version | |
run: | | |
php -v | |
php -m | |
composer -V | |
php --ri swoole | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ env.php-versions }}-${{ hashFiles('*/composer.json', 'src/Components/*/composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-composer-${{ env.php-versions }}- | |
${{ runner.os }}-composer- | |
- name: Prepare | |
run: | | |
echo "::group::Env prepare" | |
mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS db_imi_test;' | |
echo "::endgroup::" | |
echo "::group::Composer install" | |
composer update --prefer-dist --no-progress | |
echo "::endgroup::" | |
echo "::group::Table Init" | |
tests/db/install-db.sh | |
echo "::endgroup::" | |
- name: Install RoadRunner | |
run: | | |
echo no | src/Components/roadrunner/vendor/bin/rr get-binary -f $ROADRUNNER_DOCKER_VERSION | |
./rr -v | |
- name: Prepared | |
run: | | |
echo "test_prepared=1" >> $GITHUB_ENV | |
- name: Test | |
if: ${{ env.test_prepared && always() }} | |
run: composer test | |
- name: Test connection-center | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-connection-center | |
- name: Test database | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-database | |
- name: Test swoole | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-swoole | |
- name: Test workerman | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-workerman | |
- name: Test workerman-gateway | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-workerman-gateway | |
- name: Test roadrunner | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-roadrunner | |
- name: Test fpm | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-fpm | |
- name: Test jwt | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-jwt | |
- name: Test queue | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-queue | |
- name: Test grpc | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-grpc | |
- name: Test snowflake | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-snowflake | |
- name: Test mqtt | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-mqtt | |
- name: Test smarty | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-smarty | |
- name: Test phar | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-phar | |
- name: Test model | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-model | |
- name: Print logs | |
if: failure() | |
run: php .github/print-logs.php | |
ci-windows: | |
name: Windows PHP-${{ matrix.php }} RoadRunner-${{ matrix.roadrunner }} | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ["8.1"] # 部分扩展还未在 pecl 发布 PHP 8.2 Windows 版扩展,所以无法测试 | |
roadrunner: [2.7.*] | |
extensions: | |
[ | |
"apcu, bcmath, curl, openssl, mbstring, intl, json, redis, mysqli, pdo, pdo_mysql, sockets, :opcache", | |
] | |
env: | |
IMI_ROADRUNNER_BINARY: ${{ github.workspace }}\rr.exe | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ROADRUNNER_DOCKER_VERSION: ${{ matrix.roadrunner }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup MySQL | |
uses: shogo82148/actions-setup-mysql@v1 | |
with: | |
mysql-version: "8.0" | |
root-password: root | |
- name: Setup Redis-server | |
run: | | |
nuget install redis-64 -excludeversion | |
redis-64\tools\redis-server.exe --service-install | |
redis-64\tools\redis-server.exe --service-start | |
'@ECHO Redis Started' | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-values: session.save_path=C:\temp | |
tools: pecl | |
extensions: ${{ matrix.extensions }} | |
env: | |
fail-fast: true | |
- name: Get composer cache directory | |
id: composer-cache | |
shell: pwsh | |
run: | | |
Set-Variable -Name CacheDir -Value (composer config cache-files-dir) | |
"dir=$CacheDir" >> $env:GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('*/composer.json', 'src/Components/*/composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-composer-${{ matrix.php }}- | |
${{ runner.os }}-composer- | |
- name: Prepare | |
run: | | |
Write-Output "::group::Env prepare" | |
mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS db_imi_test;' | |
Write-Output "::endgroup::" | |
Write-Output "::group::Composer install" | |
composer update --prefer-dist --no-progress | |
Write-Output "::endgroup::" | |
Write-Output "::group::Table Init" | |
php src\Cli\bin\imi-cli generate/table --app-namespace "Imi\Model\Test" | |
Write-Output "::endgroup::" | |
- name: Install RoadRunner | |
run: | | |
echo no | src\Components\roadrunner\vendor\bin\rr get-binary -f $env:ROADRUNNER_DOCKER_VERSION | |
.\rr -v | |
- name: Prepared | |
run: | | |
echo "test_prepared=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Test | |
if: ${{ env.test_prepared && always() }} | |
run: composer test | |
- name: Test connection-center | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-connection-center-common | |
- name: Test database | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-database | |
- name: Test fpm | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-fpm | |
- name: Test workerman | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-workerman | |
- name: Test workerman-gateway | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-workerman-gateway-w | |
- name: Test roadrunner | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-roadrunner | |
- name: Test jwt | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-jwt | |
- name: Test snowflake | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-snowflake | |
- name: Test model | |
if: ${{ env.test_prepared && always() }} | |
run: composer test-model | |
- name: Print logs | |
if: failure() | |
run: php .github\print-logs.php |