hyperf/.github/workflows/test.yml
李铭昕 cbff13f0d8
Added running channel to make sure all crontab tasks handled successfully. (#5563)
Co-authored-by: assert <zhangchengming@kkguan.com>
2023-03-23 21:48:38 +08:00

73 lines
2.5 KiB
YAML

name: PHPUnit for Hyperf
on:
push:
pull_request:
schedule:
- cron: '0 2 * * *'
jobs:
ci:
name: Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }}
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os: [ ubuntu-latest ]
php-version: [ '8.0', '8.1', '8.2' ]
sw-version: [ 'v4.8.12', 'v5.0.2', 'master' ]
exclude:
- php-version: '8.2'
sw-version: 'v4.8.12'
max-parallel: 12
fail-fast: false
env:
SW_VERSION: ${{ matrix.sw-version }}
MYSQL_VERSION: '5.7'
PGSQL_VERSION: '14'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: phpize
extensions: redis, pdo, pdo_mysql, bcmath
ini-values: opcache.enable_cli=0
coverage: none
- name: Setup Swoole
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev libc-ares-dev libpq-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
if [ _${{ matrix.sw-version }} = '_v5.0.2' ] || [ _${{ matrix.sw-version }} = '_master' ]
then
./configure --enable-openssl --enable-swoole-curl --enable-cares --enable-swoole-pgsql --enable-brotli
else
./configure --enable-openssl --enable-http2 --enable-swoole-curl --enable-swoole-json
fi
make -j$(nproc)
sudo make install
sudo sh -c "echo extension=swoole > /etc/php/${{ matrix.php-version }}/cli/conf.d/swoole.ini"
sudo sh -c "echo swoole.use_shortname='Off' >> /etc/php/${{ matrix.php-version }}/cli/conf.d/swoole.ini"
php --ri swoole
- name: Setup Packages
run: ./.travis/requirement.install.sh
- name: Run Check
run: ./.travis/run.check.sh
- name: Setup Services
run: ./.travis/setup.services.sh
- name: Setup Mysql
run: export TRAVIS_BUILD_DIR=$(pwd) && bash ./.travis/setup.mysql.sh
- name: Setup PostgreSQL
run: export TRAVIS_BUILD_DIR=$(pwd) && bash ./.travis/setup.pgsql.sh
- name: Run Scripts Before Test
run: cp .travis/.env.example .env
- name: Run Test Cases
run: ./.travis/run.test.sh