PHPUnit #424
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHPUnit | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [ 8.0, 8.1, 8.2 ] | |
swoole: [ '', swoole ] | |
name: PHP ${{ matrix.php }} ${{ matrix.swoole }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Start MySQL | |
run: docker compose up -d mysql mysql1 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: pdo, pdo_mysql, ${{ matrix.swoole }} | |
ini-values: error_reporting=E_ALL | |
tools: composer:v2 | |
coverage: none | |
- name: Composer install | |
run: composer install | |
- name: Static analysis | |
run: composer analyse | |
- name: Wait for MySQL | |
run: | | |
while ! docker compose exec mysql mysql --user=root --password=root -e "SELECT 1" >/dev/null 2>&1 || ! docker compose exec mysql1 mysql --user=root --password=root -e "SELECT 1" >/dev/null 2>&1; do | |
sleep 1 | |
done | |
- name: Run tests | |
env: | |
MYSQL_HOST: 127.0.0.1 | |
MYSQL_PORT: 33060 | |
MYSQL1_PORT: 33061 | |
run: composer test | |
- name: Close MySQL | |
run: docker compose down |