Simplify the call of the php-cs-fixer

This commit is contained in:
ErickSkrauch 2018-04-18 02:48:27 +03:00
parent 02ea7346a8
commit f09eb86e5c

View File

@ -24,19 +24,14 @@ test:backend:
script:
- export TEMP_DEV_IMAGE="${CONTAINER_IMAGE}:ci-${CI_BUILD_ID}"
- docker build --pull -f Dockerfile-dev -t $TEMP_DEV_IMAGE .
# https://github.com/FriendsOfPHP/PHP-CS-Fixer#using-php-cs-fixer-on-ci
- COMMIT_RANGE="${CI_COMMIT_BEFORE_SHA}...${CI_COMMIT_SHA}"
- CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "${COMMIT_RANGE}")
- |
if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php_cs(\\.dist)?|composer\\.lock)$"; then
EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}")
else
EXTRA_ARGS=''
fi
- >
docker run --rm
$TEMP_DEV_IMAGE
vendor/bin/php-cs-fixer fix -v --dry-run --stop-on-violation --using-cache=no ${EXTRA_ARGS}
bash -c "
rm /usr/local/etc/php/conf.d/xdebug.ini &&
cp -r /var/www/vendor /var/www/html/vendor &&
vendor/bin/php-cs-fixer fix -v --dry-run
"
- >
docker run --rm
--add-host=mariadb:`getent hosts mariadb | awk '{ print $1 ; exit }'`