diff --git a/.dockerignore b/.dockerignore index 0d51aa7..bad4b3f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,6 +9,7 @@ README.md .phpunit.result.cache .styleci.yml /docker/ +!docker/php-fpm.d/www.conf phpunit.xml /tests/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 299bd36..cee9c71 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,7 @@ on: pull_request: branches: - production + workflow_dispatch: env: IMAGE_NAME: "lumen-actions-sandbox" @@ -23,13 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - with: - php-version: '7.4' - tools: pecl + - name: Set PHP version to 7.4 + run: sudo update-alternatives --set php /usr/bin/php7.4 - name: Copy .env run: php -r "file_exists('.env') || copy('.env.example', '.env');" - name: Install Dependencies - run: composer install --no-interaction --no-scripts --no-progress --prefer-dist + run: composer install --no-interaction --no-scripts --no-progress --prefer-dist --classmap-authoritative - name: Directory Permissions run: mkdir -p storage bootstrap/cache && chmod -R 777 storage bootstrap/cache - name: Execute tests (Unit and Feature tests) via PHPUnit @@ -40,14 +40,17 @@ jobs: run: | echo "::set-env name=IMAGE_NAME::$IMAGE_NAME_PRODUCTION" + - name: Create version.json + run: | + php artisan deploy:version ${{ github.run_number }} ${{ github.head_ref }} >storage/versions.json + - name: Build the Docker image run: | - php artisan version ${{ github.run_number }} ${{ github.head_ref }} >storage/version.env docker build . --file docker/Dockerfile \ --tag "$IMAGE_NAME":"$GITHUB_RUN_NUMBER" \ --tag "$REPO_ROOT"/"$GCP_PROJECT"/"$IMAGE_NAME":"$GITHUB_RUN_NUMBER" - - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master + - uses: google-github-actions/setup-gcloud@master with: service_account_key: ${{ secrets.GCP_KEY }} # Configure docker to use the gcloud command-line tool as a credential helper @@ -72,7 +75,7 @@ jobs: run: | echo "::set-env name=GCP_PROJECT::$GCP_PROJECT_PRODUCTION" - - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master + - uses: google-github-actions/setup-gcloud@master with: service_account_key: ${{ secrets.GCP_KEY }} diff --git a/.github/workflows/env.yml b/.github/workflows/env.yml index 58fc239..23f10c1 100644 --- a/.github/workflows/env.yml +++ b/.github/workflows/env.yml @@ -20,6 +20,8 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set PHP version to 7.4 + run: sudo update-alternatives --set php /usr/bin/php7.4 - name: Environment run: | echo github.event: ${{ github.event }} @@ -31,3 +33,5 @@ jobs: echo github.head_ref: ${{ github.head_ref }} echo github.base_ref: ${{ github.base_ref }} env + php -version + update-alternatives --list php diff --git a/app/Console/Commands/VersionCommand.php b/app/Console/Commands/VersionCommand.php index 0fe022d..327e1b5 100644 --- a/app/Console/Commands/VersionCommand.php +++ b/app/Console/Commands/VersionCommand.php @@ -10,14 +10,14 @@ class VersionCommand extends Command * * @var string */ - protected $signature = 'version {run_number?} {ref?}'; + protected $signature = 'deploy:version {run_number?} {ref?}'; /** * The console command description. * * @var string */ - protected $description = 'Read and print a .Net Approvals file'; + protected $description = 'Create a versions file'; /** * Create a new command instance. @@ -47,10 +47,19 @@ public function handle() ); $hash = exec("git rev-parse --short HEAD"); - $this->info("MAJOR = 1"); - $this->info("MINOR = 0"); - $this->info("PATCH = $run_number"); - $this->info("SHORT_HASH = $hash"); - $this->info("BRANCH = " . $branch); + $date = exec("git show -s --format=%ci {$hash}"); + + $versions = [ + 'groupvitals-ccb' => [ + 'major' => 1, + 'minor' => 0, + 'patch' => $run_number, + 'branch' => $branch, + 'hash' => $hash, + 'date' => $date + ], + 'lumen' => 'v6.3.5' + ]; + echo json_encode($versions, JSON_PRETTY_PRINT); } } \ No newline at end of file diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 8b7804a..35894a3 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -2,6 +2,7 @@ namespace App\Console; +use App\Console\Commands\VersionCommand; use Illuminate\Console\Scheduling\Schedule; use Laravel\Lumen\Console\Kernel as ConsoleKernel; @@ -13,7 +14,7 @@ class Kernel extends ConsoleKernel * @var array */ protected $commands = [ - \App\Console\Commands\VersionCommand::class + VersionCommand::class ]; /** diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php index 9ead03a..4f7dc45 100644 --- a/app/Http/Controllers/StatusController.php +++ b/app/Http/Controllers/StatusController.php @@ -2,11 +2,11 @@ namespace App\Http\Controllers; -use \Illuminate\Support\Env; +use Illuminate\Support\Str; class StatusController extends Controller { - + private $logger; /** * StatusController constructor. */ @@ -15,18 +15,40 @@ public function __construct() } public function index() { - $dotenv = \Dotenv\Dotenv::create('/usr/local/gv-ccb', '.version'); - $version = $dotenv->load(); - - return response()->json( - [ - 'app' => "{$version['MAJOR']}.{$version['MINOR']}.{$version['PATCH']}-{$version['SHORT_HASH']}", - 'mysql' => '5.7', - 'lumen' => '6.0', - 'version' => $version, - 'env' => getenv(), - 'Env' => Env::getVariables() - ] - ); + $lumen_version = "v6.0"; + try { + $versions_json = json_decode( + file_get_contents(storage_path('versions.json')) + ); + if (filled($versions_json->{'groupvitals-ccb'})) { + $ccb_version = $versions_json->{'groupvitals-ccb'}; + $version = filled($ccb_version) ? + "{$ccb_version->major}.{$ccb_version->minor}.{$ccb_version->patch}" : ""; + if (filled($ccb_version->branch) && !Str::endsWith($ccb_version->branch, 'production')) { + $version = "${version}-" . Str::slug($ccb_version->branch, '_'); + } + if (filled($ccb_version->hash)) { + $version = "${version}-{$ccb_version->hash}"; + } + if(filled($ccb_version->date)) { + $version .= " on {$ccb_version->date}"; + } + } + if(filled($versions_json->lumen)) { + $lumen_version = $versions_json->lumen; + } + } catch (\Exception $exception) { + $this->logger->error("Could not load version.json: {$exception->getMessage()}"); + $version = "unknown"; + } + $status = [ + env('APP_NAME') => $version, + 'lumen' => $lumen_version, + 'mysql' => '5.7.25-google-log', // TODO read from DB::connection()... + ]; + if (env('APP_DEBUG', false)) { + $status['Environment'] = $_ENV; + } + return response()->json($status); } } \ No newline at end of file diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 0000000..ce9b632 --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1,5 @@ +theme: jekyll-theme-slate + +title: Lumen, GH-Actions and GCP Sandbox +description: A place to experiment with and learn about Lumen, Github Actions and Google Cloud Platform. + diff --git a/docs/coverage/html/Console/Commands/VersionCommand.php.html b/docs/coverage/html/Console/Commands/VersionCommand.php.html new file mode 100644 index 0000000..811fc68 --- /dev/null +++ b/docs/coverage/html/Console/Commands/VersionCommand.php.html @@ -0,0 +1,241 @@ + + +
+ ++ | Code Coverage |
+ |||||||||
+ | Classes and Traits |
+ Functions and Methods |
+ Lines |
+ |||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ CRAP | +
+
+
+ |
+ 0.00% |
+ 0 / 20 |
+
VersionCommand | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ 12 | +
+
+
+ |
+ 0.00% |
+ 0 / 20 |
+
__construct | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ |||
handle | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 6 | +
+
+
+ |
+ 0.00% |
+ 0 / 18 |
+
<?php | |
namespace App\Console\Commands; | |
use Illuminate\Console\Command; | |
class VersionCommand extends Command | |
{ | |
/** | |
* The name and signature of the console command. | |
* | |
* @var string | |
*/ | |
protected $signature = 'deploy:version {run_number?} {ref?}'; | |
/** | |
* The console command description. | |
* | |
* @var string | |
*/ | |
protected $description = 'Create a versions file'; | |
/** | |
* Create a new command instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
parent::__construct(); | |
} | |
/** | |
* Execute the console command. | |
* | |
* @return mixed | |
*/ | |
public function handle() | |
{ | |
$run_number = $this->argument('run_number'); | |
if (!$run_number) { | |
$run_number = 0; | |
} | |
$ref = $this->argument('ref'); | |
$branch = str_replace( | |
'/', '_', | |
str_replace('refs/heads/', '', $ref) | |
); | |
$hash = exec("git rev-parse --short HEAD"); | |
$date = exec("git show -s --format=%ci {$hash}"); | |
$versions = [ | |
'groupvitals-ccb' => [ | |
'major' => 1, | |
'minor' => 0, | |
'patch' => $run_number, | |
'branch' => $branch, | |
'hash' => $hash, | |
'date' => $date | |
], | |
'lumen' => 'v6.3.5' | |
]; | |
echo json_encode($versions, JSON_PRETTY_PRINT); | |
} | |
} |
Class | +Coverage | +
---|---|
App\Console\Commands\VersionCommand | 0% |
Class | +CRAP | +
---|---|
App\Console\Commands\VersionCommand | 12 |
Method | +Coverage | +
---|---|
__construct | 0% |
handle | 0% |
Method | +CRAP | +
---|---|
handle | 6 |
+ | Code Coverage |
+ ||||||||
+ | Lines |
+ Functions and Methods |
+ Classes and Traits |
+ ||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 20 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 20 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+ | Code Coverage |
+ |||||||||
+ | Classes and Traits |
+ Functions and Methods |
+ Lines |
+ |||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ CRAP | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
Kernel | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
schedule | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
<?php | |
namespace App\Console; | |
use App\Console\Commands\VersionCommand; | |
use Illuminate\Console\Scheduling\Schedule; | |
use Laravel\Lumen\Console\Kernel as ConsoleKernel; | |
class Kernel extends ConsoleKernel | |
{ | |
/** | |
* The Artisan commands provided by your application. | |
* | |
* @var array | |
*/ | |
protected $commands = [ | |
VersionCommand::class | |
]; | |
/** | |
* Define the application's command schedule. | |
* | |
* @param \Illuminate\Console\Scheduling\Schedule $schedule | |
* @return void | |
*/ | |
protected function schedule(Schedule $schedule) | |
{ | |
// | |
} | |
} |
Class | +Coverage | +
---|---|
App\Console\Commands\VersionCommand | 0% |
App\Console\Kernel | 0% |
Class | +CRAP | +
---|---|
App\Console\Commands\VersionCommand | 12 |
Method | +Coverage | +
---|---|
__construct | 0% |
handle | 0% |
schedule | 0% |
Method | +CRAP | +
---|---|
handle | 6 |
+ | Code Coverage |
+ ||||||||
+ | Lines |
+ Functions and Methods |
+ Classes and Traits |
+ ||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 21 |
+
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+
+
+
+ |
+ 0.00% |
+ 0 / 20 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ |
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+ | Code Coverage |
+ |||||||||
+ | Classes and Traits |
+ Functions and Methods |
+ Lines |
+ |||||||
Total | ++ | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+ CRAP | ++ | n/a |
+ 0 / 0 |
+
Event | ++ | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+ 0 | ++ | n/a |
+ 0 / 0 |
+
<?php | |
namespace App\Events; | |
use Illuminate\Queue\SerializesModels; | |
abstract class Event | |
{ | |
use SerializesModels; | |
} |
Class | +Coverage | +
---|
Class | +CRAP | +
---|
Method | +Coverage | +
---|
Method | +CRAP | +
---|
+ | Code Coverage |
+ ||||||||
+ | Lines |
+ Functions and Methods |
+ Classes and Traits |
+ ||||||
Total | ++ | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+
+ | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+
+ | Code Coverage |
+ |||||||||
+ | Classes and Traits |
+ Functions and Methods |
+ Lines |
+ |||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ CRAP | +
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+
Handler | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ 6 | +
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+
report | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ |||
render | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
<?php | |
namespace App\Exceptions; | |
use Exception; | |
use Illuminate\Auth\Access\AuthorizationException; | |
use Illuminate\Database\Eloquent\ModelNotFoundException; | |
use Illuminate\Validation\ValidationException; | |
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler; | |
use Symfony\Component\HttpKernel\Exception\HttpException; | |
class Handler extends ExceptionHandler | |
{ | |
/** | |
* A list of the exception types that should not be reported. | |
* | |
* @var array | |
*/ | |
protected $dontReport = [ | |
AuthorizationException::class, | |
HttpException::class, | |
ModelNotFoundException::class, | |
ValidationException::class, | |
]; | |
/** | |
* Report or log an exception. | |
* | |
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. | |
* | |
* @param \Exception $exception | |
* @return void | |
*/ | |
public function report(Exception $exception) | |
{ | |
parent::report($exception); | |
} | |
/** | |
* Render an exception into an HTTP response. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \Exception $exception | |
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse | |
*/ | |
public function render($request, Exception $exception) | |
{ | |
return parent::render($request, $exception); | |
} | |
} |
Class | +Coverage | +
---|---|
App\Exceptions\Handler | 0% |
Class | +CRAP | +
---|
+ | Code Coverage |
+ ||||||||
+ | Lines |
+ Functions and Methods |
+ Classes and Traits |
+ ||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+ | Code Coverage |
+ |||||||||
+ | Classes and Traits |
+ Functions and Methods |
+ Lines |
+ |||||||
Total | ++ | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+ CRAP | ++ | n/a |
+ 0 / 0 |
+
Controller | ++ | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+ 0 | ++ | n/a |
+ 0 / 0 |
+
<?php | |
namespace App\Http\Controllers; | |
use Laravel\Lumen\Routing\Controller as BaseController; | |
class Controller extends BaseController | |
{ | |
// | |
} |
+ | Code Coverage |
+ |||||||||
+ | Classes and Traits |
+ Functions and Methods |
+ Lines |
+ |||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+ CRAP | +
+
+
+ |
+ 0.00% |
+ 0 / 14 |
+
GroupController | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+ 12 | +
+
+
+ |
+ 0.00% |
+ 0 / 14 |
+
__construct | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ |||
index | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 6 |
+ |||
show | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 7 |
+
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Support\Facades\DB; | |
class GroupController extends Controller | |
{ | |
/** | |
* Create a new controller instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
// | |
} | |
public function index($church_id) { | |
$groups = DB::table('groups') | |
->where('church_id', '=', $church_id) | |
->select([ | |
'id', 'church_id', 'campus_id', 'name', 'status', | |
'active', 'address', 'city', 'state', 'zipcode']) | |
->get(); | |
return response()->json($groups); | |
} | |
public function show($church_id, $group_id) { | |
$group = DB::table('groups') | |
->where('church_id', '=', $church_id) | |
->where('id', '=', $group_id) | |
->select([ | |
'id', 'church_id', 'campus_id', 'name', 'status', | |
'active', 'address', 'city', 'state', 'zipcode']) | |
->get(); | |
return response()->json($group); | |
} | |
} |
+ | Code Coverage |
+ |||||||||
+ | Classes and Traits |
+ Functions and Methods |
+ Lines |
+ |||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+ CRAP | +
+
+
+ |
+ 0.00% |
+ 0 / 14 |
+
PeopleController | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+ 12 | +
+
+
+ |
+ 0.00% |
+ 0 / 14 |
+
__construct | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ |||
index | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 6 |
+ |||
show | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 7 |
+
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Support\Facades\DB; | |
class PeopleController extends Controller | |
{ | |
/** | |
* Create a new controller instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
// | |
} | |
public function index($church_id) { | |
$people = DB::table('people') | |
->where('church_id', '=', $church_id) | |
->select([ | |
'id', 'church_id', 'campus_id', | |
'first_name', 'middle_name', 'last_name', | |
'email', 'status', 'address', 'city', | |
'state', 'zip']) | |
->get(); | |
return response()->json($people); | |
} | |
public function show($church_id, $person_id) { | |
$person = DB::table('people') | |
->where('church_id', '=', $church_id) | |
->where('id', '=', $person_id) | |
->select([ | |
'id', 'church_id', 'campus_id', | |
'first_name', 'middle_name', 'last_name', | |
'email', 'status', 'address', 'city', | |
'state', 'zip']) | |
->get(); | |
return response()->json($person); | |
} | |
} |
+ | Code Coverage |
+ |||||||||
+ | Classes and Traits |
+ Functions and Methods |
+ Lines |
+ |||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ CRAP | +
+
+
+ |
+ 0.00% |
+ 0 / 25 |
+
StatusController | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ 132 | +
+
+
+ |
+ 0.00% |
+ 0 / 25 |
+
__construct | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ |||
index | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 110 | +
+
+
+ |
+ 0.00% |
+ 0 / 24 |
+
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Support\Str; | |
class StatusController extends Controller | |
{ | |
private $logger; | |
/** | |
* StatusController constructor. | |
*/ | |
public function __construct() | |
{ | |
} | |
public function index() { | |
$lumen_version = "v6.0"; | |
try { | |
$versions_json = json_decode( | |
file_get_contents(storage_path('versions.json')) | |
); | |
if (filled($versions_json->{'groupvitals-ccb'})) { | |
$ccb_version = $versions_json->{'groupvitals-ccb'}; | |
$version = filled($ccb_version) ? | |
"{$ccb_version->major}.{$ccb_version->minor}.{$ccb_version->patch}" : ""; | |
if (filled($ccb_version->branch) && !Str::endsWith($ccb_version->branch, 'production')) { | |
$version = "${version}-" . Str::slug($ccb_version->branch, '_'); | |
} | |
if (filled($ccb_version->hash)) { | |
$version = "${version}-{$ccb_version->hash}"; | |
} | |
if(filled($ccb_version->date)) { | |
$version .= " on {$ccb_version->date}"; | |
} | |
} | |
if(filled($versions_json->lumen)) { | |
$lumen_version = $versions_json->lumen; | |
} | |
} catch (\Exception $exception) { | |
$this->logger->error("Could not load version.json: {$exception->getMessage()}"); | |
$version = "unknown"; | |
} | |
$status = [ | |
env('APP_NAME') => $version, | |
'lumen' => $lumen_version, | |
'mysql' => '5.7.25-google-log', // TODO read from DB::connection()... | |
]; | |
if (env('APP_DEBUG', false)) { | |
$status['Environment'] = $_ENV; | |
} | |
return response()->json($status); | |
} | |
} |
Class | +Coverage | +
---|---|
App\Http\Controllers\GroupController | 0% |
App\Http\Controllers\PeopleController | 0% |
App\Http\Controllers\StatusController | 0% |
Class | +CRAP | +
---|---|
App\Http\Controllers\StatusController | 132 |
Method | +Coverage | +
---|---|
__construct | 0% |
index | 0% |
show | 0% |
__construct | 0% |
index | 0% |
show | 0% |
__construct | 0% |
index | 0% |
Method | +CRAP | +
---|---|
index | 110 |
+ | Code Coverage |
+ ||||||||
+ | Lines |
+ Functions and Methods |
+ Classes and Traits |
+ ||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 53 |
+
+
+
+ |
+ 0.00% |
+ 0 / 8 |
+
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+
+ | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+ |
+
+
+ |
+ 0.00% |
+ 0 / 14 |
+
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ |
+
+
+ |
+ 0.00% |
+ 0 / 14 |
+
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ |
+
+
+ |
+ 0.00% |
+ 0 / 25 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+ | Code Coverage |
+ |||||||||
+ | Classes and Traits |
+ Functions and Methods |
+ Lines |
+ |||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ CRAP | +
+
+
+ |
+ 0.00% |
+ 0 / 5 |
+
Authenticate | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ 12 | +
+
+
+ |
+ 0.00% |
+ 0 / 5 |
+
__construct | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ |||
handle | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 6 | +
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Contracts\Auth\Factory as Auth; | |
class Authenticate | |
{ | |
/** | |
* The authentication guard factory instance. | |
* | |
* @var \Illuminate\Contracts\Auth\Factory | |
*/ | |
protected $auth; | |
/** | |
* Create a new middleware instance. | |
* | |
* @param \Illuminate\Contracts\Auth\Factory $auth | |
* @return void | |
*/ | |
public function __construct(Auth $auth) | |
{ | |
$this->auth = $auth; | |
} | |
/** | |
* Handle an incoming request. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \Closure $next | |
* @param string|null $guard | |
* @return mixed | |
*/ | |
public function handle($request, Closure $next, $guard = null) | |
{ | |
if ($this->auth->guard($guard)->guest()) { | |
return response('Unauthorized.', 401); | |
} | |
return $next($request); | |
} | |
} |
Class | +Coverage | +
---|---|
App\Http\Middleware\Authenticate | 0% |
Class | +CRAP | +
---|---|
App\Http\Middleware\Authenticate | 12 |
Method | +Coverage | +
---|---|
__construct | 0% |
handle | 0% |
Method | +CRAP | +
---|---|
handle | 6 |
+ | Code Coverage |
+ ||||||||
+ | Lines |
+ Functions and Methods |
+ Classes and Traits |
+ ||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 5 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 5 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
Class | +Coverage | +
---|---|
App\Http\Controllers\GroupController | 0% |
App\Http\Controllers\PeopleController | 0% |
App\Http\Controllers\StatusController | 0% |
App\Http\Middleware\Authenticate | 0% |
Class | +CRAP | +
---|---|
App\Http\Controllers\StatusController | 132 |
App\Http\Middleware\Authenticate | 12 |
Method | +Coverage | +
---|---|
__construct | 0% |
index | 0% |
show | 0% |
__construct | 0% |
index | 0% |
show | 0% |
__construct | 0% |
index | 0% |
__construct | 0% |
handle | 0% |
+ | Code Coverage |
+ ||||||||
+ | Lines |
+ Functions and Methods |
+ Classes and Traits |
+ ||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 58 |
+
+
+
+ |
+ 0.00% |
+ 0 / 10 |
+
+
+
+ |
+ 0.00% |
+ 0 / 4 |
+
+
+
+ |
+ 0.00% |
+ 0 / 53 |
+
+
+
+ |
+ 0.00% |
+ 0 / 8 |
+
+
+
+ |
+ 0.00% |
+ 0 / 3 |
+ |
+
+
+ |
+ 0.00% |
+ 0 / 5 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+ | Code Coverage |
+ |||||||||
+ | Classes and Traits |
+ Functions and Methods |
+ Lines |
+ |||||||
Total | ++ | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+ CRAP | ++ | n/a |
+ 0 / 0 |
+
Job | ++ | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+ 0 | ++ | n/a |
+ 0 / 0 |
+
<?php | |
namespace App\Jobs; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
use Illuminate\Queue\InteractsWithQueue; | |
use Illuminate\Queue\SerializesModels; | |
abstract class Job implements ShouldQueue | |
{ | |
/* | |
|-------------------------------------------------------------------------- | |
| Queueable Jobs | |
|-------------------------------------------------------------------------- | |
| | |
| This job base class provides a central location to place any logic that | |
| is shared across all of your jobs. The trait included with the class | |
| provides access to the "queueOn" and "delay" queue helper methods. | |
| | |
*/ | |
use InteractsWithQueue, Queueable, SerializesModels; | |
} |
Class | +Coverage | +
---|
Class | +CRAP | +
---|
Method | +Coverage | +
---|
Method | +CRAP | +
---|
+ | Code Coverage |
+ ||||||||
+ | Lines |
+ Functions and Methods |
+ Classes and Traits |
+ ||||||
Total | ++ | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+
+ | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+ + | n/a |
+ 0 / 0 |
+
+ | Code Coverage |
+ |||||||||
+ | Classes and Traits |
+ Functions and Methods |
+ Lines |
+ |||||||
Total | +
+
+
+ |
+ 100.00% |
+ 1 / 1 |
+
+
+
+ |
+ 100.00% |
+ 1 / 1 |
+ CRAP | +
+
+
+ |
+ 100.00% |
+ 1 / 1 |
+
AppServiceProvider | +
+
+
+ |
+ 100.00% |
+ 1 / 1 |
+
+
+
+ |
+ 100.00% |
+ 1 / 1 |
+ 1 | +
+
+
+ |
+ 100.00% |
+ 1 / 1 |
+
register | +
+
+
+ |
+ 100.00% |
+ 1 / 1 |
+ 1 | +
+
+
+ |
+ 100.00% |
+ 1 / 1 |
+
<?php | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Register any application services. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
// | |
} | |
} |
+ | Code Coverage |
+ |||||||||
+ | Classes and Traits |
+ Functions and Methods |
+ Lines |
+ |||||||
Total | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ CRAP | +
+
+
+ |
+ 0.00% |
+ 0 / 5 |
+
AuthServiceProvider | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+ 12 | +
+
+
+ |
+ 0.00% |
+ 0 / 5 |
+
register | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 2 | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ |||
boot | +
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+ 6 | +
+
+
+ |
+ 0.00% |
+ 0 / 4 |
+
<?php | |
namespace App\Providers; | |
use App\User; | |
use Illuminate\Support\Facades\Gate; | |
use Illuminate\Support\ServiceProvider; | |
class AuthServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Register any application services. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
// | |
} | |
/** | |
* Boot the authentication services for the application. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
// Here you may define how you wish users to be authenticated for your Lumen | |
// application. The callback which receives the incoming request instance | |
// should return either a User instance or null. You're free to obtain | |
// the User instance via an API token or any other method necessary. | |
$this->app['auth']->viaRequest('api', function ($request) { | |
if ($request->input('api_token')) { | |
return User::where('api_token', $request->input('api_token'))->first(); | |
} | |
}); | |
} | |
} |
Class | +Coverage | +
---|---|
App\Providers\AuthServiceProvider | 0% |
Class | +CRAP | +
---|---|
App\Providers\AuthServiceProvider | 12 |
+ | Code Coverage |
+ ||||||||
+ | Lines |
+ Functions and Methods |
+ Classes and Traits |
+ ||||||
Total | +
+
+
+ |
+ 16.67% |
+ 1 / 6 |
+
+
+
+ |
+ 33.33% |
+ 1 / 3 |
+
+
+
+ |
+ 50.00% |
+ 1 / 2 |
+
+
+
+ |
+ 100.00% |
+ 1 / 1 |
+
+
+
+ |
+ 100.00% |
+ 1 / 1 |
+
+
+
+ |
+ 100.00% |
+ 1 / 1 |
+ |
+
+
+ |
+ 0.00% |
+ 0 / 5 |
+
+
+
+ |
+ 0.00% |
+ 0 / 2 |
+
+
+
+ |
+ 0.00% |
+ 0 / 1 |
+
0)for(u=-1;++u","
"],col:[2,"
"],tr:[2,"","
"],td:[3,"
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n","