Skip to content

Commit

Permalink
Update from 4.4 to 6.1 (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
babeuloula authored Jul 4, 2022
1 parent d6f3c02 commit cb29d2d
Show file tree
Hide file tree
Showing 152 changed files with 5,179 additions and 5,878 deletions.
104 changes: 74 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ commands:
description: Install alpine requirements for checkout
steps:
- run:
name: "Install alpine requirements for checkout"
command: apk add git openssh-client curl make
name: "Install alpine requirements for checkout"
command: apk add git openssh-client curl make
- checkout

composer-install:
description: "Install dependencies"
steps:
- run:
name: "Execute: composer install"
command: |
if [ ! -f vendor/autoload.php ];then
curl https://getcomposer.org/composer-1.phar --location --silent --output /usr/bin/composer;
chmod +x /usr/bin/composer;
composer global require hirak/prestissimo;
composer install --no-interaction --no-progress;
fi
name: "Execute: composer install"
command: |
if [ ! -f vendor/autoload.php ];then
curl https://getcomposer.org/composer-2.phar --location --silent --output /usr/bin/composer;
chmod +x /usr/bin/composer;
cp .env.ci .env.local;
composer install --no-interaction --no-progress;
fi
restore-composer-cache:
description: "Restore vendor folder from CircleCI cache"
steps:
- restore_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}

store-composer-cache:
description: "Store vendor folder in CircleCI cache"
Expand All @@ -35,39 +35,63 @@ commands:
- restore-composer-cache
- composer-install
- save_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
paths:
- ./vendor
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
paths:
- ./vendor
- persist_to_workspace:
root: .
paths:
- vendor
root: .
paths:
- vendor

phpcs:
description: "Execute PHPCS"
steps:
- run:
name: "Execute: make phpcs"
command: make phpcs
name: "Execute: make lint"
command: |
cp .env.ci .env.local
make lint
phpstan:
description: "Execute PHPStan"
steps:
- run:
name: "Execute: make stan"
command: make stan
name: "Execute: make analyse"
command: |
cp .env.ci .env.local
make analyse
copy-paste:
description: "Execute Copy/Paste"
steps:
- run:
name: "Execute: make copy-paste"
command: |
cp .env.ci .env.local
make copy-paste
security:
description: "Execute security checker"
steps:
- run:
name: "Execute: make security"
command: |
cp .env.ci .env.local
make security
doctrine_schema_validate:
description: "Execute doctrine:schema:validate"
steps:
- run:
name: "Execute: bin/console d:s:v"
command: bin/console d:s:v --skip-sync
name: "Execute: bin/console d:s:v"
command: |
cp .env.ci .env.local
bin/console d:s:v --skip-sync
executors:
php:
docker:
- image: php:7.3.8-cli-alpine3.10
- image: php:8.1-cli-alpine
working_directory: ~/repository

jobs:
Expand All @@ -90,6 +114,20 @@ jobs:
- restore-composer-cache
- phpstan

copy-paste:
executor: php
steps:
- checkout-alpine
- restore-composer-cache
- copy-paste

security:
executor: php
steps:
- checkout-alpine
- restore-composer-cache
- security

doctrine_schema_validate:
executor: php
steps:
Expand All @@ -103,11 +141,17 @@ workflows:
jobs:
- composer
- phpcs:
requires:
- composer
requires:
- composer
- phpstan:
requires:
- composer
requires:
- composer
- copy-paste:
requires:
- composer
- security:
requires:
- composer
- doctrine_schema_validate:
requires:
- composer
requires:
- composer
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Require the plugin EditorConfig in Phpstorm
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

# http://www.php-fig.org/psr/psr-2/#indenting
[*.{php,yaml,yml,sh}]
indent_style = space
indent_size = 4
16 changes: 16 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=fake_secret
TRUSTED_PROXIES=REMOTE_ADDR
###< symfony/framework-bundle ###

###> league/oauth2-github ###
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
###> league/oauth2-github ###

###> knplabs/github-api ###
GITHUB_AUTH_METHOD=http_password
GITHUB_USERNAME=username
GITHUB_SECRET=password_or_token
###< knplabs/github-api ###
23 changes: 23 additions & 0 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=fake_secret
TRUSTED_PROXIES=REMOTE_ADDR
###< symfony/framework-bundle ###

