Skip to content

wip

wip #4

Workflow file for this run

name: Test
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php:
- "7.4"
- "8.0"
- "8.1"
composer:
- ""
- "--prefer-lowest"
env:
DB: mysql
DB_USER: root
steps:
- uses: actions/checkout@v4
- name: Use PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: sqlite3, zip
coverage: xdebug
tools: composer
- run: composer validate
- run: composer update ${COMPOSER_FLAGS} --prefer-source
- name: Start MySQL
run: |
sudo systemctl start mysql
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -proot mysql
- name: Disable MySQL strict mode
run: |
echo "SET GLOBAL sql_mode = ''" | mysql -u root -proot mysql
- name: setup database
run: |
sh -c "if [ '$DB' = 'mysql' ]; then mysql -u root -proot mysql -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS test; DROP SCHEMA IF EXISTS second_hand_books; DROP SCHEMA IF EXISTS contest; DROP DATABASE IF EXISTS reverse_bookstore; DROP SCHEMA IF EXISTS bookstore_schemas; SET FOREIGN_KEY_CHECKS = 1;'; fi"
sh -c "if [ '$DB' = 'mysql' ]; then mysql -u root -proot mysql -e 'CREATE DATABASE test; CREATE SCHEMA bookstore_schemas; CREATE SCHEMA contest; CREATE SCHEMA second_hand_books; CREATE DATABASE reverse_bookstore;'; fi"
./test/reset_tests.sh
- name: Run Tests
run: vendor/bin/phpunit