Skip to content

Instantly share code, notes, and snippets.

@vstyler96
Created January 27, 2023 23:53
Show Gist options
  • Save vstyler96/02c63edbfeb06d30b0e0f4c19d3d52ae to your computer and use it in GitHub Desktop.
Save vstyler96/02c63edbfeb06d30b0e0f4c19d3d52ae to your computer and use it in GitHub Desktop.
Github Action for Laravel Dusk CI and PostgreSQL
on: push
name: Testing Laravel with PostgreSQL
jobs:
laravel:
name: Build and Test
runs-on: ubuntu-latest
container:
image: chilio/laravel-dusk-ci:latest
services:
redis:
image: redis
ports:
- 6379/tcp
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
# mysql:
# image: mariadb
# env:
# MYSQL_DATABASE: rank4dead
# MYSQL_ROOT_PASSWORD: password
# ports:
# - 3306:3306
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres
env:
POSTGRES_DB: rank4dead
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432/tcp
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install composer dependencies
run: |
composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
- name: Run Laravel Application
run: |
cp .env.ci .env
composer dump-autoload
php artisan key:generate
php artisan storage:link
php artisan migrate:fresh
php artisan passport:install --force
php artisan optimize:clear
composer clear-cache
- name: Run Tests
run: ./vendor/bin/phpunit tests/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment