Skip to content

Commit

Permalink
Upgrade config file and GH Actions workflow + cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
johanvanhelden committed Aug 6, 2023
1 parent f660882 commit 9082e10
Show file tree
Hide file tree
Showing 38 changed files with 149 additions and 661 deletions.
67 changes: 46 additions & 21 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
coverage: none

- name: Install NPM
run: npm install
run: npm ci

- name: Syntax Errors
run: find app config lang routes tests -name "*.php" -print0 | xargs -0 -n1 -P8 php -l
Expand All @@ -55,7 +55,7 @@ jobs:
- name: PHPCPD
run: phpcpd app

- name: Lint Assets
- name: Check Assets
run: npm run check

security-check:
Expand All @@ -65,13 +65,6 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set Up PHP and Tools
uses: shivammathur/setup-php@master
with:
php-version: "8.1"
tools: composer:v2
coverage: none

- name: Check Composer Packages
uses: symfonycorp/security-checker-action@v4

Expand All @@ -97,18 +90,15 @@ jobs:
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Install NPM
run: npm install
run: npm ci

- name: Setup PHPUnit Environment
run: yes | cp .env.testing.example .env

- name: Build Assets
run: ./buildHook.sh $PWD

- name: Run PHPUnit Tests
run: composer dump-autoload && composer test

- name: Run Test Coverage Report
- name: Run Tests & Generate Coverage Report
run: ./vendor/bin/phpunit --coverage-clover ./coverage.xml

- name: Check Test Coverage
Expand All @@ -117,17 +107,52 @@ jobs:
percentage: "95"
filename: "coverage.xml"

- name: Clear Laravel Logs
run: rm ./storage/logs/*.log -f
dusk:
name: Dusk
runs-on: ubuntu-latest

services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: tests_db
ports:
- 13306:3306

steps:
- uses: actions/checkout@v3

- name: Initialize the Database
run: |
sudo systemctl start mysql
mysql --user="root" --password="root" -e "CREATE DATABASE tests_db character set UTF8mb4 collate utf8mb4_bin;"
- name: Set Up PHP and Tools
uses: shivammathur/setup-php@master
with:
php-version: "8.1"
extensions: bz2, bcmath, curl, exif, gd, imagick, imap, intl, mysqli, pcntl, pcov, pdo_mysql, soap, xmlrpc, xsl, zip, iconv, pdo
tools: composer:v2
coverage: pcov

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

- name: Build Assets
run: ./buildHook.sh $PWD

- name: Setup Dusk Environment
run: yes | cp .env.dusk.local.example .env

- name: Set the Chrome Driver
run: php artisan dusk:chrome-driver `/opt/google/chrome/chrome --version | cut -d " " -f3 | cut -d "." -f1`
run: php artisan dusk:chrome-driver --detect

- name: Start Chrome Driver
run: ./vendor/laravel/dusk/bin/chromedriver-linux &

- name: Start Server
run: php artisan serve --port=8000 &
run: php artisan serve --no-reload &

- name: Run Dusk
run: composer test-browser
Expand All @@ -148,7 +173,7 @@ jobs:
name: Sentry Release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action == 'merged'))
needs: [code-analysis, code-style, security-check, tests]
needs: [code-analysis, code-style, security-check, tests, dusk]

steps:
- uses: actions/checkout@v3
Expand All @@ -168,7 +193,7 @@ jobs:
name: Deploy Staging
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action == 'merged'))
needs: [code-analysis, code-style, security-check, tests]
needs: [code-analysis, code-style, security-check, tests, dusk]

steps:
- uses: actions/checkout@v3
Expand All @@ -181,7 +206,7 @@ jobs:
name: Deploy Production
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action == 'merged'))
needs: [code-analysis, code-style, security-check, tests]
needs: [code-analysis, code-style, security-check, tests, dusk]

steps:
- uses: actions/checkout@v3
Expand Down
35 changes: 0 additions & 35 deletions app/Enums/BaseEnum.php

This file was deleted.

16 changes: 0 additions & 16 deletions app/Helpers/Auth.php

This file was deleted.

1 change: 0 additions & 1 deletion app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class Kernel extends HttpKernel
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
Expand Down
35 changes: 0 additions & 35 deletions app/Http/Middleware/RedirectIfAuthenticated.php

This file was deleted.

8 changes: 0 additions & 8 deletions app/Http/Middleware/VerifyCsrfToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace App\Http\Middleware;

use App\Helpers\Auth;
use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
use Illuminate\Http\Request;
Expand Down Expand Up @@ -38,13 +37,6 @@ public function handle($request, Closure $next): mixed
} catch (TokenMismatchException $exception) {
Log::info('Session expired', [$exception]);

if (Auth::check()) {
$request->session()->invalidate();
$request->session()->regenerateToken();

Auth::logout();
}

flash(__('message.session_expired'))->error();

return redirect()->route('page.home');
Expand Down
30 changes: 0 additions & 30 deletions app/Http/Requests/User/SetPasswordRequest.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
if ($this->app->environment(config('constants.environment.development'))) {
if ($this->app->environment(config('environment.development'))) {
$this->app->register(\Laravel\Dusk\DuskServiceProvider::class);
}
}
Expand Down
26 changes: 0 additions & 26 deletions app/Providers/ValidationServiceProvider.php

This file was deleted.

32 changes: 0 additions & 32 deletions app/Rules/DbString.php

This file was deleted.

Loading

0 comments on commit 9082e10

Please sign in to comment.