Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add awards page #67

Merged
merged 5 commits into from
Nov 16, 2024
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
15 changes: 15 additions & 0 deletions .castor/database.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

use Castor\Attribute\AsTask;

use function Castor\context;
use function Castor\io;
use function docker\docker_compose;

#[AsTask(description: 'Connect to the PostgreSQL database', name: 'db:client', aliases: ['postgres', 'pg'])]
function postgres_client(): void
{
io()->title('Connecting to the PostgreSQL database');

docker_compose(['exec', 'postgres', 'psql', '-U', 'app', 'app'], context()->toInteractive());
}
11 changes: 6 additions & 5 deletions .castor/docker.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function about(): void

try {
$routers = http_client()
->request('GET', sprintf('http://%s:8080/api/http/routers', variable('root_domain')))
->request('GET', \sprintf('http://%s:8080/api/http/routers', variable('root_domain')))
->toArray()
;
$projectName = variable('project_name');
Expand All @@ -50,7 +50,7 @@ function about(): void
if ("frontend-{$projectName}" === $router['service']) {
continue;
}
if (!preg_match('{^Host\\(`(?P<hosts>.*)`\\)$}', $router['rule'], $matches)) {
if (!preg_match('{^Host\(`(?P<hosts>.*)`\)$}', $router['rule'], $matches)) {
continue;
}
$hosts = explode('`) || Host(`', $matches['hosts']);
Expand Down Expand Up @@ -85,6 +85,7 @@ function build(
$command = [
...$command,
'build',
'--build-arg', 'USER_ID=' . variable('user_id'),
'--build-arg', 'PHP_VERSION=' . variable('php_version'),
'--build-arg', 'PROJECT_NAME=' . variable('project_name'),
];
Expand Down Expand Up @@ -342,19 +343,19 @@ function push(): void
}
}

$content = sprintf(<<<'EOHCL'
$content = \sprintf(<<<'EOHCL'
group "default" {
targets = [%s]
}


EOHCL
, implode(', ', array_map(fn ($target) => sprintf('"%s"', $target['target']), $targets)));
, implode(', ', array_map(fn ($target) => \sprintf('"%s"', $target['target']), $targets)));

foreach ($targets as $target) {
$reference = str_replace('${REGISTRY:-}', $registry, $target['reference'] ?? '');

$content .= sprintf(<<<'EOHCL'
$content .= \sprintf(<<<'EOHCL'
target "%s" {
context = "infrastructure/docker/%s"
dockerfile = "%s"
Expand Down
19 changes: 12 additions & 7 deletions .castor/qa.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ function install(): void
docker_compose_run('composer install -o', workDir: '/var/www/tools/phpstan');
}

#[AsTask(description: 'Updates tooling')]
function update(): void
{
io()->title('Updating QA tooling');

docker_compose_run('composer update -o', workDir: '/var/www/tools/php-cs-fixer');
docker_compose_run('composer update -o', workDir: '/var/www/tools/phpstan');
}

#[AsTask(description: 'Runs PHPUnit', aliases: ['phpunit'])]
function phpunit(): int
{
Expand All @@ -39,21 +48,17 @@ function phpunit(): int
function phpstan(bool $generateBaseline = false): int
{
if (!is_dir(variable('root_dir') . '/tools/phpstan/vendor')) {
io()->error('PHPStan is not installed. Run `castor qa:install` first.');

return 1;
install();
}

return docker_exit_code('phpstan' . ($generateBaseline ? ' -b' : ''), workDir: '/var/www');
return docker_exit_code('phpstan -v' . ($generateBaseline ? ' -b' : ''), workDir: '/var/www');
}

#[AsTask(description: 'Fixes Coding Style', aliases: ['cs'])]
function cs(bool $dryRun = false): int
{
if (!is_dir(variable('root_dir') . '/tools/php-cs-fixer/vendor')) {
io()->error('PHP-CS-Fixer is not installed. Run `castor qa:install` first.');

return 1;
install();
}

if ($dryRun) {
Expand Down
104 changes: 53 additions & 51 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,61 @@
"ext-ctype": "*",
"ext-iconv": "*",
"ext-uuid": "*",
"doctrine/doctrine-bundle": "^2.11.1",
"doctrine/doctrine-migrations-bundle": "^3.3.0",
"doctrine/orm": "^2.17.2",
"knplabs/knp-paginator-bundle": "^6.3",
"knpuniversity/oauth2-client-bundle": "^2.18",
"league/commonmark": "^2.4.1",
"doctrine/doctrine-bundle": "^2.13.0",
"doctrine/doctrine-migrations-bundle": "^3.3.1",
"doctrine/orm": "^2.20.0",
"knplabs/knp-paginator-bundle": "^6.6.1",
"knpuniversity/oauth2-client-bundle": "^2.18.3",
"league/commonmark": "^2.5.3",
"league/oauth2-google": "^4.0.1",
"nyholm/psr7": "^1.8.1",
"phpdocumentor/reflection-docblock": "^5.3",
"phpstan/phpdoc-parser": "^1.24.5",
"symfony/asset": "7.0.*",
"symfony/asset-mapper": "7.0.*",
"symfony/console": "7.0.*",
"symfony/dotenv": "7.0.*",
"symfony/expression-language": "7.0.*",
"symfony/flex": "^2.4.2",
"symfony/form": "7.0.*",
"symfony/framework-bundle": "7.0.*",
"symfony/http-client": "7.0.*",
"symfony/intl": "7.0.*",
"symfony/mime": "7.0.*",
"nyholm/psr7": "^1.8.2",
"phpdocumentor/reflection-docblock": "^5.6",
"phpstan/phpdoc-parser": "^1.33.0",
"symfony/asset": "^7.1.6",
"symfony/asset-mapper": "^7.1.8",
"symfony/console": "^7.1.8",
"symfony/dotenv": "^7.1.6",
"symfony/emoji": "^7.1",
"symfony/expression-language": "^7.1.6",
"symfony/flex": "^2.4.7",
"symfony/form": "^7.1.6",
"symfony/framework-bundle": "^7.1.6",
"symfony/http-client": "^7.1.8",
"symfony/intl": "^7.1.8",
"symfony/mime": "^7.1.6",
"symfony/monolog-bundle": "^3.10",
"symfony/process": "7.0.*",
"symfony/property-access": "7.0.*",
"symfony/property-info": "7.0.*",
"symfony/runtime": "7.0.*",
"symfony/security-bundle": "7.0.*",
"symfony/serializer": "7.0.*",
"symfony/string": "7.0.*",
"symfony/twig-bundle": "7.0.*",
"symfony/ux-chartjs": "*",
"symfony/ux-live-component": "^2.x-dev@dev",
"symfony/ux-turbo": "^2.13.2",
"symfony/ux-twig-component": "^2.x-dev@dev",
"symfony/validator": "7.0.*",
"symfony/web-link": "7.0.*",
"symfony/yaml": "7.0.*",
"twig/cache-extra": "^3.8",
"twig/extra-bundle": "^3.8",
"twig/html-extra": "^3.8",
"twig/intl-extra": "^3.8",
"twig/markdown-extra": "^3.8",
"twig/twig": "^3.8"
"symfony/process": "^7.1.8",
"symfony/property-access": "^7.1.6",
"symfony/property-info": "^7.1.8",
"symfony/runtime": "^7.1.7",
"symfony/security-bundle": "^7.1.6",
"symfony/serializer": "^7.1.8",
"symfony/string": "^7.1.8",
"symfony/twig-bundle": "^7.1.6",
"symfony/ux-chartjs": ">=2.21",
"symfony/ux-live-component": "^2.21",
"symfony/ux-turbo": "^2.21.0",
"symfony/ux-twig-component": "^2.21",
"symfony/validator": "^7.1.8",
"symfony/web-link": "^7.1.6",
"symfony/yaml": "^7.1.6",
"twig/cache-extra": "^3.13",
"twig/extra-bundle": "^3.13",
"twig/html-extra": "^3.13",
"twig/intl-extra": "^3.13",
"twig/markdown-extra": "^3.13",
"twig/twig": "^3.14.2"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.5.1",
"fakerphp/faker": "^1.23",
"symfony/browser-kit": "7.0.*",
"symfony/css-selector": "7.0.*",
"symfony/debug-bundle": "7.0.*",
"symfony/maker-bundle": "^1.52",
"symfony/phpunit-bridge": "^7",
"symfony/stopwatch": "7.0.*",
"symfony/web-profiler-bundle": "7.0.*"
"doctrine/doctrine-fixtures-bundle": "^3.6.2",
"fakerphp/faker": "^1.24",
"symfony/browser-kit": "^7.1.6",
"symfony/css-selector": "^7.1.6",
"symfony/debug-bundle": "^7.1.6",
"symfony/maker-bundle": "^1.61",
"symfony/phpunit-bridge": "^7.1.6",
"symfony/stopwatch": "^7.1.6",
"symfony/web-profiler-bundle": "^7.1.7"
},
"replace": {
"symfony/polyfill-ctype": "*",
Expand Down Expand Up @@ -100,6 +101,7 @@
]
},
"config": {
"bump-after-update": true,
"allow-plugins": {
"symfony/flex": true,
"symfony/runtime": true,
Expand All @@ -110,7 +112,7 @@
"extra": {
"symfony": {
"allow-contrib": false,
"require": "7.0.*"
"require": "^7.1"
}
}
}
Loading