Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Tools: Add support for docker-compose.override.yml #4457

Merged
merged 4 commits into from
Jan 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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