Skip to content

Change details in README.md #61

Change details in README.md

Change details in README.md #61

Workflow file for this run

on:
push:
branches: [ 'master' ]
pull_request:
branches: [ 'master' ]
permissions:
contents: read
jobs:
run:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: [ '5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
name: Run Unit Test on PHP ${{ matrix.php-versions }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create the MySQL server
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: '5.7'
- name: Check the MySQL version
run: mysql -uroot -e 'SELECT version();'
- name: Create the MySQL database
run: |
mysql -uroot -e 'CREATE DATABASE IF NOT EXISTS dscb;'
mysql -uroot -e 'USE dscb; CREATE TABLE IF NOT EXISTS `post` (`id` int(10) NOT NULL AUTO_INCREMENT, `subject` varchar(100) NOT NULL, `message` varchar(500) NOT NULL, `user_id` int(10) NOT NULL, `description` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `description` (`description`), KEY `user_id` (`user_id`)) AUTO_INCREMENT=1;'
mysql -uroot -e 'USE dscb; CREATE TABLE IF NOT EXISTS `user` (`id` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(200) NOT NULL, `age` int(2) NOT NULL, `gender` varchar(10) NOT NULL, PRIMARY KEY (`id`)) AUTO_INCREMENT=1;'
mysql -uroot -e 'USE dscb; ALTER TABLE `post` ADD CONSTRAINT `post_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;'
mysql -uroot -e 'CREATE USER dscb@"%" IDENTIFIED BY "dscb";'
mysql -uroot -e 'GRANT ALL PRIVILEGES ON dscb.* TO "dscb"@"%"; FLUSH PRIVILEGES;'
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Check the PHP version
run: php -v
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run test suite
run: vendor/bin/phpunit --coverage-clover=coverage.clover
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4-beta
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}