From d8795da16227a2c81abaef7ec5711ddad3a8881a Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Mon, 19 Jul 2021 13:55:12 -0600 Subject: [PATCH 01/12] - update install-test-env.sh --- .gitignore | 3 +++ bin/install-test-env.sh | 7 ++++--- composer.json | 2 +- vendor/composer/InstalledVersions.php | 12 ++++++------ vendor/composer/installed.php | 12 ++++++------ vendor/composer/platform_check.php | 4 ++-- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index e6c29ad..cbb1489 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ vendor/composer/installed.json vendor/composer/*/ composer.lock .log +local +wp-content + diff --git a/bin/install-test-env.sh b/bin/install-test-env.sh index c256bfc..b50f674 100644 --- a/bin/install-test-env.sh +++ b/bin/install-test-env.sh @@ -1,12 +1,13 @@ #!/usr/bin/env bash -if [[ ! -f ".env" ]]; then +if [ ! -f .env ]; then echo "No .env file was detected. .env.dist has been copied to .env" echo "Open the .env file and enter values to match your local environment" - cp .env.dist .env + cp ./.env.dist ./.env + export $(cat .env | xargs) fi -source .env.dist +source .env env | sort diff --git a/composer.json b/composer.json index a5fcb29..27e9200 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ "phpstan": ["phpstan analyze --ansi --memory-limit=1G"] }, "require": { - "php": "^7" + "php": "^7.1 || ^8.0" }, "require-dev": { "lucatume/wp-browser": "^2.4", diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index 6b5a555..9883b9f 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -25,24 +25,24 @@ class InstalledVersions private static $installed = array ( 'root' => array ( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', 'aliases' => array ( ), - 'reference' => 'dc5e83d190211baf88978a905ff44a9122fdaff8', + 'reference' => 'f34bb96ba52af54541439299b04e2b95d4f7564a', 'name' => 'wp-graphql/wp-graphql-acf', ), 'versions' => array ( 'wp-graphql/wp-graphql-acf' => array ( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', 'aliases' => array ( ), - 'reference' => 'dc5e83d190211baf88978a905ff44a9122fdaff8', + 'reference' => 'f34bb96ba52af54541439299b04e2b95d4f7564a', ), ), ); diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 933c2e4..ad9b805 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,24 +1,24 @@ array ( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', 'aliases' => array ( ), - 'reference' => 'dc5e83d190211baf88978a905ff44a9122fdaff8', + 'reference' => 'f34bb96ba52af54541439299b04e2b95d4f7564a', 'name' => 'wp-graphql/wp-graphql-acf', ), 'versions' => array ( 'wp-graphql/wp-graphql-acf' => array ( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', + 'pretty_version' => 'dev-develop', + 'version' => 'dev-develop', 'aliases' => array ( ), - 'reference' => 'dc5e83d190211baf88978a905ff44a9122fdaff8', + 'reference' => 'f34bb96ba52af54541439299b04e2b95d4f7564a', ), ), ); diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php index f79e574..6d3407d 100644 --- a/vendor/composer/platform_check.php +++ b/vendor/composer/platform_check.php @@ -4,8 +4,8 @@ $issues = array(); -if (!(PHP_VERSION_ID >= 70000)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.0". You are running ' . PHP_VERSION . '.'; +if (!(PHP_VERSION_ID >= 70100)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.1.0". You are running ' . PHP_VERSION . '.'; } if ($issues) { From 76ca4f4633880b2f12263120aaec493709f32186 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Mon, 19 Jul 2021 14:07:38 -0600 Subject: [PATCH 02/12] - update install-test-env.sh --- .env.dist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.dist b/.env.dist index dedf78c..2a32741 100644 --- a/.env.dist +++ b/.env.dist @@ -12,8 +12,8 @@ ADMIN_PATH=/wp-admin TEST_DB_NAME=wpgraphql_acf_tests TEST_DB_HOST=127.0.0.1 -TEST_DB_USER=wordpress -TEST_DB_PASSWORD=wordpress +TEST_DB_USER=root +TEST_DB_PASSWORD=root TEST_WP_TABLE_PREFIX=wp_ SKIP_DB_CREATE=false From 1f9b9ed5470548000b76a0c6f448a525f6799cf5 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Mon, 19 Jul 2021 14:10:56 -0600 Subject: [PATCH 03/12] - update workflow commands --- .github/workflows/upload-schema-artifact.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/upload-schema-artifact.yml b/.github/workflows/upload-schema-artifact.yml index be2a814..2952796 100644 --- a/.github/workflows/upload-schema-artifact.yml +++ b/.github/workflows/upload-schema-artifact.yml @@ -42,12 +42,10 @@ jobs: - name: Install WP CLI for ACF run: | - cd /tmp/wordpress/ - wp plugin install https://github.com/hoppinger/advanced-custom-fields-wpcli/archive/refs/heads/master.zip --activate + wp plugin install https://github.com/hoppinger/advanced-custom-fields-wpcli/archive/refs/heads/master.zip --activate --path="/tmp/wordpress" - name: Import test Field Group run: | - echo ${GITHUB_WORKSPACE}/docs/field-group-examples-export.json - wp acf import --json_file="${GITHUB_WORKSPACE}/docs/field-group-examples-export.json" + wp acf import --json_file="${GITHUB_WORKSPACE}/docs/field-group-examples-export.json" --path="/tmp/wordpress" - name: Generate the Static Schema run: | cd /tmp/wordpress/ From 1583db12308bcb2451a881add3fd2fc8a9808f34 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Mon, 19 Jul 2021 14:34:09 -0600 Subject: [PATCH 04/12] - add action to upload the Schema as an artifact --- .github/workflows/upload-schema-artifact.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/upload-schema-artifact.yml b/.github/workflows/upload-schema-artifact.yml index 2952796..69550bb 100644 --- a/.github/workflows/upload-schema-artifact.yml +++ b/.github/workflows/upload-schema-artifact.yml @@ -52,6 +52,11 @@ jobs: # Output: /tmp/schema.graphql wp graphql generate-static-schema echo "$( Date: Mon, 19 Jul 2021 14:34:43 -0600 Subject: [PATCH 05/12] - remove printing of the Schema --- .github/workflows/upload-schema-artifact.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/upload-schema-artifact.yml b/.github/workflows/upload-schema-artifact.yml index 69550bb..a0f801c 100644 --- a/.github/workflows/upload-schema-artifact.yml +++ b/.github/workflows/upload-schema-artifact.yml @@ -51,7 +51,6 @@ jobs: cd /tmp/wordpress/ # Output: /tmp/schema.graphql wp graphql generate-static-schema - echo "$( Date: Mon, 19 Jul 2021 14:38:00 -0600 Subject: [PATCH 06/12] - Update workflow to run on releases - remove env sorting --- .github/workflows/upload-schema-artifact.yml | 28 ++++++-------------- bin/install-test-env.sh | 4 --- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/.github/workflows/upload-schema-artifact.yml b/.github/workflows/upload-schema-artifact.yml index a0f801c..4f21d62 100644 --- a/.github/workflows/upload-schema-artifact.yml +++ b/.github/workflows/upload-schema-artifact.yml @@ -1,15 +1,8 @@ -name: Schema Artifact +name: Upload Schema Artifact on: - workflow_dispatch: - push: - branches: - - develop - - master - pull_request: - branches: - - develop - - master + release: + types: [ published ] jobs: run: @@ -51,14 +44,9 @@ jobs: cd /tmp/wordpress/ # Output: /tmp/schema.graphql wp graphql generate-static-schema - - name: Upload Schema Artifact - uses: actions/upload-artifact@v2 + - name: Upload schema as release artifact + uses: softprops/action-gh-release@v1 with: - name: dist-without-markdown - path: /tmp/schema.graphql -# - name: Upload schema as release artifact -# uses: softprops/action-gh-release@v1 -# with: -# files: /tmp/schema.graphql -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + files: /tmp/schema.graphql + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/bin/install-test-env.sh b/bin/install-test-env.sh index b50f674..009a1c0 100644 --- a/bin/install-test-env.sh +++ b/bin/install-test-env.sh @@ -9,8 +9,6 @@ fi source .env -env | sort - print_usage_instruction() { echo "Ensure that .env file exist in project root directory exists." echo "And run the following 'composer build-test' in the project root directory" @@ -141,8 +139,6 @@ install_db() { fi fi - env | sort - # create database RESULT=`mysql -u $DB_USER --password="$DB_PASS" --skip-column-names -e "SHOW DATABASES LIKE '$DB_NAME'"$EXTRA` if [ "$RESULT" != $DB_NAME ]; then From f9e9a97b6ec8588c838998e8a33ea458b8be8b75 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Mon, 19 Jul 2021 14:50:36 -0600 Subject: [PATCH 07/12] - copy env.dist if .env doesn't exist --- bin/run-docker.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/run-docker.sh b/bin/run-docker.sh index d21e8d1..6c0a8f6 100644 --- a/bin/run-docker.sh +++ b/bin/run-docker.sh @@ -21,7 +21,17 @@ if [ -z "$1" ]; then print_usage_instructions fi -BUILD_NO_CACHE= +TAG=${TAG-latest} +WP_VERSION=${WP_VERSION-5.6} +PHP_VERSION=${PHP_VERSION-7.4} + +BUILD_NO_CACHE=${BUILD_NO_CACHE-} + +if [[ ! -f ".env" ]]; then + echo "No .env file was detected. .env.dist has been copied to .env" + echo "Open the .env file and enter values to match your local environment" + cp .env.dist .env +fi subcommand=$1; shift case "$subcommand" in From 0a2403c62fd7edc768adf5bccc192761b893e902 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Mon, 19 Jul 2021 14:56:16 -0600 Subject: [PATCH 08/12] - update docker image name --- docker/testing.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/testing.Dockerfile b/docker/testing.Dockerfile index 891c22f..c4e80e5 100644 --- a/docker/testing.Dockerfile +++ b/docker/testing.Dockerfile @@ -5,7 +5,7 @@ ARG WP_VERSION ARG PHP_VERSION -FROM wp-graphql:latest-wp${WP_VERSION}-php${PHP_VERSION} +FROM wpgraphql-acf-app:latest LABEL author=jasonbahl LABEL author_uri=https://github.com/jasonbahl From 7d2a3f405e5d2a55257fedfec634a269ffc90854 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Mon, 19 Jul 2021 15:01:54 -0600 Subject: [PATCH 09/12] - update docker image name --- docker/app.post-setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/app.post-setup.sh b/docker/app.post-setup.sh index f577bd8..c4ddcba 100644 --- a/docker/app.post-setup.sh +++ b/docker/app.post-setup.sh @@ -1,7 +1,8 @@ #!/bin/bash # Activate wp-graphql -wp plugin activate wp-graphql --allow-root +wp plugin install wp-graphql --allow-root --activate +wp plugin activate wp-graphql-acf --allow-root # Set pretty permalinks. wp rewrite structure '/%year%/%monthnum%/%postname%/' --allow-root From a8fbf738755fe99381edacb8fae913aeea45e5a6 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Mon, 19 Jul 2021 15:08:23 -0600 Subject: [PATCH 10/12] - update docker image name --- docker/app.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/app.Dockerfile b/docker/app.Dockerfile index 3d03c66..0cde63c 100644 --- a/docker/app.Dockerfile +++ b/docker/app.Dockerfile @@ -47,7 +47,7 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli # Set project environmental variables ENV WP_ROOT_FOLDER="/var/www/html" ENV PLUGINS_DIR="${WP_ROOT_FOLDER}/wp-content/plugins" -ENV PROJECT_DIR="${PLUGINS_DIR}/wp-graphql" +ENV PROJECT_DIR="${PLUGINS_DIR}/wp-graphql-acf" ENV DATA_DUMP_DIR="${PROJECT_DIR}/tests/_data" # Remove exec statement from base entrypoint script. From faafaaf8dd173ad9e4fe0bb09e9db77e9e93131b Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Mon, 19 Jul 2021 15:14:34 -0600 Subject: [PATCH 11/12] - install acf in docker --- docker/app.post-setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/app.post-setup.sh b/docker/app.post-setup.sh index c4ddcba..7645f05 100644 --- a/docker/app.post-setup.sh +++ b/docker/app.post-setup.sh @@ -1,6 +1,7 @@ #!/bin/bash # Activate wp-graphql +wp plugin install https://github.com/wp-premium/advanced-custom-fields-pro/archive/refs/heads/master.zip --activate -allow-root wp plugin install wp-graphql --allow-root --activate wp plugin activate wp-graphql-acf --allow-root From 58d25e324a8458b9c14fe8c2f13199d20babe232 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Mon, 19 Jul 2021 15:19:47 -0600 Subject: [PATCH 12/12] - install acf in docker --- docker/app.post-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/app.post-setup.sh b/docker/app.post-setup.sh index 7645f05..329a26a 100644 --- a/docker/app.post-setup.sh +++ b/docker/app.post-setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # Activate wp-graphql -wp plugin install https://github.com/wp-premium/advanced-custom-fields-pro/archive/refs/heads/master.zip --activate -allow-root +wp plugin install https://github.com/wp-premium/advanced-custom-fields-pro/archive/refs/heads/master.zip --activate --allow-root wp plugin install wp-graphql --allow-root --activate wp plugin activate wp-graphql-acf --allow-root