-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
21 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
#!/bin/bash | ||
set -e | ||
PS_VERSION=$1 | ||
DOCKER_IMAGE=${DOCKER_IMAGE:-prestashop/prestashop:$PS_VERSION} | ||
|
||
echo "Pull PrestaShop files (Tag ${PS_VERSION})..." | ||
docker pull $DOCKER_IMAGE | ||
set -e | ||
|
||
# Docker images prestashop/prestashop may be used, even if the shop remains uninstalled | ||
echo "Pull PrestaShop files (Tag ${PS_VERSION})" | ||
|
||
echo "Get the PrestaShop sources..." | ||
SOURCES_DIR=$(mktemp -d) | ||
CONTAINER=$(docker create "${DOCKER_IMAGE}") | ||
docker cp ${CONTAINER}:/var/www/html ${SOURCES_DIR} | ||
docker rm -f ${CONTAINER} | ||
docker rm -f temp-ps || true | ||
docker volume rm -f ps-volume || true | ||
|
||
echo "Add the module sources..." | ||
cp -r ${PWD} ${SOURCES_DIR}/modules/blockreassurance | ||
docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:$PS_VERSION | ||
|
||
# Clear previous instance of the module in the PrestaShop volume | ||
echo "Clear previous module" | ||
|
||
docker exec -t --user root temp-ps rm -rf /var/www/html/modules/blockreassurance | ||
|
||
# Run a container for PHPStan, having access to the module content and PrestaShop sources. | ||
# This tool is outside the composer.json because of the compatibility with PHP 5.6 | ||
echo "Run PHPStan using phpstan-${PS_VERSION}.neon file" | ||
docker run --rm \ | ||
-v ${SOURCES_DIR}:/var/www/html \ | ||
-e _PS_ROOT_DIR_=/var/www/html \ | ||
--workdir=/var/www/html/modules/blockreassurance \ | ||
phpstan/phpstan:0.12 \ | ||
analyse \ | ||
--configuration=/var/www/html/modules/blockreassurance/tests/phpstan/phpstan-$PS_VERSION.neon | ||
|
||
echo "Closing..." | ||
rm -rf ${SOURCES_DIR} | ||
|
||
docker run --rm --volumes-from temp-ps \ | ||
-v $PWD:/var/www/html/modules/blockreassurance \ | ||
-e _PS_ROOT_DIR_=/var/www/html \ | ||
--workdir=/var/www/html/modules/blockreassurance phpstan/phpstan:0.12 \ | ||
analyse \ | ||
--configuration=/var/www/html/modules/blockreassurance/tests/phpstan/phpstan-$PS_VERSION.neon |