mirror of
https://github.com/notf0und/SGS
synced 2026-07-17 18:21:06 +00:00
* Fix CI/CD php version
* Add Pint * Format code
This commit is contained in:
parent
0993bfa666
commit
bae79d68ab
@@ -16,7 +16,7 @@ jobs:
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.4'
|
||||
extensions: mbstring
|
||||
coverage: none
|
||||
|
||||
@@ -34,10 +34,33 @@ jobs:
|
||||
working-directory: www
|
||||
run: php artisan test
|
||||
|
||||
lint:
|
||||
name: Check code style (Pint)
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.4'
|
||||
extensions: mbstring
|
||||
coverage: none
|
||||
|
||||
- name: Install Composer dependencies
|
||||
working-directory: www
|
||||
run: composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||
|
||||
- name: Run Pint
|
||||
working-directory: www
|
||||
run: ./vendor/bin/pint --test
|
||||
|
||||
docker:
|
||||
name: Build and push Docker image
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
needs: [test, lint]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
php-version: '8.4'
|
||||
extensions: mbstring
|
||||
coverage: none
|
||||
|
||||
@@ -33,3 +33,26 @@ jobs:
|
||||
- name: Run tests
|
||||
working-directory: www
|
||||
run: php artisan test
|
||||
|
||||
lint:
|
||||
name: Check code style (Pint)
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.4'
|
||||
extensions: mbstring
|
||||
coverage: none
|
||||
|
||||
- name: Install Composer dependencies
|
||||
working-directory: www
|
||||
run: composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||
|
||||
- name: Run Pint
|
||||
working-directory: www
|
||||
run: ./vendor/bin/pint --test
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Helpers;
|
||||
class FileSize
|
||||
{
|
||||
private const UNITS = ['', 'K', 'M', 'G', 'T'];
|
||||
|
||||
private const THRESHOLD = 1024;
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,6 +35,7 @@ class IndexController extends Controller
|
||||
private function getRequestPath(Request $request): ?string
|
||||
{
|
||||
$path = $request->route('path');
|
||||
|
||||
return $path ? rawurldecode($path) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class IndexController extends Controller
|
||||
{
|
||||
return response()->json([
|
||||
'files' => $this->getInstallableFiles()->values(),
|
||||
'success' => config('app.name')
|
||||
'success' => config('app.name'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class IndexController extends Controller
|
||||
->filter(fn ($path) => NintendoFileExtension::isSupported($path))
|
||||
->map(fn ($path) => [
|
||||
'url' => url($path),
|
||||
'size' => Storage::size($path)
|
||||
'size' => Storage::size($path),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,20 +6,17 @@ use Closure;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class EnsureIsTinfoilClient
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Closure(Request): (Response|RedirectResponse) $next
|
||||
* @return Response|RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response|RedirectResponse
|
||||
{
|
||||
if (!!$request->header('theme')) {
|
||||
if ((bool) $request->header('theme')) {
|
||||
return redirect()->route('tinfoil');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Providers\AppServiceProvider;
|
||||
|
||||
return [
|
||||
App\Providers\AppServiceProvider::class,
|
||||
AppServiceProvider::class,
|
||||
];
|
||||
|
||||
+2
-2
@@ -9,14 +9,14 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"php": "^8.4",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/tinker": "^2.10.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.23",
|
||||
"laravel/pail": "^1.2.2",
|
||||
"laravel/pint": "^1.24",
|
||||
"laravel/pint": "^1.29",
|
||||
"laravel/sail": "^1.41",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.6",
|
||||
|
||||
Generated
+14
-13
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "cf274898566d29ebdc912d11f0d0a6e3",
|
||||
"content-hash": "f10e5685efd94a89d824ca6ed03c8b85",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@@ -6525,16 +6525,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/pint",
|
||||
"version": "v1.26.0",
|
||||
"version": "v1.29.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/pint.git",
|
||||
"reference": "69dcca060ecb15e4b564af63d1f642c81a241d6f"
|
||||
"reference": "bdec963f53172c5e36330f3a400604c69bf02d39"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/pint/zipball/69dcca060ecb15e4b564af63d1f642c81a241d6f",
|
||||
"reference": "69dcca060ecb15e4b564af63d1f642c81a241d6f",
|
||||
"url": "https://api.github.com/repos/laravel/pint/zipball/bdec963f53172c5e36330f3a400604c69bf02d39",
|
||||
"reference": "bdec963f53172c5e36330f3a400604c69bf02d39",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -6545,13 +6545,14 @@
|
||||
"php": "^8.2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.90.0",
|
||||
"illuminate/view": "^12.40.1",
|
||||
"larastan/larastan": "^3.8.0",
|
||||
"laravel-zero/framework": "^12.0.4",
|
||||
"friendsofphp/php-cs-fixer": "^3.94.2",
|
||||
"illuminate/view": "^12.54.1",
|
||||
"larastan/larastan": "^3.9.3",
|
||||
"laravel-zero/framework": "^12.0.5",
|
||||
"mockery/mockery": "^1.6.12",
|
||||
"nunomaduro/termwind": "^2.3.3",
|
||||
"pestphp/pest": "^3.8.4"
|
||||
"nunomaduro/termwind": "^2.4.0",
|
||||
"pestphp/pest": "^3.8.6",
|
||||
"shipfastlabs/agent-detector": "^1.1.0"
|
||||
},
|
||||
"bin": [
|
||||
"builds/pint"
|
||||
@@ -6588,7 +6589,7 @@
|
||||
"issues": "https://github.com/laravel/pint/issues",
|
||||
"source": "https://github.com/laravel/pint"
|
||||
},
|
||||
"time": "2025-11-25T21:15:52+00:00"
|
||||
"time": "2026-03-12T15:51:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/sail",
|
||||
@@ -9339,7 +9340,7 @@
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": "^8.2"
|
||||
"php": "^8.4"
|
||||
},
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.9.0"
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
@@ -62,7 +64,7 @@ return [
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => env('AUTH_MODEL', App\Models\User::class),
|
||||
'model' => env('AUTH_MODEL', User::class),
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Pdo\Mysql;
|
||||
|
||||
return [
|
||||
|
||||
@@ -59,7 +60,7 @@ return [
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
|
||||
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
@@ -79,7 +80,7 @@ return [
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
|
||||
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\DBI\IndexController as DBIIndexController;
|
||||
use App\Http\Controllers\Tinfoil\IndexController as TinfoilIndexController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
@@ -7,9 +9,9 @@ use Illuminate\Support\Facades\Route;
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
Route::get('tinfoil', \App\Http\Controllers\Tinfoil\IndexController::class)
|
||||
Route::get('tinfoil', TinfoilIndexController::class)
|
||||
->name('tinfoil');
|
||||
|
||||
Route::get('dbi/{path?}', \App\Http\Controllers\DBI\IndexController::class)
|
||||
Route::get('dbi/{path?}', DBIIndexController::class)
|
||||
->where('path', '.*')
|
||||
->name('dbi');
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::view('/', 'welcome')->middleware([
|
||||
EnsureIsDbiClient::class,
|
||||
EnsureIsTinfoilClient::class
|
||||
EnsureIsTinfoilClient::class,
|
||||
]);
|
||||
|
||||
Route::get('/docs/{page}', function ($page) {
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Test Case
|
||||
@@ -11,7 +13,7 @@
|
||||
|
|
||||
*/
|
||||
|
||||
pest()->extend(Tests\TestCase::class)
|
||||
pest()->extend(TestCase::class)
|
||||
// ->use(Illuminate\Foundation\Testing\RefreshDatabase::class)
|
||||
->in('Feature');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user