Skip to content
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
11 changes: 11 additions & 0 deletions kocal/symfony-app-pack/1.0/.github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "composer" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
41 changes: 41 additions & 0 deletions kocal/symfony-app-pack/1.0/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

defaults:
run:
shell: bash

on:
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
qa:
if: ${{ ! github.event.pull_request.draft }}
name: Quality Assurance
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
extensions: ctype, iconv, mbstring
tools: symfony

- name: Start Docker containers
run: docker compose up -d --wait

- name: Install project
run: make app.install

- name: QA
run: make qa
10 changes: 10 additions & 0 deletions kocal/symfony-app-pack/1.0/.twig-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

$ruleset = new TwigCsFixer\Ruleset\Ruleset();
$ruleset->addStandard(new TwigCsFixer\Standard\Symfony());

$config = new TwigCsFixer\Config\Config();
$config->setCacheFile(__DIR__.'/tools/.cache/twig-cs-fixer');
$config->setRuleset($ruleset);

return $config;
180 changes: 180 additions & 0 deletions kocal/symfony-app-pack/1.0/Makefile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Makefile is not part of manifest, please either add to manifest or remove from PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Makefile can not be part of the manifest, please see #1936 (comment)

Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
include $(ROOT_DIR)/tools/make/text.mk
include $(ROOT_DIR)/tools/make/help.mk
include $(ROOT_DIR)/tools/make/os.mk
include $(ROOT_DIR)/tools/make/git.mk

.DEFAULT_GOAL := help

# Executables
SF := symfony
SF_PROXY = $(shell $(SF) local:proxy:url)
SF_CONSOLE := $(SF) console
PHP := $(SF) php
COMPOSER := $(SF) composer

UID := $(shell id -u)
GID := $(shell id -g)
DC := USER_ID=$(UID) GROUP_ID=$(GID) docker compose --env-file /dev/null

## Install everything needed to start the project
install:
$(SF) local:server:ca:install
$(MAKE) start
$(MAKE) app.install

## Start the environment
start:
$(DC) up -d
$(SF) proxy:start
$(SF) serve

## Stop the environment
stop:
$(DC) kill

## Stop and delete the environment and project data (database, logs, etc.)
delete:
$(DC) down -v --remove-orphans

## App - Install the application
app.install:
@$(call action, Installing PHP dependencies...)
$(COMPOSER) install --prefer-dist

@$(call action, Running DB migrations...)
$(SF_CONSOLE) doctrine:migrations:migrate --no-interaction --all-or-nothing

## App - Install the application (alias to "make app.install")
app.update: app.install

######
# QA #
######

## QA - Run all QA checks
qa: archi refactor cs lint phpstan test

## QA - Run all QA checks and fix issues
qa.fix: archi refactor.fix cs.fix lint.fix phpstan test

#########
# Archi #
#########

## Architecture - Run architecture checks
archi: archi.back

## Architecture - Run architecture checks for backend
archi.back:
$(PHP) vendor/bin/deptrac --report-uncovered --fail-on-uncovered

############
# Refactor #
############

## Refactor - Run all refactor checks
refactor: refactor.back

## Refactor - Run all refactor checks and fix issues
refactor.fix: refactor.back.fix

## Refactor - Run refactor checks for backend
refactor.back:
$(PHP) vendor/bin/rector process --dry-run

## Refactor - Run refactor checks for backend and fix issues
refactor.back.fix:
$(PHP) vendor/bin/rector process

################
# Coding style #
################

## Coding style - Run all coding style checks
cs: cs.back cs.front

## Coding style - Run all coding style checks and fix issues
cs.fix: cs.back.fix cs.front.fix

## Coding style - Check backend coding style
cs.back:
$(PHP) vendor/bin/ecs check
$(PHP) vendor/bin/twig-cs-fixer

## Coding style - Check backend coding style and fix issues
cs.back.fix:
$(PHP) vendor/bin/ecs check --fix
$(PHP) vendor/bin/twig-cs-fixer --fix

## Coding style - Check frontend coding style
cs.front: bin/oxfmt
bin/oxfmt --check

## Coding style - Check frontend coding style and fix issues
cs.front.fix: bin/oxfmt
bin/oxfmt

bin/oxfmt:
@$(call action, Downloading oxfmt...)
$(SF_CONSOLE) oxc:download:oxfmt
@$(call success, oxfmt downloaded successfully)

##########
# Linter #
##########

## Linter - Run all linters
lint: lint.back lint.front

## Linter - Run all linters and fix issues
lint.fix: lint.back lint.front.fix

