Skip to content

Swoole Engine Test #1728

Swoole Engine Test

Swoole Engine Test #1728

Workflow file for this run

name: Swoole Engine Test
on:
push:
pull_request:
schedule:
- cron: '0 3 * * *'
jobs:
ci:
name: Test on PHP ${{ matrix.php-version }} Swoole ${{ matrix.swoole-version }}
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os: [ ubuntu-latest ]
php-version: [ '8.1', '8.2', '8.3' ]
swoole-version: [ 'v5.0.3', 'v5.1.6', 'v6.0.0', 'master' ]
exclude:
- php-version: '8.3'
swoole-version: 'v5.0.3'
max-parallel: 16
fail-fast: false
env:
SW_VERSION: ${{ matrix.swoole-version }}
COMPOSER_ROOT_VERSION: 'v2.0.0'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: phpize
coverage: none
- name: Build Swoole
run: |
cd /tmp
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
wget https://github.com/swoole/swoole-src/archive/${SW_VERSION}.tar.gz -O swoole.tar.gz
mkdir -p swoole
tar -xf swoole.tar.gz -C swoole --strip-components=1
rm swoole.tar.gz
cd swoole
phpize
./configure --enable-openssl --enable-swoole-curl
make -j$(nproc)
sudo make install
sudo sh -c "echo extension=swoole > /etc/php/${{ matrix.php-version }}/cli/conf.d/swoole.ini"
php --ri swoole
- name: Setup Packages
run: composer install -o
- name: Build Docker
run: |
if [ v${{ matrix.php-version }} = 'v8.3' ]
then
docker build . -t swoole:latest --build-arg PHP_VERSION=${{ matrix.php-version }} --build-arg ALPINE_VERSION=vedge
else
docker build . -t swoole:latest --build-arg PHP_VERSION=${{ matrix.php-version }} --build-arg ALPINE_VERSION=v3.18
fi
- name: Run Server
run: |
docker run --entrypoint php -p 9501:9501 -d swoole:latest examples/http_server.php
docker run --entrypoint php -p 9502:9502 -d swoole:latest examples/tcp_packet_server.php
docker run --entrypoint php -p 9503:9503 -d swoole:latest examples/websocket_server.php
docker run --entrypoint php -p 9505:9505 -d swoole:latest examples/http_server_v2.php
- name: Run Test Cases
run: |
vendor/bin/php-cs-fixer fix --dry-run
composer analyse
composer test