Skip to content

Commit d734eb2

Browse files
author
dmitriy
committed
refactoring and improved environment
1 parent 571345a commit d734eb2

File tree

117 files changed

+4432
-1085
lines changed

Some content is hidden

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

117 files changed

+4432
-1085
lines changed

.circleci/config.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ 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
2222
make generate-jwt-keys
23+
make create-roles-groups
24+
make messenger-setup-transports
2325
2426
- run:
2527
name: Run unit/functional tests
@@ -31,6 +33,12 @@ jobs:
3133
command: |
3234
make report-code-coverage
3335
36+
- run:
37+
name: Check coding standard & CodeSniffer
38+
command: |
39+
make ecs
40+
make phpcs
41+
3442
- store_artifacts:
3543
path: reports
3644

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ jobs:
3232
run: make drop-migrate
3333
- name: Generate keys
3434
run: make generate-jwt-keys
35+
- name: Create roles and groups
36+
run: make create-roles-groups
37+
- name: Setup transports for Messenger component
38+
run: make messenger-setup-transports
3539
- name: Run test suite
3640
run: make phpunit
41+
- name: Run coding standard
42+
run: make ecs
43+
- name: Run codeSniffer
44+
run: make phpcs
3745
- name: Stop the docker images
3846
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
# create document root
4749
RUN mkdir -p $APP_HOME/public
@@ -59,7 +61,9 @@ COPY ./docker/dev/xdebug.ini /tmp/
5961
RUN chmod u+x /tmp/do_we_need_xdebug.sh && /tmp/do_we_need_xdebug.sh
6062

6163
# install composer
62-
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer
64+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
65+
RUN chmod +x /usr/bin/composer
66+
ENV COMPOSER_ALLOW_SUPERUSER 1
6367

6468
# add supervisor
6569
RUN mkdir -p /var/log/supervisor
@@ -79,8 +83,8 @@ USER www-data
7983
COPY --chown=www-data:www-data . $APP_HOME/
8084

8185
# install all PHP dependencies
82-
RUN if [ "$BUILD_ARGUMENT_ENV" = "dev" ] || [ "$BUILD_ARGUMENT_ENV" = "test" ]; then composer install --optimize-autoloader --no-interaction --no-progress; \
83-
else export APP_ENV=$BUILD_ARGUMENT_ENV && composer install --optimize-autoloader --no-interaction --no-progress --no-dev; \
86+
RUN if [ "$BUILD_ARGUMENT_ENV" = "dev" ] || [ "$BUILD_ARGUMENT_ENV" = "test" ]; then COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-interaction --no-progress; \
87+
else export APP_ENV=$BUILD_ARGUMENT_ENV && COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-interaction --no-progress --no-dev; \
8488
fi
8589

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

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 Dmitriy Kravtsov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ wait-for-db:
9191
@make exec cmd="php bin/console db:wait"
9292

9393
composer-install-prod:
94-
@make exec cmd="composer install --optimize-autoloader --no-dev"
94+
@make exec-bash cmd="COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader --no-dev"
9595

9696
composer-install:
97-
@make exec cmd="composer install --optimize-autoloader"
97+
@make exec-bash cmd="COMPOSER_MEMORY_LIMIT=-1 composer install --optimize-autoloader"
9898

9999
composer-update:
100-
@make exec cmd="composer update"
100+
@make exec-bash cmd="COMPOSER_MEMORY_LIMIT=-1 composer update"
101101

102102
info:
103103
@make exec cmd="bin/console --version"
@@ -124,15 +124,21 @@ drop-migrate:
124124
@make migrate
125125

126126
migrate-prod:
127-
@make exec cmd="php bin/console doctrine:migrations:migrate --no-interaction"
127+
@make exec cmd="php bin/console doctrine:migrations:migrate --no-interaction --all-or-nothing"
128128

129129
migrate:
130-
@make exec cmd="php bin/console doctrine:migrations:migrate --no-interaction"
131-
@make exec cmd="php bin/console doctrine:migrations:migrate --no-interaction --env=test"
130+
@make exec cmd="php bin/console doctrine:migrations:migrate --no-interaction --all-or-nothing"
131+
@make exec cmd="php bin/console doctrine:migrations:migrate --no-interaction --all-or-nothing --env=test"
132132

133133
fixtures:
134134
@make exec cmd="php bin/console doctrine:fixtures:load --env=test"
135135

136+
create-roles-groups:
137+
@make exec cmd="php bin/console user:create-roles-groups"
138+
139+
messenger-setup-transports:
140+
@make exec cmd="php bin/console messenger:setup-transports"
141+
136142
phpunit:
137143
@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"
138144

bitbucket-pipelines.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@ pipelines:
1515
- make wait-for-db
1616
- make drop-migrate
1717
- make generate-jwt-keys
18+
- make create-roles-groups
19+
- make messenger-setup-transports
1820
- make phpunit
21+
- make ecs
22+
- make phpcs
1923
- make stop-test

