Skip to content

Instantly share code, notes, and snippets.

@kenng
Last active July 19, 2021 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenng/892ffb4f2a858e44ff69c3608fb22a8b to your computer and use it in GitHub Desktop.
Save kenng/892ffb4f2a858e44ff69c3608fb22a8b to your computer and use it in GitHub Desktop.
dockerized laravel unit testing with github action
name: Laravel testing
on:
push:
branches:
- release
jobs:
phpunit:
runs-on: ubuntu-20.04
strategy:
fail-fast: true
container:
image: kenngsimply/laravelapp:v1
services:
db-tests:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: <YOUR-ROOT-PASSWORD>
MYSQL_USER: <YOUR-DB-USER>
MYSQL_PASSWORD: <YOUR-DB-USER-PASSWOD>
MYSQL_DATABASE: <YOUR-DB-NAME>
ports:
- 3306:3306
redis:
image: redis:6-alpine
ports:
- 6379:6379
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install composer dependencies
run: |
composer install
- name: Prepare Laravel Application
run: |
cp .env.testing .env
php artisan key:generate
- name: Migrate and seed
run: |
php artisan migrate --seed
- name:
run: |
php artisan redis:init
- name: Run Testsuite
run: php artisan test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment