65 lines
1.6 KiB
YAML
65 lines
1.6 KiB
YAML
services:
|
|
db:
|
|
image: mysql:8.0
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: root
|
|
MYSQL_DATABASE: wordpress_tests
|
|
tmpfs:
|
|
- /var/lib/mysql
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
|
interval: 5s
|
|
retries: 10
|
|
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
volumes:
|
|
- .:/app
|
|
- composer-cache:/root/.composer/cache
|
|
environment:
|
|
- WP_TESTS_DIR=/app/vendor/wp-phpunit/wp-phpunit
|
|
- WP_PHPUNIT__TESTS_CONFIG=/app/tests/wp-tests-config.php
|
|
entrypoint: >
|
|
sh -c "
|
|
composer install --no-interaction &&
|
|
if [ ! -f /app/tests/wp-tests-config.php ]; then
|
|
curl -sL https://github.com/WordPress/wordpress-develop/raw/master/wp-tests-config-sample.php > /tmp/wp-tests-config-sample.php &&
|
|
sed 's/youremptytestdbnamehere/wordpress_tests/' /tmp/wp-tests-config-sample.php | sed 's/yourusernamehere/root/' | sed 's/yourpasswordhere/root/' | sed 's/localhost/db/' > /app/tests/wp-tests-config.php
|
|
fi &&
|
|
composer test
|
|
"
|
|
|
|
phpstan:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
volumes:
|
|
- .:/app
|
|
- composer-cache:/root/.composer/cache
|
|
command: >
|
|
sh -c "
|
|
composer install --no-interaction &&
|
|
composer phpstan
|
|
"
|
|
|
|
lint:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
volumes:
|
|
- .:/app
|
|
- composer-cache:/root/.composer/cache
|
|
command: >
|
|
sh -c "
|
|
composer install --no-interaction &&
|
|
composer lint
|
|
"
|
|
|
|
volumes:
|
|
composer-cache:
|