Sync PHP app into php1 on CI runner
This commit is contained in:
+1
-1
@@ -211,7 +211,7 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
AUTO_COMPOSER_INSTALL: "true"
|
AUTO_COMPOSER_INSTALL: "${AUTO_COMPOSER_INSTALL:-true}"
|
||||||
EDGE_BROKER_URL: ${EDGE_BROKER_URL:-http://edge-broker:4300}
|
EDGE_BROKER_URL: ${EDGE_BROKER_URL:-http://edge-broker:4300}
|
||||||
EDGE_BROKER_SHARED_SECRET: ${EDGE_BROKER_SHARED_SECRET:-truckwash-edge-dev}
|
EDGE_BROKER_SHARED_SECRET: ${EDGE_BROKER_SHARED_SECRET:-truckwash-edge-dev}
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ if [[ -f .env ]]; then
|
|||||||
set +a
|
set +a
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export AUTO_COMPOSER_INSTALL=false
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
docker compose down -v --remove-orphans || true
|
docker compose down -v --remove-orphans || true
|
||||||
}
|
}
|
||||||
@@ -70,6 +72,23 @@ run_php_command() {
|
|||||||
docker exec "${env_args[@]}" php1 sh -lc "cd /var/www/html && ${PHP_COMMAND}"
|
docker exec "${env_args[@]}" php1 sh -lc "cd /var/www/html && ${PHP_COMMAND}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sync_php_app_into_container() {
|
||||||
|
docker exec php1 sh -lc 'mkdir -p /var/www/html && find /var/www/html -mindepth 1 -maxdepth 1 -exec rm -rf {} +'
|
||||||
|
docker cp "${repo_root}/services/nginx/app/." php1:/var/www/html/
|
||||||
|
}
|
||||||
|
|
||||||
|
install_php_dependencies() {
|
||||||
|
PHP_COMMAND="composer install --no-interaction --prefer-dist"
|
||||||
|
docker_exec_php1
|
||||||
|
docker exec php1 sh -lc '
|
||||||
|
module_dir="/var/www/html/modules/washcertificates"
|
||||||
|
if [ -f "$module_dir/composer.json" ]; then
|
||||||
|
cd "$module_dir"
|
||||||
|
composer install --no-interaction --prefer-dist
|
||||||
|
fi
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
docker compose down -v --remove-orphans || true
|
docker compose down -v --remove-orphans || true
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
@@ -85,8 +104,8 @@ if [[ "$suite" != "unit" ]]; then
|
|||||||
wait_for_container_healthy mysql-debug
|
wait_for_container_healthy mysql-debug
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PHP_COMMAND="composer install --no-interaction --prefer-dist"
|
sync_php_app_into_container
|
||||||
docker_exec_php1
|
install_php_dependencies
|
||||||
|
|
||||||
case "$suite" in
|
case "$suite" in
|
||||||
unit)
|
unit)
|
||||||
@@ -94,6 +113,8 @@ case "$suite" in
|
|||||||
docker_exec_php1
|
docker_exec_php1
|
||||||
PHP_COMMAND="composer test:coverage"
|
PHP_COMMAND="composer test:coverage"
|
||||||
docker_exec_php1
|
docker_exec_php1
|
||||||
|
mkdir -p "${repo_root}/services/nginx/app/build/logs"
|
||||||
|
docker cp php1:/var/www/html/build/logs/clover.xml "${repo_root}/services/nginx/app/build/logs/clover.xml" 2>/dev/null || true
|
||||||
;;
|
;;
|
||||||
integration)
|
integration)
|
||||||
PHP_COMMAND="composer test:integration"
|
PHP_COMMAND="composer test:integration"
|
||||||
|
|||||||
Reference in New Issue
Block a user