Github示例
github actions说明
适用PHP的示例
swoole test.yml
借用 hyperf/component-creator
点击查看代码
name: PHPUnit
on: [ push, pull_request ]
env:
SWOOLE_VERSION: '4.8.10'
SWOW_VERSION: 'develop'
jobs:
ci:
name: Test PHP ${{ matrix.PHP-version }} on ${{ matrix.engine }}
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os: [ ubuntu-latest ]
PHP-version: [ '7.3','7.4', '8.0' ]
engine: [ 'swoole' ]
max-parallel: 5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-PHP@v2
with:
PHP-version: ${{ matrix.PHP-version }}
tools: PHPize
ini-values: opcache.enable_cli=0
coverage: none
- name: Setup Swoole
if: ${{ matrix.engine == 'swoole' }}
run: |
cd /tmp
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
wget https://github.com/swoole/swoole-src/archive/v${SWOOLE_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"
PHP --ri swoole
- name: Setup Packages
run: composer update -o --no-scripts
- name: Run Test Cases
run: |
vendor/bin/PHP-cs-fixer fix --dry-run # cs-fixer 格式化代码
composer analyse # PHPstan 静态代码分析
composer test # PHPunit
正常PHP的 test.yml
点击查看代码
name: PHPUnit
on: [ push, pull_request ]
jobs:
ci:
name: Test PHP ${{ matrix.PHP-version }} on ${{ matrix.engine }}
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os: [ ubuntu-latest ]
PHP-version: ['7.4', '8.0' ]
max-parallel: 7
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-PHP@v2
with:
PHP-version: ${{ matrix.PHP-version }}
tools: PHPize
ini-values: opcache.enable_cli=0
coverage: none
- name: Setup Packages
run: composer update -o --no-scripts
- name: Run Test Cases
run: |
vendor/bin/PHP-cs-fixer fix --dry-run
composer analyse
composer test
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。