Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Update DatabaseSeeder::class #5

Update DatabaseSeeder::class

Update DatabaseSeeder::class #5

Workflow file for this run

name: Tests Pipeline
on: [push, pull_request]
env:
PHPUNIT_FLAGS: "--filter=Api --stop-on-failure"
jobs:
laravel:
name: Tests Pipeline (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: 'secret'
MYSQL_DATABASE: 'book'
MYSQL_USER: 'user'
MYSQL_PASSWORD: 'secret'
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
php-versions: ['8.2']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with Composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, mysql
coverage: none
- name: Start MySQL service
run: sudo /etc/init.d/mysql start
- name: Get Composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install -q --no-progress --prefer-dist --optimize-autoloader
- name: Prepare environment
run: |
cp .env.example .env
sed -i "s/3306/${{ job.services.mysql.ports['3306'] }}/g" .env
sed -i "s/DB_USERNAME=root/DB_USERNAME=user/g" .env
sed -i "s/DB_PASSWORD=/DB_PASSWORD=secret/g" .env
- name: Clear config cache
run: php artisan config:clear
- name: Generate key
run: php artisan key:generate -q -n
- name: Migrate & seed database
run: php artisan migrate --seed --force
- name: Change directory permissions
run: chmod -R 777 storage bootstrap/cache
- name: Install JavaScript packages
run: npm install --quiet --no-progress
- name: Build JavaScript packages
run: npm run build
- name: Run Laravel server
run: php artisan serve --port=3000 --no-reload &
- name: Curl to localhost
run: curl localhost:3000 &
- name: Run tests
run: php artisan test ${{ env.PHPUNIT_FLAGS }}