Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Sync branches #388

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
37 changes: 16 additions & 21 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,31 @@ DB_NAME=wordpress
DB_HOST=app_db
DB_USER=wordpress
DB_PASSWORD=wordpress

WP_TABLE_PREFIX=wp_
WP_URL=http://localhost
WP_URL=http://localhost:8091
WP_DOMAIN=localhost

[email protected]
ADMIN_USERNAME=admin
ADMIN_PASSWORD=password
ADMIN_PATH=/wp-admin

TEST_DB_NAME=wpgraphql_acf_tests
TEST_DB_HOST=127.0.0.1
TEST_DB_USER=root
TEST_DB_PASSWORD=root
TEST_WP_TABLE_PREFIX=wp_

SKIP_DB_CREATE=false
TEST_WP_ROOT_FOLDER=/tmp/wordpress
[email protected]

TESTS_DIR=tests
TESTS_OUTPUT=tests/_output
TESTS_DATA=tests/_data
TESTS_SUPPORT=tests/_support
TESTS_ENVS=tests/_envs

#WPGRAPHQL_VERSION=v1.3.3
SKIP_TESTS_CLEANUP=1
SUITES=wpunit

# Used by wp-config.php
WORDPRESS_DB_HOST=${DB_HOST}
WORDPRESS_DB_USER=${DB_USER}
WORDPRESS_DB_PASSWORD=${DB_PASSWORD}
WORDPRESS_DB_NAME=${DB_NAME}
WORDPRESS_TABLE_PREFIX=${WP_TABLE_PREFIX}

# Used by db container
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=${DB_NAME}
MYSQL_USER=${DB_USER}
MYSQL_PASSWORD=${DB_PASSWORD}

# docker container env vars
WP_VERSION=5.9
PHP_VERSION=8.0
WPGRAPHQL_VERSION=latest
DATA_DUMP_DIR=/var/www/html/wp-content/plugins/wp-graphql-acf/tests/_data
65 changes: 65 additions & 0 deletions .env.testing
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Used by wp-graphql image to create the WP
DB_NAME=wordpress
DB_HOST=testing_db
DB_USER=wordpress
DB_PASSWORD=wordpress

WP_TABLE_PREFIX=wp_
WP_URL=http://localhost:8091
WP_DOMAIN=localhost

[email protected]
ADMIN_USERNAME=admin
ADMIN_PASSWORD=password
ADMIN_PATH=/wp-admin

# Used by codeception WPBrowser
TEST_SITE_DB_DSN=mysql:host=${DB_HOST};dbname=${DB_NAME}
TEST_SITE_DB_HOST=${DB_HOST}
TEST_SITE_DB_NAME=${DB_NAME}
TEST_SITE_DB_USER=${DB_USER}
TEST_SITE_DB_PASSWORD=${DB_PASSWORD}
TEST_SITE_TABLE_PREFIX=${WP_TABLE_PREFIX}
TEST_SITE_ADMIN_USERNAME=admin
TEST_SITE_ADMIN_PASSWORD=password
TEST_SITE_WP_ADMIN_PATH=/wp-admin
WP_ROOT_FOLDER=/var/www/html

TEST_DB_NAME=${DB_NAME}
TEST_DB_HOST=${DB_HOST}
TEST_DB_USER=${DB_USER}
TEST_DB_PASSWORD=${DB_PASSWORD}
TEST_TABLE_PREFIX=${WP_TABLE_PREFIX}

TEST_SITE_WP_URL=http://localhost
TEST_SITE_WP_DOMAIN=localhost
TEST_SITE_ADMIN_EMAIL=admin@localhost

# Used by wp-graphql-testing docker
TESTS_DIR=tests
TESTS_OUTPUT=tests/_output
TESTS_DATA=tests/_data
TESTS_SUPPORT=tests/_support
TESTS_ENVS=tests/_envs

SUITES=wpunit
SKIP_TESTS_CLEANUP=1

# Used by wp-config.php
WORDPRESS_DB_HOST=${DB_HOST}
WORDPRESS_DB_USER=${DB_USER}
WORDPRESS_DB_PASSWORD=${DB_PASSWORD}
WORDPRESS_DB_NAME=${DB_NAME}
WORDPRESS_TABLE_PREFIX=${WP_TABLE_PREFIX}

