Skip to content

Commit 67bb779

Browse files
committed
[TASK] use docker-compose v2
1 parent 3f32491 commit 67bb779

File tree

2 files changed

+21
-44
lines changed

2 files changed

+21
-44
lines changed

Build/Scripts/runTests.sh

+20-43
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
#!/usr/bin/env bash
22

3-
#
4-
# TYPO3 core test runner based on docker and docker-compose.
5-
#
63

7-
# Function to write a .env file in Build/testing-docker/local
8-
# This is read by docker-compose and vars defined here are
9-
# used in Build/testing-docker/local/docker-compose.yml
104
setUpDockerComposeDotEnv() {
115
# Delete possibly existing local .env file if exists
126
[ -e .env ] && rm .env
13-
# Set up a new .env file for docker-compose
147
echo "COMPOSE_PROJECT_NAME=local" >> .env
15-
# To prevent access rights of files created by the testing, the docker image later
16-
# runs with the same user that is currently executing the script. docker-compose can't
17-
# use $UID directly itself since it is a shell variable and not an env variable, so
18-
# we have to set it explicitly here.
198
echo "HOST_UID=`id -u`" >> .env
209
# Your local home directory for composer and npm caching
2110
echo "HOST_HOME=${HOME}" >> .env
@@ -35,15 +24,10 @@ setUpDockerComposeDotEnv() {
3524

3625
# Load help text into $HELP
3726
read -r -d '' HELP <<EOF
38-
menus test runner. Execute unit test suite and some other details.
39-
Also used by travis-ci for test execution.
40-
41-
Successfully tested with docker version 18.06.1-ce and docker-compose 1.21.2.
27+
menus test runner.
4228
4329
Usage: $0 [options] [file]
4430
45-
No arguments: Run all unit tests with PHP 7.4
46-
4731
Options:
4832
-s <...>
4933
Specifies which test suite to run
@@ -111,18 +95,11 @@ Examples:
11195
./Build/Scripts/runTests.sh -p 7.3
11296
EOF
11397

114-
# Test if docker-compose exists, else exit out with error
115-
if ! type "docker-compose" > /dev/null; then
116-
echo "This script relies on docker and docker-compose. Please install" >&2
117-
exit 1
118-
fi
119-
12098
# Go to the directory this script is located, so everything else is relative
12199
# to this dir, no matter from where this script is called.
122100
THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
123101
cd "$THIS_SCRIPT_DIR" || exit 1
124102

125-
# Go to directory that contains the local docker-compose.yml file
126103
cd ../testing-docker || exit 1
127104

128105
# Option defaults
@@ -215,49 +192,49 @@ fi
215192
case ${TEST_SUITE} in
216193
acceptance)
217194
setUpDockerComposeDotEnv
218-
docker-compose run acceptance_backend_mariadb10
195+
docker compose run acceptance_backend_mariadb10
219196
SUITE_EXIT_CODE=$?
220-
docker-compose down
197+
docker compose down
221198
;;
222199
cgl)
223200
# Active dry-run for cgl needs not "-n" but specific options
224201
if [ -n "${CGLCHECK_DRY_RUN}" ]; then
225202
CGLCHECK_DRY_RUN="--dry-run --diff"
226203
fi
227204
setUpDockerComposeDotEnv
228-
docker-compose run cgl
205+
docker compose run cgl
229206
SUITE_EXIT_CODE=$?
230-
docker-compose down
207+
docker compose down
231208
;;
232209
composerInstall)
233210
setUpDockerComposeDotEnv
234-
docker-compose run composer_install
211+
docker compose run composer_install
235212
SUITE_EXIT_CODE=$?
236-
docker-compose down
213+
docker compose down
237214
;;
238215
composerValidate)
239216
setUpDockerComposeDotEnv
240-
docker-compose run composer_validate
217+
docker compose run composer_validate
241218
SUITE_EXIT_CODE=$?
242-
docker-compose down
219+
docker compose down
243220
;;
244221
functional)
245222
setUpDockerComposeDotEnv
246223
case ${DBMS} in
247224
mariadb)
248-
docker-compose run functional_mariadb10
225+
docker compose run functional_mariadb10
249226
SUITE_EXIT_CODE=$?
250227
;;
251228
mssql)
252-
docker-compose run functional_mssql2019latest
229+
docker compose run functional_mssql2019latest
253230
SUITE_EXIT_CODE=$?
254231
;;
255232
postgres)
256-
docker-compose run functional_postgres10
233+
docker compose run functional_postgres10
257234
SUITE_EXIT_CODE=$?
258235
;;
259236
sqlite)
260-
docker-compose run functional_sqlite
237+
docker compose run functional_sqlite
261238
SUITE_EXIT_CODE=$?
262239
;;
263240
*)
@@ -266,25 +243,25 @@ case ${TEST_SUITE} in
266243
echo "${HELP}" >&2
267244
exit 1
268245
esac
269-
docker-compose down
246+
docker compose down
270247
;;
271248
lint)
272249
setUpDockerComposeDotEnv
273-
docker-compose run lint
250+
docker compose run lint
274251
SUITE_EXIT_CODE=$?
275-
docker-compose down
252+
docker compose down
276253
;;
277254
phpstan)
278255
setUpDockerComposeDotEnv
279-
docker-compose run phpstan
256+
docker compose run phpstan
280257
SUITE_EXIT_CODE=$?
281-
docker-compose down
258+
docker compose down
282259
;;
283260
unit)
284261
setUpDockerComposeDotEnv
285-
docker-compose run unit
262+
docker compose run unit
286263
SUITE_EXIT_CODE=$?
287-
docker-compose down
264+
docker compose down
288265
;;
289266
update)
290267
# pull typo3/core-testing-*:latest versions of those ones that exist locally

Build/testing-docker/docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ services:
6363
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
6464
set -x
6565
fi
66-
php -dxdebug.mode=off .Build/vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix -v ${CGLCHECK_DRY_RUN} \
66+
php -dxdebug.mode=off .Build/vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix -v ${CGLCHECK_DRY_RUN} \\
6767
--config=Build/php-cs-fixer.php --using-cache=no
6868
"
6969

0 commit comments

Comments
 (0)