Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Dumped 3.x branch (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelandrieu authored Apr 22, 2018
1 parent 6496aef commit 3b9ae5d
Show file tree
Hide file tree
Showing 46 changed files with 3,582 additions and 2,056 deletions.
32 changes: 32 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
**/*.DS_Store
**/*.log
**/*.md
**/*.php~
**/*.sql.gz
**/._*
**/.dockerignore
**/.gitignore
**/Dockerfile
**/Thumbs.db
*.env.dist
*.sublime-project
*.sublime-workspace
.editorconfig
.env
.git/
.gitattributes
.gitlab-ci.yml
.gitmodules
.php_cs.cache
.travis.yml
app/config/parameters.yml
bin/symfony_requirements
build/
composer.phar
docker-compose.override.yml
docker-compose.yml
docker/db/data/
var/
vendor/
web/index.php
web/bundles/
27 changes: 15 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,34 @@ sudo: false

cache:
directories:
- bin
- vendor
- $HOME/.composer/cache
- $HOME/.composer/cache/files
- $HOME/symfony-bridge/.phpunit

php:
- 7.0
- 7.1
- 7.2
matrix:
fast_finish: true
include:
- php: 7.1
- php: 7.2

env:
global:
- SYMFONY_PHPUNIT_VERSION=5.5
- SYMFONY_DEPRECATIONS_HELPER=disabled
global:
- SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
- SYMFONY_PHPUNIT_VERSION=5.7

before_install:
- phpenv config-rm xdebug.ini
- composer self-update

install:
- composer update --prefer-dist --no-interaction --no-progress
- composer install
- ./vendor/bin/simple-phpunit install

script:
- vendor/bin/simple-phpunit
- vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --using-cache=no --path-mode=intersection `git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE`

- ./bin/console lint:yaml app/config
- ./bin/console lint:twig app/Resources
- ./bin/console security:check --end-point=http://security.sensiolabs.org/check_lock

notifications:
email: false
67 changes: 67 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
FROM php:7.1-fpm-alpine

RUN apk add --no-cache --virtual .persistent-deps \
git \
icu-libs \
zlib

ENV APCU_VERSION 5.1.8

RUN set -xe \
&& apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
icu-dev \
zlib-dev \
&& docker-php-ext-install \
intl \
pdo_mysql \
zip \
&& pecl install \
apcu-${APCU_VERSION} \
&& docker-php-ext-enable --ini-name 20-apcu.ini apcu \
&& docker-php-ext-enable --ini-name 05-opcache.ini opcache \
&& apk del .build-deps

COPY docker/app/php.ini /usr/local/etc/php/php.ini

COPY docker/app/install-composer.sh /usr/local/bin/docker-app-install-composer
RUN chmod +x /usr/local/bin/docker-app-install-composer

RUN set -xe \
&& apk add --no-cache --virtual .fetch-deps \
openssl \
&& docker-app-install-composer \
&& mv composer.phar /usr/local/bin/composer \
&& apk del .fetch-deps

# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER 1

RUN composer global require "hirak/prestissimo:^0.3" --prefer-dist --no-progress --no-suggest --optimize-autoloader --classmap-authoritative \
&& composer clear-cache

WORKDIR /srv/prestonbot

COPY composer.json ./

RUN mkdir -p \
var/cache \
var/logs \
var/sessions \
&& composer install --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress --no-suggest \
&& composer clear-cache \
# Permissions hack because setfacl does not work on Mac and Windows
&& chown -R www-data var

COPY app app/
COPY bin bin/
COPY src src/
COPY web web/

RUN composer dump-autoload --optimize --classmap-authoritative --no-dev

COPY docker/app/docker-entrypoint.sh /usr/local/bin/docker-app-entrypoint
RUN chmod +x /usr/local/bin/docker-app-entrypoint

ENTRYPOINT ["docker-app-entrypoint"]
CMD ["php-fpm"]
51 changes: 51 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Makefile for docker use

APP=docker-compose exec -T app
TAPP=docker-compose exec
TTAPP=docker-compose exec -e APP_ENV=test
CAPP=docker-compose run app composer
CONSOLE=$(APP) /usr/local/bin/php bin/console

.PHONY: help install start stop destroy composer console app nginx test cs server

help: ## Show this help
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

install: ## Setup the project using Docker and docker-compose
install: start composer-install

start: ## Start the containers
docker-compose up -d

stop: ## Stop the Docker containers and remove the volumes
docker-compose down -v

destroy: ## Destroy all containers, volumes, networks
docker-compose down --rmi all

composer: ## Composer
$(CAPP) $(filter-out $@,$(MAKECMDGOALS))

composer-install: # Install the project PHP dependencies
$(CAPP) install -o

console: ## Console
$(CONSOLE) $(filter-out $@,$(MAKECMDGOALS))

app: ## Shell of Application container
$(TAPP) app sh

nginx: ## Shell of Nginx container
$(TAPP) nginx sh

test: ## Launch tests
$(TAPP) app env APP_ENV=test ./vendor/bin/simple-phpunit

cs: ## Fix Coding styles
$(TAPP) app ./vendor/bin/php-cs-fixer fix

server: ## Start local PHP server (Non docker use only)
php -S localhost:8888 -t web

%:
@:
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,40 @@ This application is based on Symfony CarsonBot and aims to help PrestaShop maint

![Preston, the PrestaShop contributor best friend](http://i.imgur.com/r26gJW4.png)

## How to install ?
### Classic installation

First of all you have to configure your GitHub repository and have a GitHub token.

```bash
composer install // and complete the interactive fields asked
```

## How to test ?
### Docker installation

First, setup the `docker-compose.yml` file with a valid GitHub token and a valid Secure token (can be empty).

```bash
./vendor/bin/simple-phpunit
make start
```

The Home page is now available at "http://localhost:81/".

You need also to create your own GitHub [personal token](https://github.com/settings/tokens) and export it:

```bash
export SYMFONY_PHPUNIT_VERSION=5.5
export SYMFONY_PHPUNIT_VERSION=5.7
export GH_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
export GH_SECURED_TOKEN=YYYYYYYYYYYYYYYYYYYYYYYYYYYY
```

## How to run the test suite ?

```bash
./vendor/bin/simple-phpunit
# or (using docker)
make test
```

> To launch unit tests, you only need to setup your own Github token (`GH_TOKEN`).
## Our standards ?
Expand All @@ -42,7 +54,6 @@ Yeah, mostly the *Symfony* ones:
* Extract data from the pull request and look for some terms;
* Manage labels;
* Validate a pull request description;
* Validate every commit label;
* Welcome every new contributor;
* Labelize a PR regarding information in description
* Labelize a PR regarding files updated
Expand Down
1 change: 0 additions & 1 deletion app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public function registerBundles()
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
];
Expand Down
25 changes: 0 additions & 25 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ imports:
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: en
labels_pr_creation: false
enable_labels: true

framework:
#esi: ~
Expand All @@ -26,7 +24,6 @@ framework:
engines: ['twig']
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file
Expand All @@ -44,28 +41,6 @@ twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"

# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
# path: "%database_path%"

orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true

# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
Expand Down
11 changes: 2 additions & 9 deletions app/config/config_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,8 @@ monolog:
verbosity_levels:
VERBOSITY_VERBOSE: INFO
VERBOSITY_VERY_VERBOSE: DEBUG
channels: ["!doctrine"]
console_very_verbose:
type: console
bubble: false
verbosity_levels:
VERBOSITY_VERBOSE: NOTICE
VERBOSITY_VERY_VERBOSE: NOTICE
VERBOSITY_DEBUG: DEBUG
channels: ["doctrine"]
channels: []

# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
Expand Down
6 changes: 0 additions & 6 deletions app/config/config_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ imports:
# serializer:
# cache: serializer.mapping.cache.apc

#doctrine:
# orm:
# metadata_cache_driver: apc
# result_cache_driver: apc
# query_cache_driver: apc

monolog:
handlers:
main:
Expand Down
4 changes: 0 additions & 4 deletions app/config/config_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,3 @@ monolog:
handlers:
main:
channels: ["!event", "!security", "!request"]

parameters:
enable_labels: true
labels_pr_creation: true
8 changes: 0 additions & 8 deletions app/config/parameters.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production.
# http://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
parameters:
database_host: 127.0.0.1
database_port: ~
database_name: symfony
database_user: root
database_password: ~
# You should uncomment this if you want use pdo_sqlite
# database_path: "%kernel.root_dir%/data.db3"

mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: ~
Expand Down
1 change: 1 addition & 0 deletions app/config/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ security:

main:
anonymous: ~
logout_on_user_change: true
Loading

0 comments on commit 3b9ae5d

Please sign in to comment.