From e88ef9ce571f0425393a3d3bc98f19a8e54f7f23 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Mon, 19 Jul 2021 10:37:51 -0600 Subject: [PATCH] - update install-test-env.sh - add .env.dist --- .env.dist | 31 ++++++++++++++++++++ .github/workflows/upload-schema-artifact.yml | 2 +- bin/install-test-env.sh | 20 +++++-------- 3 files changed, 40 insertions(+), 13 deletions(-) create mode 100644 .env.dist diff --git a/.env.dist b/.env.dist new file mode 100644 index 0000000..ec17662 --- /dev/null +++ b/.env.dist @@ -0,0 +1,31 @@ +DB_NAME=wordpress +DB_HOST=app_db +DB_USER=wordpress +DB_PASSWORD=wordpress +WP_TABLE_PREFIX=wp_ +WP_URL=http://localhost +WP_DOMAIN=localhost +ADMIN_EMAIL=admin@example.com +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=wordpress +TEST_DB_PASSWORD=wordpress +TEST_WP_TABLE_PREFIX=wp_ + +SKIP_DB_CREATE=false +TEST_WP_ROOT_FOLDER=/tmp/wordpress +TEST_ADMIN_EMAIL=admin@wp.test + +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 diff --git a/.github/workflows/upload-schema-artifact.yml b/.github/workflows/upload-schema-artifact.yml index 0ce08ba..be2a814 100644 --- a/.github/workflows/upload-schema-artifact.yml +++ b/.github/workflows/upload-schema-artifact.yml @@ -1,4 +1,4 @@ -name: Schema Linter +name: Schema Artifact on: workflow_dispatch: diff --git a/bin/install-test-env.sh b/bin/install-test-env.sh index 66890d1..3eda692 100644 --- a/bin/install-test-env.sh +++ b/bin/install-test-env.sh @@ -1,10 +1,16 @@ #!/usr/bin/env bash +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 + source .env print_usage_instruction() { echo "Ensure that .env file exist in project root directory exists." - echo "And run the following 'composer install-wp-tests' in the project root directory" + echo "And run the following 'composer build-test' in the project root directory" exit 1 } @@ -142,19 +148,10 @@ install_db() { configure_wordpress() { cd $WP_CORE_DIR wp config create --dbname="$DB_NAME" --dbuser="$DB_USER" --dbpass="$DB_PASS" --dbhost="$DB_HOST" --skip-check --force=true - wp core install --url=wp.test --title="WPGraphQL ACF Tests" --admin_user=admin --admin_password=password --admin_email=admin@wp.test + wp core install --url=wp.test --title="WPGraphQL Tests" --admin_user=admin --admin_password=password --admin_email=admin@wp.test wp rewrite structure '/%year%/%monthnum%/%postname%/' } -install_acf_pro() { - if [ ! -d $WP_CORE_DIR/wp-content/plugins/advanced-custom-fields-pro ]; then - echo "Cloning ACF PRO" - git clone https://github.com/wp-premium/advanced-custom-fields-pro.git $WP_CORE_DIR/wp-content/plugins/advanced-custom-fields-pro - fi - echo "Cloning ACF PRO" - wp plugin activate advanced-custom-fields-pro -} - setup_plugin() { # Add this repo as a plugin to the repo if [ ! -d $WP_CORE_DIR/wp-content/plugins/wp-graphql-acf ]; then @@ -190,5 +187,4 @@ setup_plugin() { install_wp install_db configure_wordpress -install_acf_pro setup_plugin