Last active
July 19, 2021 04:51
-
-
Save kenng/892ffb4f2a858e44ff69c3608fb22a8b to your computer and use it in GitHub Desktop.
dockerized laravel unit testing with github action
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: 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