composer.json

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
"role": "Developer"
2424
}
2525
],
26-
"support": {
27-
"issues": "https://github.com/dimadeush/docker-symfony-api/issues"
28-
},
29-
"prefer-stable": true,
3026
"require": {
3127
"php": "^7.4.0",
3228
"ext-ctype": "*",
@@ -35,19 +31,19 @@
3531
"ext-mbstring": "*",
3632
"ext-pdo": "*",
3733
"ext-pdo_mysql": "*",
34+
"antishov/doctrine-extensions-bundle": "^1.4",
3835
"doctrine/doctrine-migrations-bundle": "^2.1",
3936
"easycorp/easy-log-handler": "1.0.*",
40-
"jmose/command-scheduler-bundle": "^2.0",
37+
"jmose/command-scheduler-bundle": "^2.2",
4138
"lexik/jwt-authentication-bundle": "^2.6",
4239
"mark-gerarts/automapper-plus-bundle": "^1.2",
4340
"matthiasnoback/symfony-console-form": "^3.6",
44-
"nelmio/api-doc-bundle": "^3.5",
41+
"nelmio/api-doc-bundle": "^3.6",
4542
"nelmio/cors-bundle": "^2.0",
4643
"piwik/device-detector": "^3.12",
4744
"ramsey/uuid-doctrine": "^1.6",
4845
"sensio/framework-extra-bundle": "^5.5",
4946
"sensiolabs/security-checker": "^6.0",
50-
"antishov/doctrine-extensions-bundle": "^1.4",
5147
"symfony/amqp-pack": "^1.0",
5248
"symfony/asset": "4.4.*",
5349
"symfony/config": "4.4.*",
@@ -73,13 +69,27 @@
7369
"symfony/web-link": "4.4.*",
7470
"symfony/yaml": "4.4.*"
7571
},
72+
"replace": {
73+
"paragonie/random_compat": "2.*",
74+
"symfony/polyfill-ctype": "*",
75+
"symfony/polyfill-iconv": "*",
76+
"symfony/polyfill-php56": "*",
77+
"symfony/polyfill-php70": "*",
78+
"symfony/polyfill-php71": "*",
79+
"symfony/polyfill-php72": "*"
80+
},
81+
"conflict": {
82+
"symfony/symfony": "*"
83+
},
7684
"require-dev": {
7785
"bamarni/composer-bin-plugin": "^1.3",
7886
"doctrine/doctrine-fixtures-bundle": "^3.3",
87+
"ergebnis/composer-normalize": "^2.3",
7988
"roave/security-advisories": "dev-master",
8089
"symfony/debug-pack": "*",
8190
"symfony/maker-bundle": "^1.14",
82-
"symfony/profiler-pack": "*"
91+
"symfony/profiler-pack": "*",
92+
"symfony/requirements-checker": "^1.1"
8393
},
8494
"config": {
8595
"platform": {
@@ -90,6 +100,15 @@
90100
},
91101
"sort-packages": true
92102
},
103+
"extra": {
104+
"bamarni-bin": {
105+
"target-directory": "tools"
106+
},
107+
"symfony": {
108+
"allow-contrib": true,
109+
"require": "4.4.*"
110+
}
111+
},
93112
"autoload": {
94113
"psr-4": {
95114
"App\\": "src/"
@@ -104,41 +123,26 @@
104123
"Symfony\\Bridge\\PhpUnit\\": "tools/01_phpunit/vendor/symfony/phpunit-bridge"
105124
}
106125
},
107-
"replace": {
108-
"paragonie/random_compat": "2.*",
109-
"symfony/polyfill-ctype": "*",
110-
"symfony/polyfill-iconv": "*",
111-
"symfony/polyfill-php72": "*",
112-
"symfony/polyfill-php71": "*",
113-
"symfony/polyfill-php70": "*",
114-
"symfony/polyfill-php56": "*"
115-
},
126+
"prefer-stable": true,
116127
"scripts": {
117-
"auto-scripts": {
118-
"cache:clear": "symfony-cmd",
119-
"cache:warmup": "symfony-cmd",
120-
"assets:install %PUBLIC_DIR%": "symfony-cmd",
121-
"security-checker security:check": "script"
122-
},
123128
"post-install-cmd": [
129+
"if test -d vendor/symfony/requirements-checker; then ./vendor/bin/requirements-checker; fi",
124130
"if test -d vendor/bamarni/composer-bin-plugin; then composer bin all install; fi",
125131
"@auto-scripts"
126132
],
127133
"post-update-cmd": [
134+
"if test -d vendor/symfony/requirements-checker; then ./vendor/bin/requirements-checker; fi",
128135
"if test -d vendor/bamarni/composer-bin-plugin; then composer bin all update; fi",
129136
"@auto-scripts"
130-
]
131-
},
132-
"conflict": {
133-
"symfony/symfony": "*"
134-
},
135-
"extra": {
136-
"bamarni-bin": {
137-
"target-directory": "tools"
138-
},
139-
"symfony": {
140-
"allow-contrib": true,
141-
"require": "4.4.*"
137+
],
138+
"auto-scripts": {
139+
"cache:clear": "symfony-cmd",
140+
"cache:warmup": "symfony-cmd",
141+
"assets:install %PUBLIC_DIR%": "symfony-cmd",
142+
"security-checker security:check": "script"
142143
}
144+
},
145+
"support": {
146+
"issues": "https://github.com/dimadeush/docker-symfony-api/issues"
143147
}
144148
}

0 commit comments

Comments
 (0)