Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Add GitHub Actions #1

Merged
merged 9 commits into from
Jun 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/main.workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
workflow "phpunit / phpinsights / php-cs-fixer" {
on = "push"
resolves = [
"phpunit",
"phpinsights",
"auto-commit-php-cs-fixer",
]
}

# Install composer dependencies
action "composer install" {
uses = "MilesChou/composer-action@master"
args = "install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist"
}

# Run phpunit testsuite
action "phpunit" {
needs = ["composer install"]
uses = "./actions/run-phpunit/"
args = "tests/"
}

# Run phpinsights
action "phpinsights" {
needs = ["composer install"]
uses = "stefanzweifel/laravel-phpinsights-action@v1.0.0"
args = "-v --min-quality=80 --min-complexity=80 --min-architecture=80 --min-style=80"
}

# Run php-cs-fixer
action "php-cs-fixer" {
uses = "docker://oskarstark/php-cs-fixer-ga"
}

action "auto-commit-php-cs-fixer" {
needs = ["php-cs-fixer"]
uses = "stefanzweifel/git-auto-commit-action@v1.0.0"
secrets = ["GITHUB_TOKEN"]
env = {
COMMIT_MESSAGE = "Apply php-cs-fixer changes"
COMMIT_AUTHOR_EMAIL = "hello@stefanzweifel.io"
COMMIT_AUTHOR_NAME = "Stefan Zweifel"
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/vendor
.env
.phpunit.result.cache
.php_cs.cache
Homestead.json
Homestead.yaml
npm-debug.log
Expand Down
18 changes: 18 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->notPath('vendor')
->notPath('bootstrap')
->notPath('storage')
->in(__DIR__)
->name('*.php')
->notName('*.blade.php');

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
'no_unused_imports' => true,
])
->setFinder($finder);
9 changes: 9 additions & 0 deletions actions/run-phpunit/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM php:7.3-cli-alpine

LABEL "com.github.actions.name"="phpunit-test"
LABEL "com.github.actions.description"="Run phpunit test suite"
LABEL "com.github.actions.icon"="check-circle"
LABEL "com.github.actions.color"="green"

ADD entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
9 changes: 9 additions & 0 deletions actions/run-phpunit/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh -l
set -eu

#  Setup Laravel App
cp .env.example .env
php artisan key:generate

#  Run phpunit Tests
vendor/bin/phpunit $*
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace App\Http\Controllers\Auth;

use App\User;
use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;

class RegisterController extends Controller
{
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Http\Middleware;

use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;

class TrustProxies extends Middleware
{
Expand Down
1 change: 0 additions & 1 deletion app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Providers;

use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/BroadcastServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;

class BroadcastServiceProvider extends ServiceProvider
{
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Providers;

use Illuminate\Support\Facades\Event;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;

class EventServiceProvider extends ServiceProvider
{
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Providers;

use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;

class RouteServiceProvider extends ServiceProvider
{
Expand Down
3 changes: 1 addition & 2 deletions app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"friendsofphp/php-cs-fixer": "^2.15",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"nunomaduro/phpinsights": "^1.6",
"phpunit/phpunit": "^7.5"
},
"config": {
Expand Down
Loading