-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NGSTACK-886 add symfony skeleton recipe
- Loading branch information
1 parent
fa394c3
commit ca6848b
Showing
7 changed files
with
264 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Update Flex endpoint - test | ||
|
||
on: | ||
push: | ||
branches: | ||
- symfony-skeleton-test | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
call-flex-update: | ||
uses: netgen/recipes/.github/workflows/callable-flex-update.yml@symfony-skeleton-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PER' => true, | ||
'@PER:risky' => true, | ||
'@PhpCsFixer' => true, | ||
'@PhpCsFixer:risky' => true, | ||
|
||
// Overrides for rules included in PhpCsFixer rule sets | ||
'concat_space' => ['spacing' => 'one'], | ||
'fully_qualified_strict_types' => ['phpdoc_tags' => []], | ||
'method_chaining_indentation' => false, | ||
'multiline_whitespace_before_semicolons' => false, | ||
'native_function_invocation' => ['include' => ['@all']], | ||
'no_superfluous_phpdoc_tags' => false, | ||
'no_unset_on_property' => false, | ||
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'], | ||
'ordered_types' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'alpha'], | ||
'php_unit_internal_class' => false, | ||
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], | ||
'php_unit_test_class_requires_covers' => false, | ||
'phpdoc_align' => false, | ||
'phpdoc_order' => ['order' => ['param', 'throws', 'return']], | ||
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], | ||
'single_line_comment_style' => false, | ||
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments', 'match', 'parameters']], | ||
'yoda_style' => false, | ||
|
||
// Additional rules | ||
'date_time_immutable' => true, | ||
'declare_strict_types' => true, | ||
'global_namespace_import' => [ | ||
'import_classes' => null, | ||
'import_constants' => true, | ||
'import_functions' => true, | ||
], | ||
'heredoc_indentation' => ['indentation' => 'same_as_start'], | ||
'mb_str_functions' => true, | ||
'native_constant_invocation' => true, | ||
'nullable_type_declaration_for_default_null_value' => true, | ||
'static_lambda' => true, | ||
'ternary_to_null_coalescing' => true, | ||
'use_arrow_functions' => true, | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in(['src', 'tests']) | ||
->notPath(['Kernel.php', 'bootstrap.php']), | ||
) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
APP_ENV = dev | ||
PHP_VERSION = php8.2 | ||
PHP_RUN = /usr/bin/env $(PHP_VERSION) | ||
COMPOSER_PATH = /usr/local/bin/composer2 | ||
ifeq ("$(wildcard $(COMPOSER_PATH))","") | ||
COMPOSER_PATH = /usr/local/bin/composer | ||
endif | ||
COMPOSER_RUN = $(PHP_RUN) $(COMPOSER_PATH) | ||
CACHE_POOL = cache.redis | ||
STASH_HASH := $(shell git stash create) | ||
|
||
.PHONY: help | ||
help: ## List of all available commands | ||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | ||
|
||
.DEFAULT_GOAL := help | ||
|
||
.PHONY: php-version | ||
php-version: ## See PHP version needed for this project | ||
@echo $(PHP_VERSION) | ||
|
||
COMPOSER_INSTALL_PARAMETERS = | ||
ifeq ($(APP_ENV), prod) | ||
COMPOSER_INSTALL_PARAMETERS = --no-dev -o | ||
endif | ||
|
||
.PHONY: vendor | ||
vendor: ## Run composer install | ||
$(COMPOSER_RUN) install $(COMPOSER_INSTALL_PARAMETERS) | ||
|
||
.PHONY: assets | ||
.ONESHELL: | ||
assets: ## Build frontend assets for DEV environment | ||
. ${NVM_DIR}/nvm.sh && nvm use || nvm install $(cat .nvmrc) | ||
yarn install | ||
yarn build:dev | ||
|
||
.PHONY: assets-prod | ||
.ONESHELL: | ||
assets-prod: ## Build frontend assets for PROD environment | ||
. ${NVM_DIR}/nvm.sh && nvm use || nvm install $(cat .nvmrc) | ||
yarn install | ||
yarn build:prod | ||
|
||
.PHONY: assets-watch | ||
.ONESHELL: | ||
assets-watch: ## Watch frontend assets (during development) | ||
. ${NVM_DIR}/nvm.sh && nvm use || nvm install $(cat .nvmrc) | ||
yarn install | ||
yarn watch | ||
|
||
.PHONY: clear-cache | ||
clear-cache: ## Clear caches for specified environment (default: APP_ENV=dev) | ||
$(PHP_RUN) bin/console cache:clear --env=$(APP_ENV) | ||
|
||
.PHONY: clear-all-cache | ||
clear-all-cache: ## Clear all caches for specified environment (including eg. Redis) (default: APP_ENV=dev) | ||
@$(MAKE) -s clear-cache | ||
$(PHP_RUN) bin/console cache:pool:clear $(CACHE_POOL) --env=$(APP_ENV) | ||
|
||
.PHONY: migrations | ||
migrations: ## Run Doctrine migrations for specified environment (default: APP_ENV=dev) | ||
$(PHP_RUN) bin/console doctrine:migration:migrate --allow-no-migration --env=$(APP_ENV) | ||
|
||
.PHONY: build | ||
build: ## Build the project (install vendor, migrations, build assets, clear cache) for specified environment (default: APP_ENV=dev) | ||
@$(MAKE) -s vendor | ||
@$(MAKE) -s migrations | ||
ifeq ($(APP_ENV), prod) | ||
$(MAKE) -s assets-prod | ||
else | ||
$(MAKE) -s assets | ||
endif | ||
@$(MAKE) -s clear-cache | ||
|
||
.PHONY: update-code | ||
update-code: ## Pull the latest code from the repository (on the current branch) | ||
ifeq ($(STASH_HASH),) | ||
git pull --rebase | ||
else | ||
git stash && git pull --rebase && git stash pop | ||
endif | ||
|
||
.PHONY: refresh | ||
refresh: ## Fetch latest changes and build the project for specified environment (default: APP_ENV=dev) | ||
@$(MAKE) -s update-code | ||
@$(MAKE) -s build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
{ | ||
"commit-msg": { | ||
"enabled": true, | ||
"actions": [ | ||
{ | ||
"action": "\\Netgen\\GitHooks\\Action\\Regex", | ||
"options": { | ||
"regex": "/^[A-Z0-9]+-\\d+:?\\s/", | ||
"error": "Your commit message MUST start with a ticket ID" | ||
} | ||
} | ||
] | ||
}, | ||
"pre-push": { | ||
"enabled": false, | ||
"actions": [] | ||
}, | ||
"pre-commit": { | ||
"enabled": true, | ||
"actions": [ | ||
{ | ||
"action": "\\Netgen\\GitHooks\\Action\\CheckForBlockedWords", | ||
"options": { | ||
"extensions": ["php"], | ||
"keyword_blocklist": ["var_dump", "dump", "dd"], | ||
"excluded_files": [] | ||
} | ||
}, | ||
{ | ||
"action": "\\Netgen\\GitHooks\\Action\\CheckForBlockedWords", | ||
"options": { | ||
"extensions": ["twig"], | ||
"keyword_blocklist": ["dump"], | ||
"excluded_files": [] | ||
} | ||
}, | ||
{ | ||
"action": "\\CaptainHook\\App\\Hook\\Composer\\Action\\CheckLockFile" | ||
}, | ||
{ | ||
"action": "\\Netgen\\GitHooks\\Action\\PHPCSFixer", | ||
"options": { | ||
"excluded_files": ["deploy.php", "/^deploy.*/", "config/bundles.php"], | ||
"fixer_path": "vendor/bin/php-cs-fixer" | ||
} | ||
}, | ||
{ | ||
"action": "\\Netgen\\GitHooks\\Action\\PHPStan", | ||
"options": { | ||
"excluded_files": ["/^deploy.*/"] | ||
} | ||
}, | ||
{ | ||
"action": "\\Netgen\\GitHooks\\Action\\JSLinter", | ||
"options": { | ||
"excluded_files": [] | ||
} | ||
}, | ||
{ | ||
"action": "\\Netgen\\GitHooks\\Action\\JSPrettier", | ||
"options": { | ||
"excluded_files": [] | ||
} | ||
}, | ||
{ | ||
"action": "\\Netgen\\GitHooks\\Action\\CheckLockFileCommitted", | ||
"options": { | ||
"enabled": true | ||
} | ||
} | ||
] | ||
}, | ||
"prepare-commit-msg": { | ||
"enabled": false, | ||
"actions": [] | ||
}, | ||
"post-commit": { | ||
"enabled": false, | ||
"actions": [] | ||
}, | ||
"post-merge": { | ||
"enabled": false, | ||
"actions": [] | ||
}, | ||
"post-checkout": { | ||
"enabled": false, | ||
"actions": [] | ||
}, | ||
"config": { | ||
"php-path": "/usr/bin/env php8.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"copy-from-recipe": { | ||
"config/captainhook.json": "captainhook.json", | ||
"config/Makefile": "Makefile", | ||
"config/.nvmrc": ".nvmrc", | ||
"config/.php-cs-fixer.php": ".php-cs-fixer.php", | ||
"public/": "%PUBLIC_DIR%/" | ||
}, | ||
"env": { | ||
"CACHE_DSN": "redis://localhost" | ||
} | ||
} |