# Used by db container
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=${DB_NAME}
MYSQL_USER=${DB_USER}
MYSQL_PASSWORD=${DB_PASSWORD}

# docker container env vars
WP_VERSION=5.9
PHP_VERSION=8.0
WPGRAPHQL_VERSION=latest
DATA_DUMP_DIR=/var/www/html/wp-content/plugins/wp-graphql-acf/tests/_data
28 changes: 19 additions & 9 deletions .github/workflows/testing-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ on:
- master
paths:
- '**.php'
- '.github/workflows/*.yml'
- '!docs/**'

jobs:
continuous_integration:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '7.3', '7.4' ]
wordpress: [ '5.7.2', '5.6.2', '5.5.3' ]
php: [ '8.0', '7.4', '7.3' ]
wordpress: [ '6.0', '5.9', '5.8', '5.7.2', '5.6', '5.5.3' ]
include:
- php: '8.0'
wordpress: '5.7.2'
Expand Down Expand Up @@ -62,12 +63,13 @@ jobs:
WPGRAPHQL_VERSION: 'v0.11.0'
- php: '7.4'
wordpress: '5.5.3'
- php: '7.4'
wordpress: '5.4.2'
- php: '7.3'
wordpress: '5.5.3'
exclude:
- php: '8.0'
wordpress: '5.5.3'
- php: '7.3'
wordpress: '5.4.2'
wordpress: '6.0'
fail-fast: false
name: WordPress ${{ matrix.wordpress }} on PHP ${{ matrix.php }}
steps:
Expand All @@ -78,6 +80,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: json, mbstring, zip, unzip

- name: Get Composer Cache Directory
Expand All @@ -88,24 +91,31 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
key: php-${{ matrix.php }}-${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: php-${{ matrix.php }}-${{ runner.os }}-composer-

- name: Install dependencies
run: composer install

- name: Build "testing" Docker Image
- name: Build container image
env:
PHP_VERSION: ${{ matrix.php }}
WP_VERSION: ${{ matrix.wordpress }}
run: composer build-test
run: |
docker-compose build \
--build-arg WP_VERSION=${{ matrix.wordpress }} \
--build-arg PHP_VERSION=${{ matrix.php }} \
--build-arg DOCKER_REGISTRY=ghcr.io/wp-graphql/

- name: Run Tests w/ Docker.
env:
COVERAGE: ${{ matrix.coverage }}
USING_XDEBUG: ${{ matrix.coverage }}
DEBUG: ${{ matrix.debug }}
SKIP_TESTS_CLEANUP: ${{ matrix.coverage }}
PHP_VERSION: ${{ matrix.php }}
WP_VERSION: ${{ matrix.wordpress }}
DOCKER_REGISTRY: ghcr.io/wp-graphql/
run: composer run-test

- name: Push Codecoverage to Coveralls.io
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload-schema-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup PHP w/ Composer & WP-CLI
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
php-version: 8.0
extensions: mbstring, intl, bcmath, exif, gd, mysqli, opcache, zip, pdo_mysql
coverage: none
tools: composer, wp-cli
Expand Down
23 changes: 23 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"xdebugSettings": {
"max_children": 128,
"max_data": 1024,
"max_depth": 3,
"show_hidden": 1
},
"pathMappings": {
"/var/www/html/wp-content/plugins/wp-graphql-acf": "${workspaceFolder}",
"/var/www/html/wp-content/plugins/wp-graphql": "${workspaceFolder}../wp-graphql",
"/var/www/html/wp-content/plugins/acf": "${workspaceFolder}/wp-content/plugins/acf",
"/var/www/html": "${workspaceFolder}/wordpress",
}
}
]
}
36 changes: 22 additions & 14 deletions bin/run-docker.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ if [ -z "$1" ]; then
fi

TAG=${TAG-latest}
WP_VERSION=${WP_VERSION-5.6}
PHP_VERSION=${PHP_VERSION-7.4}
WP_VERSION=${WP_VERSION-5.9}
PHP_VERSION=${PHP_VERSION-8.0}
DOCKER_REGISTRY=${DOCKER_REGISTRY-ghcr.io/wp-graphql/}

BUILD_NO_CACHE=${BUILD_NO_CACHE-}

Expand All @@ -44,22 +45,27 @@ case "$subcommand" in
;;
a )
echo "Build app"
docker build $BUILD_NO_CACHE -f docker/app.Dockerfile \
-t wpgraphql-acf-app:latest \
--build-arg WP_VERSION=${WP_VERSION-5.4} \
--build-arg PHP_VERSION=${PHP_VERSION-7.4} \
docker build $BUILD_NO_CACHE -f docker/Dockerfile \
-t wpgraphql-acf-app:${TAG}-wp${WP_VERSION}-php${PHP_VERSION} \
--build-arg WP_VERSION=${WP_VERSION} \
--build-arg PHP_VERSION=${PHP_VERSION} \
--build-arg DOCKER_REGISTRY=${DOCKER_REGISTRY} \
.
;;
t )
echo "Build app"
docker build $BUILD_NO_CACHE -f docker/app.Dockerfile \
-t wpgraphql-acf-app:latest \
--build-arg WP_VERSION=${WP_VERSION-5.4} \
--build-arg PHP_VERSION=${PHP_VERSION-7.4} \
docker build $BUILD_NO_CACHE -f docker/Dockerfile \
-t wpgraphql-acf-app:${TAG}-wp${WP_VERSION}-php${PHP_VERSION} \
--build-arg WP_VERSION=${WP_VERSION} \
--build-arg PHP_VERSION=${PHP_VERSION} \
--build-arg DOCKER_REGISTRY=${DOCKER_REGISTRY} \
.
echo "Build testing"
docker build $BUILD_NO_CACHE -f docker/testing.Dockerfile \
-t wpgraphql-acf-testing:latest \
docker build $BUILD_NO_CACHE -f docker/Dockerfile.testing \
-t wpgraphql-acf-testing:${TAG}-wp${WP_VERSION}-php${PHP_VERSION} \
--build-arg WP_VERSION=${WP_VERSION} \
--build-arg PHP_VERSION=${PHP_VERSION} \
--build-arg DOCKER_REGISTRY=${DOCKER_REGISTRY} \
.
;;
\? ) print_usage_instructions;;
Expand All @@ -72,14 +78,16 @@ case "$subcommand" in
while getopts ":at" opt; do
case ${opt} in
a )
docker-compose up --scale testing=0
WP_VERSION=${WP_VERSION} PHP_VERSION=${PHP_VERSION} docker compose up app
;;
t )
docker-compose run --rm \
-e COVERAGE=${COVERAGE-} \
-e USING_XDEBUG=${USING_XDEBUG-} \
-e DEBUG=${DEBUG-} \
-e WPGRAPHQL_VERSION=${WPGRAPHQL_VERSION-} \
-e WP_VERSION=${WP_VERSION} \
-e PHP_VERSION=${PHP_VERSION} \
-e DOCKER_REGISTRY=${DOCKER_REGISTRY} \
testing --scale app=0
;;
\? ) print_usage_instructions;;
Expand Down
17 changes: 8 additions & 9 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ paths:
support: '%TESTS_SUPPORT%'
envs: '%TESTS_ENVS%'
params:
- env
- .env
- .env.testing
actor_suffix: Tester
settings:
colors: true
Expand Down Expand Up @@ -64,13 +63,13 @@ modules:
uploads: '/wp-content/uploads'
WPLoader:
wpRootFolder: '%WP_ROOT_FOLDER%'
dbName: '%DB_NAME%'
dbHost: '%DB_HOST%'
dbUser: '%DB_USER%'
dbPassword: '%DB_PASSWORD%'
tablePrefix: '%WP_TABLE_PREFIX%'
domain: '%WP_DOMAIN%'
adminEmail: '%ADMIN_EMAIL%'
dbName: '%TEST_DB_NAME%'
dbHost: '%TEST_DB_HOST%'
dbUser: '%TEST_DB_USER%'
dbPassword: '%TEST_DB_PASSWORD%'
tablePrefix: '%TEST_TABLE_PREFIX%'
domain: '%TEST_SITE_WP_DOMAIN%'
adminEmail: '%TEST_SITE_ADMIN_EMAIL%'
title: 'Test'
plugins:
- wp-graphql-acf/tests/_bootstrap/bootstrap.php
Expand Down
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
}],
"config": {
"optimize-autoloader": true,
"process-timeout": 0
"process-timeout": 0,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
}
},
"autoload": {
"psr-4": {
Expand Down
Loading
Loading