清理代码 #3422
Workflow file for this run
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: | |
jobs: | |
ci: | |
name: Linux Swoole-${{ matrix.swoole.version }} RoadRunner-${{ matrix.roadrunner }} | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
swoole: | |
- version: 5.0-php8.2 | |
postgresql_version: "" | |
- version: 5.0-php8.1 | |
postgresql_version: "" | |
- version: 5.0-php8.0 | |
postgresql_version: "" | |
- version: 4.8-php8.1 | |
postgresql_version: "" | |
- version: 4.8-php8.0 | |
postgresql_version: "v4.8.0" | |
- version: 4.8-php7.4 | |
postgresql_version: "v4.8.0" | |
roadrunner: [2.7.*] | |
env: | |
ENV_SERVICE: swoole | |
POSTGRESQL_VERSION: ${{ matrix.swoole.postgresql_version }} | |
SWOOLE_DOCKER_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@v2 | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/composer | |
key: ${{ runner.os }}-composer-${{ matrix.swoole.version }}-${{ hashFiles('/composer.json') }} | |
- name: Prepare | |
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 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: 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-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
swoole: | |
- version: 4.8-php8.0 | |
postgresql_version: f5eda17f89d160d0a89ac7c5db4636bdaefd48e6 | |
roadrunner: [2.7.*] | |
env: | |
ENV_SERVICE: swoole | |
POSTGRESQL_VERSION: ${{ matrix.swoole.postgresql_version }} | |
SWOOLE_DOCKER_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@v2 | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/composer | |
key: ${{ runner.os }}-composer-${{ matrix.swoole.version }}-${{ hashFiles('/composer.json') }} | |
- name: Prepare | |
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 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: 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-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
swoole-cli: [v5.0.3, v4.8.11] | |
env: | |
MYSQL_DOCKER_VERSION: "8.0" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- 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@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ matrix.swoole-cli }}-${{ hashFiles('/composer.json') }} | |
- name: Prepare | |
run: | | |
composer update --prefer-dist --no-progress | |
.github/prepare-kafka.sh | |
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 "test_prepared=1" >> $GITHUB_ENV | |
- name: Test | |
if: ${{ env.test_prepared && always() }} | |
run: composer test | |
- 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: 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: ["7.4", "8.0", "8.1", "8.2"] | |
swoole: [v5.0.3, v4.8.13] | |
roadrunner: [2.7.*] | |
exclude: | |
- php: 7.4 | |
swoole: v5.0.3 | |
- php: 8.2 | |
swoole: v4.8.13 | |
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@v2 | |
- 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" | |
- 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@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ env.php-versions }}-${{ hashFiles('/composer.json') }} | |
- name: Prepare | |
run: | | |
mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS db_imi_test;' | |
composer update --prefer-dist --no-progress | |
tests/db/install-db.sh | |
- 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 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: Print logs | |
if: failure() | |
run: php .github/print-logs.php | |
ci-windows: | |
name: Windows PHP-${{ matrix.php.version }} RoadRunner-${{ matrix.roadrunner }} | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php: | |
- version: "7.4" | |
extensions: "apcu, bcmath, curl, openssl, mbstring, intl, json, redis, mysqli, pdo, pdo_mysql, sockets, :opcache" | |
- version: "8.0" | |
extensions: "apcu, bcmath, curl, openssl, mbstring, intl, json, redis, mysqli, pdo, pdo_mysql, sockets, :opcache" | |
- version: "8.1" | |
extensions: "apcu, bcmath, curl, openssl, mbstring, intl, json, redis, mysqli, pdo, pdo_mysql, sockets, :opcache" | |
- version: "8.2" | |
extensions: "bcmath, curl, openssl, mbstring, intl, json, mysqli, pdo, pdo_mysql, sockets, :opcache" | |
roadrunner: [2.7.*] | |
env: | |
IMI_ROADRUNNER_BINARY: ${{ github.workspace }}\rr.exe | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ROADRUNNER_DOCKER_VERSION: ${{ matrix.roadrunner }} | |
steps: | |
- uses: actions/checkout@v2 | |
- 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.version }} | |
ini-values: session.save_path=C:\temp | |
tools: pecl | |
extensions: ${{ matrix.php.extensions }} | |
env: | |
fail-fast: true | |
- name: Install Custom PHP Extension | |
if: ${{ matrix.php.version >= 8.2 }} | |
run: | | |
git clone https://github.com/imiphp/php-extensions-binary.git C:\php-extensions-binary | |
cp C:\php-extensions-binary\apcu\windows-${{ matrix.php.version }}-x64-nts\php_apcu.dll C:\tools\php\ext\ | |
cp C:\php-extensions-binary\redis\windows-${{ matrix.php.version }}-x64-nts\php_redis.dll C:\tools\php\ext\ | |
echo extension=php_apcu.dll >> C:\tools\php\php.ini | |
echo extension=php_redis.dll >> C:\tools\php\php.ini | |
- name: Prepare | |
run: | | |
mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS db_imi_test;' | |
composer update --prefer-dist --no-progress | |
php src\Cli\bin\imi-cli generate/table --app-namespace "Imi\Test\Component" | |
- 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 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: Print logs | |
if: failure() | |
run: php .github\print-logs.php |