2020-10-27 23:36:09 +08:00
|
|
|
name: PHPUnit for Hyperf
|
|
|
|
|
2021-04-19 22:03:42 +08:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
schedule:
|
2021-08-09 09:37:46 +08:00
|
|
|
- cron: '0 2 * * *'
|
2020-10-27 23:36:09 +08:00
|
|
|
|
|
|
|
jobs:
|
2023-06-09 14:42:30 +08:00
|
|
|
cs-fix:
|
|
|
|
name: PHP CS Fix on PHP${{ matrix.php }} ${{ matrix.swoole }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ ubuntu-latest ]
|
|
|
|
php: [ '8.1' ]
|
|
|
|
swoole: [ 'swoole']
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: '8.1'
|
|
|
|
tools: php-cs-fixer
|
|
|
|
extensions: redis, pdo, pdo_mysql, bcmath, ${{ matrix.swoole }}
|
|
|
|
- name: Setup Packages
|
|
|
|
run: composer update -oW
|
|
|
|
- name: Run CS Fix
|
2023-12-11 11:14:01 +08:00
|
|
|
run: vendor/bin/php-cs-fixer fix src --dry-run --diff
|
2023-06-09 14:42:30 +08:00
|
|
|
tests:
|
2023-06-09 22:38:23 +08:00
|
|
|
needs: cs-fix
|
2021-06-01 11:01:56 +08:00
|
|
|
name: Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }}
|
2020-10-27 23:36:09 +08:00
|
|
|
runs-on: "${{ matrix.os }}"
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-01-10 16:46:37 +08:00
|
|
|
os: [ ubuntu-latest ]
|
2023-11-23 16:45:36 +08:00
|
|
|
php-version: [ '8.3', '8.2', '8.1' ]
|
2024-01-24 17:17:36 +08:00
|
|
|
sw-version: [ 'v5.0.3', 'v5.1.2', 'master' ]
|
2023-11-23 16:45:36 +08:00
|
|
|
exclude:
|
|
|
|
- php-version: '8.3'
|
|
|
|
sw-version: 'v5.0.3'
|
2023-03-25 20:32:54 +08:00
|
|
|
max-parallel: 20
|
2021-04-19 22:03:42 +08:00
|
|
|
fail-fast: false
|
2020-12-23 13:42:40 +08:00
|
|
|
env:
|
|
|
|
SW_VERSION: ${{ matrix.sw-version }}
|
2021-06-01 11:01:56 +08:00
|
|
|
MYSQL_VERSION: '5.7'
|
2022-10-11 10:37:54 +08:00
|
|
|
PGSQL_VERSION: '14'
|
2020-10-27 23:36:09 +08:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-19 09:50:18 +08:00
|
|
|
uses: actions/checkout@v4
|
2023-09-14 15:30:36 +08:00
|
|
|
- name: Upgrade
|
2023-09-14 15:24:32 +08:00
|
|
|
run: |
|
|
|
|
sudo apt-get clean
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get upgrade -f
|
2020-10-27 23:36:09 +08:00
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
tools: phpize
|
2023-09-14 16:55:00 +08:00
|
|
|
extensions: redis, pdo, pdo_mysql, bcmath
|
2021-12-10 17:14:34 +08:00
|
|
|
ini-values: opcache.enable_cli=0
|
2020-10-27 23:36:09 +08:00
|
|
|
coverage: none
|
2021-01-09 21:19:28 +08:00
|
|
|
- name: Setup Swoole
|
2021-03-02 19:07:31 +08:00
|
|
|
run: |
|
2022-08-03 19:00:16 +08:00
|
|
|
sudo apt-get install libcurl4-openssl-dev libc-ares-dev libpq-dev
|
2021-04-19 22:03:42 +08:00
|
|
|
wget https://github.com/swoole/swoole-src/archive/${SW_VERSION}.tar.gz -O swoole.tar.gz
|
2021-04-02 12:55:30 +08:00
|
|
|
mkdir -p swoole
|
|
|
|
tar -xf swoole.tar.gz -C swoole --strip-components=1
|
|
|
|
rm swoole.tar.gz
|
|
|
|
cd swoole
|
|
|
|
phpize
|
2023-06-08 16:48:41 +08:00
|
|
|
./configure --enable-openssl --enable-swoole-curl --enable-cares --enable-swoole-pgsql --enable-brotli
|
2021-04-02 12:55:30 +08:00
|
|
|
make -j$(nproc)
|
|
|
|
sudo make install
|
2021-03-02 19:07:31 +08:00
|
|
|
sudo sh -c "echo extension=swoole > /etc/php/${{ matrix.php-version }}/cli/conf.d/swoole.ini"
|
2021-04-02 12:55:30 +08:00
|
|
|
sudo sh -c "echo swoole.use_shortname='Off' >> /etc/php/${{ matrix.php-version }}/cli/conf.d/swoole.ini"
|
2021-03-02 19:07:31 +08:00
|
|
|
php --ri swoole
|
2020-10-27 23:36:09 +08:00
|
|
|
- name: Setup Packages
|
2022-01-17 15:22:27 +08:00
|
|
|
run: ./.travis/requirement.install.sh
|
2023-06-09 14:42:30 +08:00
|
|
|
- name: Run PHPStan
|
2022-11-09 10:01:40 +08:00
|
|
|
run: ./.travis/run.check.sh
|
2020-10-27 23:36:09 +08:00
|
|
|
- name: Setup Services
|
2022-11-07 12:27:22 +08:00
|
|
|
run: ./.travis/setup.services.sh
|
2020-10-27 23:36:09 +08:00
|
|
|
- name: Setup Mysql
|
|
|
|
run: export TRAVIS_BUILD_DIR=$(pwd) && bash ./.travis/setup.mysql.sh
|
2022-10-11 10:37:54 +08:00
|
|
|
- name: Setup PostgreSQL
|
|
|
|
run: export TRAVIS_BUILD_DIR=$(pwd) && bash ./.travis/setup.pgsql.sh
|
2020-10-27 23:36:09 +08:00
|
|
|
- name: Run Scripts Before Test
|
|
|
|
run: cp .travis/.env.example .env
|
2023-04-14 22:17:45 +08:00
|
|
|
- name: Print PHP Environments
|
2023-04-14 22:53:29 +08:00
|
|
|
run: |
|
2023-06-15 20:07:01 +08:00
|
|
|
sudo rm -rf /etc/php/${{ matrix.php-version }}/cli/conf.d/20-xdebug.ini
|
2023-04-14 22:53:29 +08:00
|
|
|
php -i
|
2023-06-08 16:48:41 +08:00
|
|
|
php -m
|
2020-10-27 23:36:09 +08:00
|
|
|
- name: Run Test Cases
|
2022-11-07 12:27:22 +08:00
|
|
|
run: ./.travis/run.test.sh
|