## Linter - Run linters for backend
lint.back:
$(SF_CONSOLE) lint:container
$(SF_CONSOLE) lint:xliff translations
$(SF_CONSOLE) lint:yaml --parse-tags config
$(SF_CONSOLE) lint:twig templates
#$(SF_CONSOLE) doctrine:schema:validate

## Linter - Lint front files
lint.front: bin/oxlint
bin/oxlint

## Linter - Lint front files and fix issues
lint.front.fix: bin/oxlint
bin/oxlint --fix

bin/oxlint:
@$(call action, Downloading oxlint...)
$(SF_CONSOLE) oxc:download:oxlint

###########
# PHPStan #
###########

## PHPStan - Run PHPStan
phpstan:
$(PHP) vendor/bin/phpstan analyse

## PHPStan - Run PHPStan and update the baseline
phpstan.generate-baseline:
$(PHP) vendor/bin/phpstan analyse --generate-baseline

#########
# Tests #
#########

## Tests - Run all tests
test: test.back

## Tests - Run backend tests
test.back:
$(PHP) vendor/bin/phpunit
## Tests - Run backend tests with coverage

test.back.coverage:
$(PHP) vendor/bin/phpunit --coverage-html .cache/phpunit/coverage-html

-include $(ROOT_DIR)/Makefile.local
1 change: 1 addition & 0 deletions kocal/symfony-app-pack/1.0/Makefile.local
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Local targets that should not be committed to git
29 changes: 29 additions & 0 deletions kocal/symfony-app-pack/1.0/ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
->withParallel()
->withCache(__DIR__ . '/tools/.cache/ecs')
->withPaths([
__DIR__ . '/assets',
__DIR__ . '/config',
__DIR__ . '/public',
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/tools',
])
->withSkip([
__DIR__ . '/tools/.cache',
__DIR__ . '/config/bundles.php',
__DIR__ . '/config/reference.php',
])
->withPreparedSets(
psr12: true,
common: true,
strict: true,
cleanCode: true,
)
;
15 changes: 15 additions & 0 deletions kocal/symfony-app-pack/1.0/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"copy-from-recipe": {
".github/": ".github/",
"tools/": "tools/",
".twig-cs-fixer.php": ".twig-cs-fixer.php",
"ecs.php": "ecs.php",
"Makefile.local": "Makefile.local",
"php.ini": "php.ini",
"phpstan.dist.neon": "phpstan.dist.neon",
"rector.php": "rector.php"
},
"gitignore": [
"/Makefile.local"
]
}
1 change: 1 addition & 0 deletions kocal/symfony-app-pack/1.0/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
memory_limit = -1
36 changes: 36 additions & 0 deletions kocal/symfony-app-pack/1.0/phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
includes:
- vendor/kocal/phpstan-symfony-ux/extension.neon
- vendor/phpstan/phpstan-symfony/extension.neon
- vendor/phpstan/phpstan-doctrine/extension.neon
- tools/phpstan/symfony-configuration.php

parameters:
level: 9
paths:
- bin/
- config/
- public/
- src/
- tools/
- tests/
excludePaths:
- config/reference.php
- tools/.cache

tmpDir: tools/.cache/phpstan

symfony:
consoleApplicationLoader: tools/phpstan/console-application.php

doctrine:
objectManagerLoader: tools/phpstan/object-manager.php

rules:
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ClassMustBeFinalRule
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ClassNameMustNotEndWithComponentRule
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ForbiddenAttributesPropertyRule
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ForbiddenClassPropertyRule
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\MethodsVisibilityRule
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\PostMountMethodSignatureRule
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\PreMountMethodSignatureRule
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\PublicPropertiesMustBeCamelCaseRule
37 changes: 37 additions & 0 deletions kocal/symfony-app-pack/1.0/rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Symfony\CodeQuality\Rector\Class_\ControllerMethodInjectionToConstructorRector;

return RectorConfig::configure()
->withParallel()
->withCache(__DIR__ . '/tools/.cache/rector')
->withPaths([
__DIR__ . '/config',
__DIR__ . '/public',
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/tools',
])
->withPhpSets()
->withPreparedSets(
deadCode: true,
codeQuality: true,
codingStyle: true,
typeDeclarations: true,
privatization: true,
instanceOf: true,
earlyReturn: true,
phpunitCodeQuality: true,
doctrineCodeQuality: true,
symfonyCodeQuality: true,
)
->withSkip([
__DIR__ . '/config/bundles.php',
__DIR__ . '/config/reference.php',
__DIR__ . '/tools/.cache',
ControllerMethodInjectionToConstructorRector::class,
])
;
1 change: 1 addition & 0 deletions kocal/symfony-app-pack/1.0/tools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.cache/
Loading
Loading