Skip to content

Commit

Permalink
Build Tools: Add support for docker-compose.override.yml (#4457)
Browse files Browse the repository at this point in the history
As we don't actually use the `docker` directory to contain anything, the `docker-compose.yml` file has also been moved to the root directory. This tidies up a bunch of commands that used to have to refer to the special file location.
  • Loading branch information
pento committed Jan 14, 2018
1 parent ae9b07f commit 9fe1ddc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ gutenberg.zip
*.log
phpcs.xml
yarn.lock
docker-compose.override.yml
4 changes: 2 additions & 2 deletions bin/run-wp-unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ fi

echo Running with the following versions:
if [ ${DOCKER} = "true" ]; then
docker-compose -f docker/docker-compose.yml run --rm wordpress_phpunit php -v
docker-compose -f docker/docker-compose.yml run --rm wordpress_phpunit phpunit --version
docker-compose run --rm wordpress_phpunit php -v
docker-compose run --rm wordpress_phpunit phpunit --version
else
php -v
phpunit --version
Expand Down
9 changes: 7 additions & 2 deletions bin/setup-local-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
set -e

# Change to the expected directory
cd "$(dirname "$0")/../docker"
cd "$(dirname "$0")/.."

# Launch the containers
docker-compose up -d
if ! docker-compose up -d; then
# Launching may fail due to the docker config file directory having changed.
# Remove the old wordpress-dev container, and try again.
docker container rm -fv wordpress-dev
docker-compose up -d
fi

# Wait until the docker containers are setup properely
echo "Attempting to connect to wordpress"
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yml → docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
WORDPRESS_DB_PASSWORD: example
ABSPATH: /usr/src/wordpress/
volumes:
- ../:/var/www/html/wp-content/plugins/gutenberg
- .:/var/www/html/wp-content/plugins/gutenberg
container_name: wordpress-dev

mysql:
Expand All @@ -24,7 +24,7 @@ services:
environment:
PHPUNIT_DB_HOST: mysql
volumes:
- ..:/app
- .:/app
- testsuite:/tmp

volumes:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@
"test-php": "npm run lint-php && npm run test-unit-php",
"ci": "concurrently \"npm run lint && npm run build\" \"npm run test-unit:coverage-ci\"",
"fixtures:clean": "rimraf \"blocks/test/fixtures/*.+(json|serialized.html)\"",
"fixtures:server-registered": "docker-compose -f docker/docker-compose.yml run -w /var/www/html/wp-content/plugins/gutenberg --rm wordpress ./bin/get-server-blocks.php > blocks/test/server-registered.json",
"fixtures:server-registered": "docker-compose run -w /var/www/html/wp-content/plugins/gutenberg --rm wordpress ./bin/get-server-blocks.php > blocks/test/server-registered.json",
"fixtures:generate": "npm run fixtures:server-registered && cross-env GENERATE_MISSING_FIXTURES=y npm run test-unit",
"fixtures:regenerate": "npm run fixtures:clean && npm run fixtures:generate",
"package-plugin": "./bin/build-plugin-zip.sh",
"test-unit": "jest",
"test-unit-php": "docker-compose -f docker/docker-compose.yml run --rm wordpress_phpunit phpunit",
"test-unit-php-multisite": "docker-compose -f docker/docker-compose.yml run -e WP_MULTISITE=1 --rm wordpress_phpunit phpunit",
"test-unit-php": "docker-compose run --rm wordpress_phpunit phpunit",
"test-unit-php-multisite": "docker-compose run -e WP_MULTISITE=1 --rm wordpress_phpunit phpunit",
"test-unit:coverage": "jest --coverage",
"test-unit:coverage-ci": "jest --coverage --maxWorkers 1 && codecov",
"test-unit:watch": "jest --watch",
Expand Down

0 comments on commit 9fe1ddc

Please sign in to comment.