|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
name: Laravel test via MySQL
|
|
|
|
|
name: Laravel
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
@ -11,40 +11,27 @@ jobs:
|
|
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
|
|
services:
|
|
|
|
|
mysql:
|
|
|
|
|
image: mysql:5.7
|
|
|
|
|
env:
|
|
|
|
|
MYSQL_DATABASE: test_db
|
|
|
|
|
MYSQL_USER: user
|
|
|
|
|
MYSQL_PASSWORD: secret
|
|
|
|
|
MYSQL_ROOT_PASSWORD: secretroot
|
|
|
|
|
ports:
|
|
|
|
|
- 3306
|
|
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
|
|
- name: Verify MySQL connection
|
|
|
|
|
run: |
|
|
|
|
|
mysql --version
|
|
|
|
|
sudo apt-get install -y mysql-client
|
|
|
|
|
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uuser -psecret -e "SHOW DATABASES"
|
|
|
|
|
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
|
|
|
|
|
with:
|
|
|
|
|
php-version: '8.1'
|
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
- name: Copy .env
|
|
|
|
|
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
|
|
|
|
|
|
|
|
|
- name: Install Dependencies
|
|
|
|
|
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
|
|
|
|
|
|
|
|
|
|
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
|
|
|
|
- name: Generate key
|
|
|
|
|
run: php artisan key:generate
|
|
|
|
|
- name: Directory Permissions
|
|
|
|
|
run: chmod -R 777 storage bootstrap/cache
|
|
|
|
|
|
|
|
|
|
- name: Key generate
|
|
|
|
|
run: php artisan key:generate
|
|
|
|
|
|
|
|
|
|
- name: Database seeder test
|
|
|
|
|
run: php artisan migrate:fresh --seed
|
|
|
|
|
|
|
|
|
|
- name : Developer test
|
|
|
|
|
run: php artisan tes
|
|
|
|
|
- name: Create Database
|
|
|
|
|
run: |
|
|
|
|
|
mkdir -p database
|
|
|
|
|
touch database/database.sqlite
|
|
|
|
|
- name: Dataseeder
|
|
|
|
|
env:
|
|
|
|
|
DB_CONNECTION: sqlite
|
|
|
|
|
DB_DATABASE: database/database.sqlite
|
|
|
|
|
run: php artisan migrate --seed
|
|
|
|
|
- name: Execute tests (Unit and Feature tests) via PHPUnit
|
|
|
|
|
run: vendor/bin/phpunit
|
|
|
|
|