Skip to content

Commit a289ab3

Browse files
author
dmitriy
committed
improved environment
1 parent b2064a7 commit a289ab3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3916
-1374
lines changed

.circleci/config.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ jobs:
1515
make start-test
1616
1717
- run:
18-
name: Wait for DB container is running and initialize DB
18+
name: Wait for DB container is running and initialize DB & messenger component
1919
command: |
2020
make wait-for-db
2121
make drop-migrate
22+
make messenger-setup-transports
2223
2324
- run:
2425
name: Run unit/functional tests
@@ -30,6 +31,12 @@ jobs:
3031
command: |
3132
make report-code-coverage
3233
34+
- run:
35+
name: Check coding standard & CodeSniffer
36+
command: |
37+
make ecs
38+
make phpcs
39+
3340
- store_artifacts:
3441
path: reports
3542

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
*.scss linguist-vendored
44
*.js linguist-vendored
55
CHANGELOG.md export-ignore
6+
docs/postman/symfony.postman_collection.json binary
7+
tools/**/composer.lock binary
8+
composer.lock binary
9+
symfony.lock binary

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ jobs:
3030
run: make wait-for-db
3131
- name: Run migrations
3232
run: make drop-migrate
33+
- name: Setup transports for Messenger component
34+
run: make messenger-setup-transports
3335
- name: Run test suite
3436
run: make phpunit
37+
- name: Run coding standard
38+
run: make ecs
39+
- name: Run codeSniffer
40+
run: make phpcs
3541
- name: Stop the docker images
3642
run: make stop-test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ reports/*
1010
/public/bundles/
1111
/var/
1212
/vendor/
13+
/tools/**/vendor
1314
###< symfony/framework-bundle ###
1415

1516
###> symfony/phpunit-bridge ###

