Skip to content

fix

fix #1291

Workflow file for this run

name: Frameworks Tests
on:
push:
pull_request:
jobs:
linux:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[test]')"
strategy:
fail-fast: false
matrix:
php-version: [ '8.0', '8.1', '8.2' ]
framework: [ 'Laravel Octane', 'Hyperf', 'Simps', 'imi' ]
name: ${{ matrix.framework }} - PHP ${{ matrix.php-version }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: dom, curl, libxml, mbstring, zip, redis, pdo, pdo_mysql, bcmath
tools: phpize, composer:v2
ini-values: extension=swoole
coverage: none
- name: Build Swoole
run: |
sudo apt update -y && sudo apt install -y libcurl4-openssl-dev php-curl libc-ares-dev libpq-dev valgrind
phpize
./configure --enable-openssl --enable-mysqlnd --enable-swoole-curl --enable-cares --enable-swoole-pgsql
make -j$(nproc)
sudo make install
php -v
php -m
php --ini
php --ri swoole
- name: Laravel Octane Tests
if: matrix.framework == 'Laravel Octane' && matrix.php-version != '8.0'
run: |
git clone https://github.com/laravel/octane.git --depth=1
cd octane/
composer update --prefer-dist --no-interaction --no-progress
vendor/bin/phpunit
- name: Hyperf Tests
if: matrix.framework == 'Hyperf'
env:
SW_VERSION: 'master'
MYSQL_VERSION: '5.7'
PGSQL_VERSION: '14'
run: |
git clone https://github.com/hyperf/hyperf.git --depth=1
cd hyperf/
composer update -o
./.travis/requirement.install.sh
./.travis/setup.services.sh
export TRAVIS_BUILD_DIR=$(pwd) && bash ./.travis/setup.mysql.sh
export TRAVIS_BUILD_DIR=$(pwd) && bash ./.travis/setup.pgsql.sh
cp .travis/.env.example .env
export SWOOLE_BRANCH=${GITHUB_REF##*/}
if [ "${SWOOLE_BRANCH}" = "valgrind" ]; then
USE_ZEND_ALLOC=0 valgrind php -dswoole.use_shortname='Off' bin/co-phpunit --exclude-group NonCoroutine
USE_ZEND_ALLOC=0 valgrind php -dswoole.use_shortname='Off' vendor/bin/phpunit --group NonCoroutine
USE_ZEND_ALLOC=0 valgrind php -dswoole.use_shortname='Off' vendor/bin/phpunit src/filesystem --group NonCoroutine
else
.travis/run.test.sh
fi
- name: Simps Tests
if: matrix.framework == 'Simps'
run: |
git clone https://github.com/simps/mqtt.git --depth=1
cd mqtt/
composer install -o
composer test
- name: imi Tests
if: matrix.framework == 'imi'
env:
SW_VERSION: 'master'
MYSQL_VERSION: '5.7'
MYSQL_SERVER_PASSWORD:
run: |
git clone -b 2.1 https://github.com/imiphp/imi.git --depth=1
cd imi/
composer update -o
docker run --name mysql -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mysql:${MYSQL_VERSION} --bind-address=0.0.0.0 --default-authentication-plugin=mysql_native_password
docker run --name redis -p 6379:6379 -d redis
docker run -d --restart=always --name rabbitmq -p 4369:4369 -p 5672:5672 -p 15672:15672 -p 25672:25672 rabbitmq:management-alpine
mysql -h 127.0.0.1 -u root -e "CREATE DATABASE IF NOT EXISTS db_imi_test charset=utf8mb4 collate=utf8mb4_unicode_ci;"
./tests/db/install-db.sh
composer test-swoole
macos:
if: "!contains(github.event.head_commit.message, '[test]')"
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
php-version: [ '8.0', '8.1', '8.2' ]
framework: [ 'Simps' ]
name: ${{ matrix.framework }} - PHP ${{ matrix.php-version }} - macOS
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: dom, curl, libxml, mbstring, zip, redis, pdo, pdo_mysql, bcmath
tools: phpize, composer:v2
ini-values: extension=swoole
coverage: none
- name: Build Swoole
run: |
brew install openssl && brew link openssl
brew install c-ares && brew link c-ares
phpize
./configure --enable-openssl --with-openssl-dir=/usr/local/opt/[email protected] --enable-mysqlnd --enable-swoole-curl --enable-cares
make -j$(sysctl -n hw.ncpu)
sudo make install
php --ri swoole
- name: Simps Tests
if: matrix.framework == 'Simps'
run: |
git clone https://github.com/simps/mqtt.git --depth=1
cd mqtt/
composer install -o
composer test