Forked from djaiss/Laravel 6.x Github Action with SQLite
Created
May 10, 2020 18:50
-
-
Save spham/5f4b4a11017a7d47a8fdcb5f3b5631b1 to your computer and use it in GitHub Desktop.
Working example on how to use SQLite with a Laravel 6.x installation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit tests | |
on: [push] | |
jobs: | |
phpunit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- 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 | |
- name: Generate key | |
run: php artisan key:generate | |
- name: Create SQLite database | |
run: | | |
mkdir -p database | |
touch database/database.sqlite | |
- name: Run migrations | |
env: | |
DB_CONNECTION: sqlite | |
DB_DATABASE: database/database.sqlite | |
run: php artisan migrate | |
- name: Execute tests via PHPUnit | |
env: | |
DB_CONNECTION: sqlite | |
DB_DATABASE: database/database.sqlite | |
run: vendor/bin/phpunit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment