hyperf/.github/workflows/test.yml
李铭昕 4b78aeaaaf
Don't retry, when recv timeout for json-rpc client. (#3195)
* Don't retry, when recv timeout for json-rpc client.
2021-01-25 11:48:00 +08:00

67 lines
2.6 KiB
YAML

name: PHPUnit for Hyperf
on: [ push, pull_request ]
jobs:
ci:
name: Test on PHP${{ matrix.php-version }} SW${{ matrix.sw-version }} MySQL${{ matrix.mysql-version }}
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os: [ ubuntu-latest ]
php-version: [ '7.3', '7.4' ]
mysql-version: [ '5.7', '8.0' ]
sw-version: [ '4.5.10', '4.6.0' ]
max-parallel: 8
env:
SW_VERSION: ${{ matrix.sw-version }}
YASD_VERSION: 'v0.3.5'
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
ini-values: extension=swoole, opcache.enable_cli=1
coverage: none
- name: Setup Swoole
run: ./.travis/swoole.install.sh
- name: Setup Yasd
run: |
sudo apt-get install libboost-all-dev
wget https://github.com/swoole/yasd/archive/${YASD_VERSION}.tar.gz -O yasd.tar.gz
mkdir -p yasd
tar -xf yasd.tar.gz -C yasd --strip-components=1
rm yasd.tar.gz
cd yasd
phpize
./configure
make -j$(nproc)
sudo make install
sudo sh -c "echo extension=yasd > /etc/php/${{ matrix.php-version }}/cli/conf.d/yasd.ini"
php --ri yasd
- name: Setup Packages
run: composer update -o
- name: Setup Services
run: |
docker run --name mysql -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mysql:${{ matrix.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 --name dev-consul -e CONSUL_BIND_INTERFACE=eth0 -p 8500:8500 consul
docker run --name nsq -p 4150:4150 -p 4151:4151 -p 4160:4160 -p 4161:4161 -p 4170:4170 -p 4171:4171 --entrypoint /bin/nsqd -d nsqio/nsq:latest
docker build --tag grpc-server:latest src/grpc-client/tests/Mock
docker run -d --name grpc-server -p 50051:50051 grpc-server:latest
docker build -t tcp-server:latest .travis/tcp_server
docker run -d --name tcp-server -p 10001:10001 tcp-server:latest
- name: Setup Mysql
run: export TRAVIS_BUILD_DIR=$(pwd) && bash ./.travis/setup.mysql.sh
- name: Run Scripts Before Test
run: cp .travis/.env.example .env
- name: Run Test Cases
run: |
composer analyse src
composer test -- --exclude-group NonCoroutine
vendor/bin/phpunit --group NonCoroutine