mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 11:48:08 +08:00
105 lines
3.6 KiB
YAML
105 lines
3.6 KiB
YAML
name: Test for Hyperf Components
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
schedule:
|
|
- cron: '0 10 * * *'
|
|
|
|
jobs:
|
|
database:
|
|
name: Test for Database
|
|
runs-on: 'ubuntu-latest'
|
|
strategy:
|
|
matrix:
|
|
php-version: [ '7.3', '7.4', '8.0' ]
|
|
mysql-version: [ '5.7', '8.0' ]
|
|
max-parallel: 6
|
|
fail-fast: false
|
|
env:
|
|
SW_VERSION: 'v4.6.7'
|
|
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=1
|
|
coverage: none
|
|
- name: Setup Swoole
|
|
run: |
|
|
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-http2 --enable-swoole-curl --enable-swoole-json
|
|
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: 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
|
|
sleep 20
|
|
- name: Setup Mysql
|
|
run: export TRAVIS_BUILD_DIR=$(pwd) && bash ./.travis/setup.mysql.sh
|
|
- name: Run Test Cases
|
|
run: |
|
|
composer test src/database -- --exclude-group NonCoroutine
|
|
vendor/bin/phpunit src/database --group NonCoroutine
|
|
phar:
|
|
name: Test for Building PHAR ${{ matrix.no-dev }}
|
|
runs-on: 'ubuntu-latest'
|
|
strategy:
|
|
matrix:
|
|
no-dev: [ '', '--no-dev' ]
|
|
max-parallel: 2
|
|
env:
|
|
SW_VERSION: '4.6.6'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '7.4'
|
|
tools: phpize
|
|
extensions: redis
|
|
ini-values: extension=swoole, opcache.enable_cli=1, swoole.use_shortname='Off', phar.readonly='Off'
|
|
coverage: none
|
|
- name: Setup Swoole
|
|
run: ./.travis/swoole.install.sh
|
|
- name: Build phar tester
|
|
run: |
|
|
git clone https://github.com/limingxinleo/hyperf-phar-tester.git
|
|
cd hyperf-phar-tester
|
|
git checkout 2.2
|
|
composer update -o ${{ matrix.no-dev }}
|
|
rm -rf vendor/hyperf/phar
|
|
cp -rf ../src/phar vendor/hyperf/phar
|
|
composer dump-autoload -o
|
|
- name: Test
|
|
run: |
|
|
cd hyperf-phar-tester
|
|
php bin/hyperf.php phar:build --name no_env.phar
|
|
php no_env.phar show:name -N null
|
|
cp .env.example .env
|
|
php bin/hyperf.php phar:build --name default_env.phar
|
|
php default_env.phar show:name -N hyperf-phar-tester
|
|
php bin/hyperf.php phar:build --name link_env.phar -M .env.link:.env
|
|
echo APP_NAME=helloworld > .env.link
|
|
php link_env.phar show:name -N helloworld
|
|
sudo chmod u+x link_env.phar
|
|
./link_env.phar show:name -N helloworld
|
|
|