Dockerfile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
3232
librabbitmq-dev \
3333
&& pecl install amqp \
3434
&& docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \
35+
&& docker-php-ext-configure intl \
3536
&& docker-php-ext-install \
3637
pdo_mysql \
3738
sockets \
3839
intl \
40+
opcache \
3941
zip \
40-
&& docker-php-ext-enable amqp && \
41-
rm -fr /tmp/* && \
42-
rm -rf /var/list/apt/* && \
43-
rm -r /var/lib/apt/lists/* && \
44-
apt-get clean
42+
&& docker-php-ext-enable amqp \
43+
&& rm -rf /tmp/* \
44+
&& rm -rf /var/list/apt/* \
45+
&& rm -rf /var/lib/apt/lists/* \
46+
&& apt-get clean
4547

4648
# disable default site and delete all default files inside APP_HOME
4749
RUN a2dissite 000-default.conf
@@ -70,7 +72,9 @@ COPY ./docker/dev/xdebug.ini /tmp/
7072
RUN chmod u+x /tmp/do_we_need_xdebug.sh && /tmp/do_we_need_xdebug.sh
7173

7274
# install composer
73-
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer
75+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
76+
RUN chmod +x /usr/bin/composer
77+
ENV COMPOSER_ALLOW_SUPERUSER 1
7478

7579
# add supervisor
7680
RUN mkdir -p /var/log/supervisor
@@ -94,8 +98,8 @@ USER www-data
9498
COPY --chown=www-data:www-data . $APP_HOME/
9599

96100
# install all PHP dependencies
97-
RUN if [ "$BUILD_ARGUMENT_ENV" = "dev" ] || [ "$BUILD_ARGUMENT_ENV" = "test" ]; then composer install --optimize-autoloader --no-interaction --no-progress; \
98-
else export APP_ENV=$BUILD_ARGUMENT_ENV && composer install --optimize-autoloader --no-interaction --no-progress --no-dev; \
101+
RUN if [ "$BUILD_ARGUMENT_ENV" = "dev" ] || [ "$BUILD_ARGUMENT_ENV" = "test" ]; then COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-interaction --no-progress; \
102+
else export APP_ENV=$BUILD_ARGUMENT_ENV && COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-interaction --no-progress --no-dev; \
99103
fi
100104

101105
# create cached config file .env.local.php in case prod environment

Makefile

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
dir=${CURDIR}
22
project=-p symfony
33
service=symfony:latest
4+
openssl_bin:=$(shell which openssl)
45
interactive:=$(shell [ -t 0 ] && echo 1)
56
ifneq ($(interactive),1)
67
optionT=-T
78
endif
89

10+
ifndef APP_ENV
11+
# Determine which .env file to use
12+
ifneq ("$(wildcard .env.local)","")
13+
include .env.local
14+
else
15+
include .env
16+
endif
17+
endif
18+
919
start:
1020
@docker-compose -f docker-compose.yml $(project) up -d
1121

@@ -59,13 +69,13 @@ wait-for-db:
5969
@make exec cmd="php bin/console db:wait"
6070

6171
composer-install-prod:
62-
@make exec cmd="composer install --optimize-autoloader --no-dev"
72+
@make exec-bash cmd="COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-dev"
6373

6474
composer-install:
65-
@make exec cmd="composer install --optimize-autoloader"
75+
@make exec-bash cmd="COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader"
6676

6777
composer-update:
68-
@make exec cmd="composer update"
78+
@make exec-bash cmd="COMPOSER_MEMORY_LIMIT=-1 composer update"
6979

7080
info:
7181
@make exec cmd="bin/console --version"
@@ -89,17 +99,20 @@ drop-migrate:
8999
@make migrate
90100

91101
migrate-prod:
92-
@make exec cmd="php bin/console doctrine:migrations:migrate --no-interaction"
102+
@make exec cmd="php bin/console doctrine:migrations:migrate --no-interaction --all-or-nothing"
93103

94104
migrate:
95-
@make exec cmd="php bin/console doctrine:migrations:migrate --no-interaction"
96-
@make exec cmd="php bin/console doctrine:migrations:migrate --no-interaction --env=test"
105+
@make exec cmd="php bin/console doctrine:migrations:migrate --no-interaction --all-or-nothing"
106+
@make exec cmd="php bin/console doctrine:migrations:migrate --no-interaction --all-or-nothing --env=test"
97107

98108
fixtures:
99109
@make exec cmd="php bin/console doctrine:fixtures:load --env=test"
100110

111+
messenger-setup-transports:
112+
@make exec cmd="php bin/console messenger:setup-transports"
113+
101114
phpunit:
102-
@make exec cmd="./vendor/bin/phpunit -c phpunit.xml.dist --coverage-html reports/coverage --coverage-clover reports/clover.xml --log-junit reports/junit.xml"
115+
@make exec-bash cmd="rm -rf ./var/cache/test* && bin/console cache:warmup --env=test && ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-html reports/coverage --coverage-clover reports/clover.xml --log-junit reports/junit.xml"
103116

104117
###> php-coveralls ###
105118
report-code-coverage: ## update code coverage on coveralls.io. Note: COVERALLS_REPO_TOKEN should be set on CI side.

bitbucket-pipelines.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@ pipelines:
1414
- docker ps -a
1515
- make wait-for-db
1616
- make drop-migrate
17+
- make messenger-setup-transports
1718
- make phpunit
19+
- make ecs
20+
- make phpcs
1821
- make stop-test

composer.json

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,20 @@
2222
"role": "Developer"
2323
}
2424
],
25-
"support": {
26-
"issues": "https://github.com/dimadeush/docker-apache-php-symfony/issues"
27-
},
28-
"prefer-stable": true,
2925
"require": {
3026
"php": "^7.4.0",
27+
"ext-amqp": "*",
3128
"ext-ctype": "*",
3229
"ext-iconv": "*",
3330
"ext-json": "*",
3431
"ext-mbstring": "*",
3532
"ext-pdo": "*",
3633
"ext-pdo_mysql": "*",
3734
"doctrine/doctrine-migrations-bundle": "^2.1",
38-
"jmose/command-scheduler-bundle": "^2.0",
35+
"easycorp/easy-log-handler": "1.0.*",
36+
"jmose/command-scheduler-bundle": "^2.2",
3937
"sensio/framework-extra-bundle": "^5.5",
4038
"sensiolabs/security-checker": "^6.0",
41-
"symfony/amqp-pack": "^1.0",
4239
"symfony/apache-pack": "^1.0",
4340
"symfony/asset": "4.4.*",
4441
"symfony/config": "4.4.*",
@@ -64,14 +61,27 @@
6461
"symfony/web-link": "4.4.*",
6562
"symfony/yaml": "4.4.*"
6663
},
64+
"replace": {
65+
"paragonie/random_compat": "2.*",
66+
"symfony/polyfill-ctype": "*",
67+
"symfony/polyfill-iconv": "*",
68+
"symfony/polyfill-php56": "*",
69+
"symfony/polyfill-php70": "*",
70+
"symfony/polyfill-php71": "*",
71+
"symfony/polyfill-php72": "*"
72+
},
73+
"conflict": {
74+
"symfony/symfony": "*"
75+
},
6776
"require-dev": {
6877
"bamarni/composer-bin-plugin": "^1.3",
6978
"doctrine/doctrine-fixtures-bundle": "^3.3",
79+
"ergebnis/composer-normalize": "^2.3",
7080
"roave/security-advisories": "dev-master",
7181
"symfony/debug-pack": "*",
7282
"symfony/maker-bundle": "^1.14",
7383
"symfony/profiler-pack": "*",
74-
"symfony/test-pack": "*"
84+
"symfony/requirements-checker": "^1.1"
7585
},
7686
"config": {
7787
"platform": {
@@ -82,50 +92,49 @@
8292
},
8393
"sort-packages": true
8494
},
95+
"extra": {
96+
"bamarni-bin": {
97+
"target-directory": "tools"
98+
},
99+
"symfony": {
100+
"allow-contrib": true,
101+
"require": "4.4.*"
102+
}
103+
},
85104
"autoload": {
86105
"psr-4": {
87106
"App\\": "src/"
88107
}
89108
},
90109
"autoload-dev": {
91110
"psr-4": {
92-
"App\\Tests\\": "tests/"
111+
"App\\Tests\\": "tests/",
112+
"PHPUnit\\": "tools/01_phpunit/vendor/phpunit/phpunit/src/",
113+
"PHPUnit\\Framework\\MockObject\\": "tools/01_phpunit/vendor/phpunit/phpunit/src/Framework/MockObject/ForwardCompatibility",
114+
"Symfony\\Component\\BrowserKit\\": "tools/01_phpunit/vendor/symfony/browser-kit",
115+
"Symfony\\Bridge\\PhpUnit\\": "tools/01_phpunit/vendor/symfony/phpunit-bridge"
93116
}
94117
},
95-
"replace": {
96-
"paragonie/random_compat": "2.*",
97-
"symfony/polyfill-ctype": "*",
98-
"symfony/polyfill-iconv": "*",
99-
"symfony/polyfill-php72": "*",
100-
"symfony/polyfill-php71": "*",
101-
"symfony/polyfill-php70": "*",
102-
"symfony/polyfill-php56": "*"
103-
},
118+
"prefer-stable": true,
104119
"scripts": {
105-
"auto-scripts": {
106-
"cache:clear": "symfony-cmd",
107-
"assets:install %PUBLIC_DIR%": "symfony-cmd",
108-
"security-checker security:check": "script"
109-
},
110120
"post-install-cmd": [
121+
"if test -d vendor/symfony/requirements-checker; then ./vendor/bin/requirements-checker; fi",
111122
"if test -d vendor/bamarni/composer-bin-plugin; then composer bin all install; fi",
112123
"@auto-scripts"
113124
],
114125
"post-update-cmd": [
126+
"if test -d vendor/symfony/requirements-checker; then ./vendor/bin/requirements-checker; fi",
115127
"if test -d vendor/bamarni/composer-bin-plugin; then composer bin all update; fi",
116128
"@auto-scripts"
117-
]
118-
},
119-
"conflict": {
120-
"symfony/symfony": "*"
121-
},
122-
"extra": {
123-
"bamarni-bin": {
124-
"target-directory": "tools"
125-
},
126-
"symfony": {
127-
"allow-contrib": true,
128-
"require": "4.4.*"
129+
],
130+
"auto-scripts": {
131+
"cache:clear": "symfony-cmd",
132+
"cache:warmup": "symfony-cmd",
133+
"assets:install %PUBLIC_DIR%": "symfony-cmd",
134+
"security-checker security:check": "script"
129135
}
136+
},
137+
"support": {
138+
"issues": "https://github.com/dimadeush/docker-apache-php-symfony/issues"
130139
}
131140
}

0 commit comments

Comments
 (0)