diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..88af801 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: + pull_request: + push: + branches: + - "master" + +jobs: + build_test_lastest: + runs-on: ubuntu-latest + name: Build and test on php-fpm:${{ matrix.php }}-builder + container: smartbooster/php-fpm:${{ matrix.php }}-builder + strategy: + matrix: + php: [ 7.4 ] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Check PHP Version + run: php -v + + # —— Composer 🧙‍️ ————————————————————————————————————————————————————————— + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install + run: composer install --prefer-dist + + - name: Qualimetry + run: make qa diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7c43e86 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/vendor/ +composer.lock +/phpmetrics/ +coverage.* +.php_cs.cache diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d13f082 --- /dev/null +++ b/Makefile @@ -0,0 +1,61 @@ +.DEFAULT_GOAL := help +.PHONY: help +help: + @grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' ./Makefile | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[34m%-20s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[34m##/[33m/' + +## +## Docker +## ------- +.PHONY: up +up: ## Start the project stack with docker + docker-compose up + +.PHONY: down +down: ## Kill the project stack with docker + docker-compose down + +.PHONY: ps +ps: ## List containers from project + docker-compose ps + +.PHONY: ssh +ssh: ## Access to the php container in interactive mode + docker exec -it --user=dev smartbooster-parameterbundle-php bash + +## +## Qualimetry +## ------- + +.PHONY: cs checkstyle +cs: checkstyle +checkstyle: ## PHP Checkstyle + vendor/bin/phpcs --extensions=php -n --standard=PSR12 --report=full src tests + +.PHONY: cb code-beautifier +cb: code-beautifier +code-beautifier: ## Code beautifier (Checkstyle fixer) + vendor/bin/phpcbf --extensions=php --standard=PSR12 src tests + +.PHONY: lint-php +lint-php: ## Linter PHP + find src -type f -name "*.php" -exec php -l {} \; + +.PHONY: composer-validate +composer-validate: ## Validate composer.json and composer.lock + composer validate composer.json + +.PHONY: cpd +cpd: ## Copy paste detector + vendor/bin/phpcpd --fuzzy src + +.PHONY: metrics +metrics: ## Build static analysis from the php in src. Repports available in ./phpmetrics/index.html + vendor/bin/phpmetrics --report-html=phpmetrics src + +.PHONY: phpstan +phpstan: ## Launch PHP Static Analysis + vendor/bin/phpstan analyse src --level=6 + +.PHONY: qa qualimetry +qa: qualimetry ## Launch all qualimetry rules +qualimetry: checkstyle lint-php cpd composer-validate metrics phpstan diff --git a/README.md b/README.md new file mode 100644 index 0000000..4130ee8 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# SMARTBOOSTER - Parameter bundle + +[![Latest Stable Version](http://poser.pugx.org/smartbooster/parameter-bundle/v)](https://packagist.org/packages/smartbooster/parameter-bundle) +[![Latest Unstable Version](http://poser.pugx.org/smartbooster/parameter-bundle/v/unstable)](https://packagist.org/packages/smartbooster/parameter-bundle) +[![Total Downloads](http://poser.pugx.org/smartbooster/parameter-bundle/downloads)](https://packagist.org/packages/smartbooster/parameter-bundle) +[![License](http://poser.pugx.org/smartbooster/parameter-bundle/license)](https://packagist.org/packages/smartbooster/parameter-bundle) + +![CI workflow](https://github.com/smartbooster/parameter-bundle/actions/workflows/ci.yml/badge.svg) + +## Installation + +### Add the bundle as dependency with Composer + +``` bash +composer require smartbooster/parameter-bundle +``` + +## What's inside ! + +Provide an easy way to administrate your app parameters through each environment with the following tools : + +- A **configuration template to define all parameters** that need to exist in your application with their default value +- A **Command to use on CD to generate missing parameters** +- A **Parameter Entity** to store your parameters in database +- An **Admin** to easily edit the value of your parameters and more data related to them + +## Contributing + +Pull requests are welcome. + +Thanks to [everyone who has contributed](https://github.com/smartbooster/parameter-bundle/contributors) already. diff --git a/composer.json b/composer.json index d62f21b..ca5bada 100644 --- a/composer.json +++ b/composer.json @@ -12,11 +12,11 @@ "homepage": "https://www.smartbooster.io" } ], - "require": { - - }, "require-dev": { - + "squizlabs/php_codesniffer": "^3.6", + "sebastian/phpcpd": "^6.0", + "phpmetrics/phpmetrics": "^2.7", + "phpstan/phpstan": "^0.12.90" }, "autoload": { "psr-4": { diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..de5a22f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' + +services: + php: + container_name: smartbooster-parameterbundle-php + image: smartbooster/php-fpm:builder + ports: + - "9000:9000" + volumes: + - ./:/var/www diff --git a/src/.gitkeep b/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/tmp.php b/src/tmp.php new file mode 100644 index 0000000..0fb968e --- /dev/null +++ b/src/tmp.php @@ -0,0 +1,3 @@ +