-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added github actions for automated tests running (#23)
- Loading branch information
1 parent
17afeb2
commit 076f1a9
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 |
This file contains 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
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 |
This file contains 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
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 |
This file contains 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
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 ) |