Skip to content

Commit

Permalink
Added github actions for automated tests running (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
DCzajkowski authored Aug 30, 2019
1 parent 17afeb2 commit 076f1a9
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/actions/common/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Create Laravel project
composer create-project --prefer-dist laravel/laravel test-app
cd test-app

# Scaffold Authentication
php artisan make:auth

# Require the package
composer config repositories.dczajkowski/auth-tests vcs $GITHUB_WORKSPACE
composer require dczajkowski/auth-tests dev-master
11 changes: 11 additions & 0 deletions .github/actions/tests-with-email-verification
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

source $GITHUB_WORKSPACE/.github/actions/common/setup

# Include tests
php artisan make:auth-tests

# Prepare for running tests
sed -i 's#<server name="SESSION_DRIVER" value="array"/>#<server name="SESSION_DRIVER" value="array"/><server name="DB_CONNECTION" value="sqlite"/><server name="DB_DATABASE" value=":memory:"/>#g' phpunit.xml
sed -i $'s#Auth::routes();#Auth::routes(\[\'verify\' => true\]);#g' ./routes/web.php
sed -i 's#extends Authenticatable#extends Authenticatable implements MustVerifyEmail#g' ./app/User.php
9 changes: 9 additions & 0 deletions .github/actions/tests-without-email-verification
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

source $GITHUB_WORKSPACE/.github/actions/common/setup

# Include tests
php artisan make:auth-tests --without-email-verification

# Prepare for running tests
sed -i 's#<server name="SESSION_DRIVER" value="array"/>#<server name="SESSION_DRIVER" value="array"/><server name="DB_CONNECTION" value="sqlite"/><server name="DB_DATABASE" value=":memory:"/>#g' phpunit.xml
43 changes: 43 additions & 0 deletions .github/workflows/run-tests-on-laravel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'Run tests on Laravel'

on:
pull_request:
branches:
- master

jobs:
test_without_email_verification:
name: 'Runs tests without email verification module on latest Laravel'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master

- name: 'Verifies environment'
run: |
php -v
composer --version
- name: 'Sets up tests'
run: /bin/bash -e $GITHUB_WORKSPACE/.github/actions/tests-without-email-verification

- name: 'Runs tests'
run: ( cd test-app && ./vendor/bin/phpunit )

test_with_email_verification:
name: 'Runs tests with email verification module on latest Laravel'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master

- name: 'Verifies environment'
run: |
php -v
composer --version
- name: 'Sets up tests'
run: /bin/bash -e $GITHUB_WORKSPACE/.github/actions/tests-with-email-verification

- name: 'Runs tests'
run: ( cd test-app && ./vendor/bin/phpunit )

0 comments on commit 076f1a9

Please sign in to comment.