Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #3 from smartbooster/1_init_bundle
Browse files Browse the repository at this point in the history
#1 Init dev bundle
  • Loading branch information
mathieu-ducrot authored Jun 23, 2021
2 parents 51c8760 + 9eb6d18 commit d8536d7
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 4 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/vendor/
composer.lock
/phpmetrics/
coverage.*
.php_cs.cache
61 changes: 61 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'

services:
php:
container_name: smartbooster-parameterbundle-php
image: smartbooster/php-fpm:builder
ports:
- "9000:9000"
volumes:
- ./:/var/www
Empty file added src/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions src/tmp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

# Temporary PHP file to have phpcpd working on CI, to delete on next commit with PHP Code
Empty file added tests/.gitkeep
Empty file.

0 comments on commit d8536d7

Please sign in to comment.