rhymix/.github/workflows/ci.yml
2021-01-02 23:29:22 +09:00

40 lines
1.4 KiB
YAML

name: PHP Lint & Codeception
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ]
name: PHP ${{ matrix.php }}
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: nanasess/setup-php@master
with:
php-version: ${{ matrix.php }}
- name: Start MySQL
run: sudo systemctl start mysql.service
- name: Create MySQL database and user
run: |
sudo mysql -uroot -proot -e "CREATE DATABASE rhymix CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci"
sudo mysql -uroot -proot -e "CREATE USER 'travis'@'localhost' identified by 'travis'"
sudo mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON rhymix.* TO travis@localhost; FLUSH PRIVILEGES"
- name: PHP Lint
run: if find . -name "*.php" ! -path "./vendor/*" -print0 | xargs -0 -n 1 -P 8 php -l | grep -v "No syntax errors detected"; then exit 1; fi
- name: Download codeception
if: matrix.php != '8.0'
run: wget https://codeception.com/releases/2.3.9/codecept.phar
- name: Run PHP development server
if: matrix.php != '8.0'
run: php -S localhost:8000 &
- name: Build and run codeception
if: matrix.php != '8.0'
run: php codecept.phar build && php codecept.phar run --debug --fail-fast --env travis