###> league/oauth2-github ###
GITHUB_CLIENT_ID=fake_id
GITHUB_CLIENT_SECRET=fake_secret
###> league/oauth2-github ###

###> knplabs/github-api ###
GITHUB_AUTH_METHOD=http_password
GITHUB_USERNAME=username
GITHUB_SECRET=password_or_token
###< knplabs/github-api ###

HTTP_HOST=github-gui.ci
MYSQL_ROOT_PASSWORD=root
MYSQL_HOST=github_gui_ci
MYSQL_DATABASE=github_gui_ci
MYSQL_USER=github_gui_ci
MYSQL_PASSWORD=github_gui_ci
10 changes: 0 additions & 10 deletions .env.dist

This file was deleted.

11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@

###> symfony/framework-bundle ###
/.env
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

/.idea/

/docker/.env
/docker/docker-compose.override.yml
###> squizlabs/php_codesniffer ###
/.phpcs-cache
/phpcs.xml.dist
###< squizlabs/php_codesniffer ###
106 changes: 85 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,99 @@
start-dev: hooks
bash ./docker/start_dev.sh
#-include docker/.env

start-prod:
bash ./docker/start_prod.sh
.SILENT: shell analyse clear-cache
.DEFAULT_GOAL := help

stop-dev:
cd ./docker/ && docker-compose -f docker-compose.yml -f docker-compose.dev.yml stop
help:
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'

stop-prod:
cd ./docker/ && docker-compose -f docker-compose.yml -f docker-compose.prod.yml stop
##
## Project
##---------------------------------------------------------------------------

shell:
cd ./docker/ && docker-compose exec php bash
install: ## Install the project
install: hooks
cd ./docker && ./install.sh

check:
cd ./docker/ && docker-compose exec -T php make phpcs
cd ./docker/ && docker-compose exec -T php make stan
cd ./docker/ && docker-compose exec -T php make check-doctrine
start: ## Start the project
start: hooks
cd ./docker && ./start.sh

stop: ## Stop the project
stop:
cd ./docker && ./stop.sh

restart: ## Restart the project
restart: stop start

update: ## Update the project
update:
cd ./docker && ./update.sh

hooks:
# Pre commit
echo "#!/bin/bash" > .git/hooks/pre-commit
echo "make check" >> .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

phpcs:
vendor/bin/phpcs
shell: ## Connect to PHP container
shell:
cd ./docker && docker-compose exec php bash

warmup-cache:
bin/console cache:warmup

clear-cache:
bin/console cache:clear --no-warmup

##
## Database
##---------------------------------------------------------------------------

stan:
reset: ## Reset the database (only on container)
reset:
bin/console doctrine:database:drop --if-exists --force
make doctrine-migrations

doctrine-migrations: ## Execute all migrations (only on container)
doctrine-migrations:
bin/console doctrine:database:create --if-not-exists
bin/console doctrine:migration:migrate --allow-no-migration --no-interaction --all-or-nothing

##
## Code quality (only on PHP test container)
##---------------------------------------------------------------------------

check:
cd ./docker/ && docker-compose exec -T php make clear-cache
cd ./docker/ && docker-compose exec -T php make lint
cd ./docker/ && docker-compose exec -T php make analyse
cd ./docker/ && docker-compose exec -T php make copy-paste
cd ./docker/ && docker-compose exec -T php make doctrine
cd ./docker/ && docker-compose exec -T php make security

lint: ## Execute PHPCS
lint:
vendor/bin/phpcs -p

fixer: ## Execute PHPCS fixer
fixer:
./vendor/bin/phpcbf -p

analyse: ## Execute PHPStan
analyse:
bin/console cache:warmup --env=dev
vendor/bin/phpstan analyse src --level max -c extension.neon
vendor/bin/phpstan analyse --memory-limit=4G

doctrine: ## Validate Doctrine schema
doctrine: reset
bin/console d:s:v --env=test
bin/console d:s:u --dump-sql --env=test

copy-paste: ## Check duplicate code
copy-paste:
./bin/phpcpd src \
--fuzzy

check-doctrine:
bin/console d:s:v
bin/console d:s:u --dump-sql
security: ## Check CVE for vendor dependencies
security:
./bin/security-checker --path=./composer.lock
Loading

0 comments on commit cb29d2d

Please sign in to comment.