Skip to content

Commit

Permalink
Merge pull request #16 from bhushan/feature/github-actions
Browse files Browse the repository at this point in the history
added github actions to check phpcsfixer and phpunit tests
  • Loading branch information
Wulfheart authored May 2, 2021
2 parents da50553 + d9535b5 commit fbf9753
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 4 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check and fix code styling with php-cs-fixer

on:
pull_request:
push:
branches:
- master

jobs:
style:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Run php-cs-fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php_cs.dist --allow-risky=yes

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4.10.0
with:
commit_message: Automatically applied php-cs-fixer changes
39 changes: 39 additions & 0 deletions .github/workflows/php-unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Check if all phpunit tests are passing or not

on:
pull_request:
push:
branches:
- master

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 7.4, 8.0 ]
laravel: [ 8.* ]
dependency-version: [ prefer-stable ]
include:
- laravel: 8.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

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

- 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, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist

- name: Execute tests
run: vendor/bin/phpunit
1 change: 1 addition & 0 deletions src/Commands/PrettyRoutesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ protected function displayRoutes(array $routes)
'PATCH' => 'yellow',
'DELETE' => 'red',
][$m] ?? 'white';

return sprintf("<fg=%s>%s</>", $color, $m);
}, explode('|', $method)));

Expand Down
1 change: 0 additions & 1 deletion tests/SnapshotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace Wulfheart\PrettyRoutes\Tests;


use Illuminate\Support\Facades\Artisan;
use Spatie\Snapshots\MatchesSnapshots;

Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public function defineRoutes($router): void
return view('welcome');
});

$router->get('admin', fn() => true);
$router->get('admin', fn () => true);

$router->resource('test', Controller::class);

$router->get('/{one?}/{two}/some/{three?}', fn() => true);
$router->post('some/thing/{one?}/{two}/some/{three?}', fn() => true);
$router->get('/{one?}/{two}/some/{three?}', fn () => true);
$router->post('some/thing/{one?}/{two}/some/{three?}', fn () => true);
}
}

0 comments on commit fbf9753

Please sign in to comment.