更新 #3055
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: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
ci: | |
name: Linux Swoole-${{ matrix.swoole.version }} RoadRunner-${{ matrix.roadrunner }} | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
swoole: | |
- version: 5.1-php8.2 | |
postgresql_version: "" | |
- version: 5.1-php8.1 | |
postgresql_version: "" | |
- version: 5.0-php8.2 | |
postgresql_version: "" | |
- version: 5.0-php8.1 | |
postgresql_version: "" | |
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@v4 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
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: 5.1-php8.2 | |
postgresql_version: "" | |
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@v4 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
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] | |
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@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ matrix.swoole-cli }}-${{ hashFiles('/composer.json') }} | |
- name: Prepare | |
run: | | |
echo "::group::Composer install" | |
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 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: ["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" | |
- name: Get Openssl Dir | |
id: opecssl-dir | |
run: echo "path=$(brew --prefix [email protected])" >> $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@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ env.php-versions }}-${{ hashFiles('/composer.json') }} | |
- 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 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 }} 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: 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\Test\Component" | |
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 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 |