Skip to content

Commit

Permalink
Merge pull request #5 from crynobone/improve-tests
Browse files Browse the repository at this point in the history
Improve tests and support for Laravel 8
  • Loading branch information
ejimba authored Sep 13, 2020
2 parents 4667589 + 91b2029 commit 952d172
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 11 deletions.
153 changes: 153 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: 'Laravel Tests'

on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'

jobs:
tests-on-php71:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [7.1]
laravel: [5.8.x, 5.7.x, 5.6.x, 5.5.x]

name: PHP${{ matrix.php }} with Laravel ${{ matrix.laravel }}

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit --exclude-group=redis-auth
env:
REDIS_HOST: redis

tests-on-php72:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [7.2]
laravel: [7.x, 6.x, 5.8.x, 5.7.x, 5.6.x, 5.5.x]

name: PHP${{ matrix.php }} with Laravel ${{ matrix.laravel }}

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit --exclude-group=redis-auth
env:
REDIS_HOST: redis


tests-on-php73:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [7.3]
laravel: [8.x, 7.x, 6.x, 5.8.x, 5.7.x, 5.5.x]

name: PHP${{ matrix.php }} with Laravel ${{ matrix.laravel }}

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit --exclude-group=redis-auth
env:
REDIS_HOST: redis

tests-on-php74:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [7.4]
laravel: [8.x, 7.x, 6.x, 5.8.x]

name: PHP${{ matrix.php }} with Laravel ${{ matrix.laravel }}

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit --exclude-group=redis-auth
env:
REDIS_HOST: redis
23 changes: 16 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,28 @@ php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4

env:
global:
- coverage=yes
matrix:
- COMPOSER_FLAGS="--prefer-lowest"
- COMPOSER_FLAGS=""
- setup=basic
- setup=stable
- setup=lowest

before_install:
- composer config discard-changes true

before_script:
- travis_retry composer self-update
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable; fi
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-lowest --prefer-stable; fi

script:
- phpunit --coverage-text --coverage-clover=coverage.clover
- if [[ $coverage = 'yes' ]]; then vendor/bin/phpunit -c phpunit.xml --coverage-clover=coverage.clover; fi
- if [[ $coverage = 'no' ]]; then vendor/bin/phpunit -c phpunit.xml; fi

after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
- if [[ $coverage = 'yes' ]]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
"require": {
"php": ">=5.6.4",
"africastalking/africastalking": "^2.0",
"illuminate/notifications": "^5.3|^6.0|^7.0",
"illuminate/support": "^5.3|^6.0|^7.0"
"illuminate/notifications": "^5.3|^6.0|^7.0|^8.0",
"illuminate/support": "^5.3|^6.0|^7.0|^8.0"
},
"require-dev": {
"orchestra/testbench": "^3.8|^4.0",
"phpunit/phpunit": "^8.0"
"mockery/mockery": "^1.0",
"orchestra/testbench": "^3.4|^4.0|^5.0|^6.0",
"phpunit/phpunit": "^6.0|^7.0|^8.0"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 952d172

Please sign in to comment.