Files
monica/.github/workflows/sqlite.yml
T
2021-12-04 18:26:14 -05:00

52 lines
1.7 KiB
YAML

name: PHPUnit with SQLite
on: [push]
jobs:
phpunit:
name: PHP ${{ matrix.php-versions }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['8.0']
steps:
- uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install -n -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.ci.sqlite', '.env');"
- name: Create SQLite database
run: |
mkdir -p database
touch database/database.sqlite
- name: Generate key
run: php artisan key:generate
- name: Run migrations
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: php artisan migrate
- name: Run seeds
run: php artisan db:seed --no-interaction -vvv
- name: Execute tests via PHPUnit
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: vendor/bin/phpunit