Skip to content

Commit

Permalink
Merge pull request #70 from nspalo/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
nspalo authored Sep 12, 2023
2 parents 84c8f3c + 829e4cd commit 699ff91
Show file tree
Hide file tree
Showing 30 changed files with 9,480 additions and 22 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI Build

on:
push:
branches: [ "master", "development" ]
pull_request:
branches: [ "master", "development" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Docker Login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_KEY: ${{ secrets.DOCKER_KEY }}
run: |
docker login -u $DOCKER_USER -p $DOCKER_KEY
# Script Permissions
- name: Setting up Permissions
run: |
chmod +x -R ./scripts/*.sh
mkdir -p ./storage/logs/ ./bootstrap/cache/
chmod 777 ./storage/ ./bootstrap/cache -R
# Docker Images
- name: Building the Docker Images
run: ./scripts/build.sh

# Docker Containers
- name: Start Docker Containers
run: ./scripts/up.sh -d

# Composer
- name: Run Composer
run: |
./scripts/composer.sh install
./scripts/composer.sh dump-autoload
./scripts/composer.sh run post-root-package-install
./scripts/composer.sh run post-create-project-cmd
# NPM
- name: Run NPM
run: |
./scripts/run.sh npm install --loglevel=error
./scripts/run.sh npm run development
# Code Quality Check
- name: Run PhpStan
run: ./scripts/composer.sh run phpstan

- name: Run Easy Coding Sandards
run: ./scripts/composer.sh run ecs-all

- name: Run Automated Test with PhpUnit
run: ./scripts/composer.sh run phpunit

# Teardown
- name: Stop container and remove images
run: ./scripts/down.sh -v
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
> This is a simple project that aims to build a template for a
> *Dockerize web development environment with NginX, MySQL, PHP, and Laravel*.
![CI BUILD](https://github.com/nspalo/docker-laravel-template/actions/workflows/build.yml/badge.svg)

## Web Stack
**Docker containers**
- nginx
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ services:
networks:
- web-app
container_name: npm
image: node:16-alpine
image: node:20.6-alpine
working_dir: /var/www/html
volumes:
- "${PATH_PROJECT_SOURCE}:/var/www/html"
Expand Down
4 changes: 3 additions & 1 deletion src/app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
Expand All @@ -25,7 +27,7 @@ protected function schedule(Schedule $schedule)
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
$this->load(__DIR__ . '/Commands');

require base_path('routes/console.php');
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
Expand Down
2 changes: 2 additions & 0 deletions src/app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
Expand Down
2 changes: 2 additions & 0 deletions src/app/Http/Kernel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;
Expand Down
6 changes: 5 additions & 1 deletion src/app/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Http\Middleware;

use Illuminate\Auth\Middleware\Authenticate as Middleware;
Expand All @@ -12,10 +14,12 @@ class Authenticate extends Middleware
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
protected function redirectTo($request): ?string
{
if (! $request->expectsJson()) {
return route('login');
}

return null;
}
}
2 changes: 2 additions & 0 deletions src/app/Http/Middleware/EncryptCookies.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Http\Middleware;

use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
Expand Down
2 changes: 2 additions & 0 deletions src/app/Http/Middleware/PreventRequestsDuringMaintenance.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
Expand Down
10 changes: 6 additions & 4 deletions src/app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Http\Middleware;

use App\Providers\RouteServiceProvider;
Expand All @@ -12,10 +14,10 @@ class RedirectIfAuthenticated
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @param string|null ...$guards
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
* @param Request $request
* @param Closure $next
* @param ...$guards
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|mixed
*/
public function handle(Request $request, Closure $next, ...$guards)
{
Expand Down
2 changes: 2 additions & 0 deletions src/app/Http/Middleware/TrimStrings.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
Expand Down
2 changes: 2 additions & 0 deletions src/app/Http/Middleware/TrustHosts.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Http\Middleware;

use Illuminate\Http\Middleware\TrustHosts as Middleware;
Expand Down
2 changes: 2 additions & 0 deletions src/app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Http\Middleware;

use Illuminate\Http\Middleware\TrustProxies as Middleware;
Expand Down
2 changes: 2 additions & 0 deletions src/app/Http/Middleware/VerifyCsrfToken.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
Expand Down
3 changes: 2 additions & 1 deletion src/app/Models/User.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
Expand Down
2 changes: 2 additions & 0 deletions src/app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
Expand Down
3 changes: 2 additions & 1 deletion src/app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

declare(strict_types=1);

namespace App\Providers;

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

class AuthServiceProvider extends ServiceProvider
{
Expand Down
2 changes: 2 additions & 0 deletions src/app/Providers/BroadcastServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Providers;

use Illuminate\Support\Facades\Broadcast;
Expand Down
2 changes: 2 additions & 0 deletions src/app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Providers;

use Illuminate\Auth\Events\Registered;
Expand Down
8 changes: 4 additions & 4 deletions src/app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Providers;

use Illuminate\Cache\RateLimiting\Limit;
Expand All @@ -26,14 +28,12 @@ class RouteServiceProvider extends ServiceProvider
*
* @var string|null
*/
// protected $namespace = 'App\\Http\\Controllers';
protected $namespace = ''; // 'App\\Http\\Controllers';

/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
public function boot(): void
{
$this->configureRateLimiting();

Expand Down
25 changes: 24 additions & 1 deletion src/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^5.10",
"phpunit/phpunit": "^9.5.10"
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.5.10",
"symplify/easy-coding-standard": "^12.0"
},
"autoload": {
"psr-4": {
Expand All @@ -45,6 +47,27 @@
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
],
"phpunit": [
"vendor/bin/phpunit --configuration phpunit.xml --coverage-text"
],
"phpstan": [
"vendor/bin/phpstan --configuration=./phpstan.neon"
],
"ecs-all": [
"vendor/bin/ecs check app tests --clear-cache"
],
"ecs-app": [
"vendor/bin/ecs check app --clear-cache"
],
"ecs-test": [
"vendor/bin/ecs check tests --clear-cache"
],
"ecs-app-fix": [
"vendor/bin/ecs check app --fix --clear-cache"
],
"ecs-test-fix": [
"vendor/bin/ecs check tests --fix --clear-cache"
]
},
"extra": {
Expand Down
Loading

0 comments on commit 699ff91

Please sign in to comment.