Skip to content

Merge pull request #12 from rakibhasansabbir/dependabot/composer/guzz… #33

Merge pull request #12 from rakibhasansabbir/dependabot/composer/guzz…

Merge pull request #12 from rakibhasansabbir/dependabot/composer/guzz… #33

Workflow file for this run

name: Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
php-tests:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 8.1 ]
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: laravel
MYSQL_ROOT_PASSWORD: password
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
# - name: Verify MySQL connection
# run: |
# mysql --version
# sudo apt-get install mysql-client
# mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -ppassword -e "SHOW DATABASES"
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-composer-${{ hashFiles('composer.json') }}
- 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-progress --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Migrate and seed
run: php artisan migrate:fresh --seed
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_CONNECTION: mysql
DB_DATABASE: laravel
DB_USERNAME: root
DB_PASSWORD: password
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: vendor/bin/phpunit --verbose
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_CONNECTION: mysql
DB_DATABASE: laravel
DB_USERNAME: root
DB_PASSWORD: password