Remove the process of building legacy e2e test site
This commit is contained in:
parent
eb92d35d96
commit
d4c8719d1f
|
@ -148,93 +148,6 @@ install_db() {
|
|||
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
|
||||
}
|
||||
|
||||
install_e2e_site() {
|
||||
|
||||
if [[ ${RUN_E2E} == 1 ]]; then
|
||||
|
||||
# Script Variables
|
||||
CONFIG_DIR="./tests/e2e-tests/config/travis"
|
||||
WP_CORE_DIR="$HOME/wordpress"
|
||||
WC_PLUGIN_DIR="$WP_CORE_DIR/wp-content/plugins/woocommerce"
|
||||
NGINX_DIR="$HOME/nginx"
|
||||
PHP_FPM_BIN="$HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/sbin/php-fpm"
|
||||
PHP_FPM_CONF="$NGINX_DIR/php-fpm.conf"
|
||||
WP_SITE_URL="http://localhost:8080"
|
||||
BRANCH=$TRAVIS_BRANCH
|
||||
REPO=$TRAVIS_REPO_SLUG
|
||||
WP_DB_DATA="$HOME/build/$REPO/tests/e2e-tests/data/e2e-db.sql"
|
||||
WORKING_DIR="$PWD"
|
||||
|
||||
if [ "$TRAVIS_PULL_REQUEST_BRANCH" != "" ]; then
|
||||
BRANCH=$TRAVIS_PULL_REQUEST_BRANCH
|
||||
REPO=$TRAVIS_PULL_REQUEST_SLUG
|
||||
fi
|
||||
|
||||
set -ev
|
||||
npm install
|
||||
export NODE_CONFIG_DIR="./tests/e2e-tests/config"
|
||||
|
||||
# Set up nginx to run the server
|
||||
mkdir -p "$WP_CORE_DIR"
|
||||
mkdir -p "$NGINX_DIR"
|
||||
mkdir -p "$NGINX_DIR/sites-enabled"
|
||||
mkdir -p "$NGINX_DIR/var"
|
||||
|
||||
cp "$CONFIG_DIR/travis_php-fpm.conf" "$PHP_FPM_CONF"
|
||||
|
||||
# Start php-fpm
|
||||
"$PHP_FPM_BIN" --fpm-config "$PHP_FPM_CONF"
|
||||
|
||||
# Copy the default nginx config files.
|
||||
cp "$CONFIG_DIR/travis_nginx.conf" "$NGINX_DIR/nginx.conf"
|
||||
cp "$CONFIG_DIR/travis_fastcgi.conf" "$NGINX_DIR/fastcgi.conf"
|
||||
cp "$CONFIG_DIR/travis_default-site.conf" "$NGINX_DIR/sites-enabled/default-site.conf"
|
||||
|
||||
# Start nginx.
|
||||
nginx -c "$NGINX_DIR/nginx.conf"
|
||||
|
||||
# Set up WordPress using wp-cli
|
||||
cd "$WP_CORE_DIR"
|
||||
|
||||
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
||||
php wp-cli.phar core download --version=$WP_VERSION
|
||||
php wp-cli.phar core config --dbname=$DB_NAME --dbuser=$DB_USER --dbpass=$DB_PASS --dbhost=$DB_HOST --dbprefix=wp_ --extra-php <<PHP
|
||||
/* Change WP_MEMORY_LIMIT to increase the memory limit for public pages. */
|
||||
define('WP_MEMORY_LIMIT', '256M');
|
||||
define('SCRIPT_DEBUG', true);
|
||||
PHP
|
||||
php wp-cli.phar core install --url="$WP_SITE_URL" --title="Example" --admin_user=admin --admin_password=password --admin_email=info@example.com --path=$WP_CORE_DIR --skip-email
|
||||
php wp-cli.phar db import $WP_DB_DATA
|
||||
php wp-cli.phar search-replace "http://local.wordpress.test" "$WP_SITE_URL"
|
||||
php wp-cli.phar theme install twentytwelve --activate
|
||||
|
||||
# Instead of installing WC from a GH zip, rather used the checked out branch?
|
||||
# php wp-cli.phar plugin install https://github.com/$REPO/archive/$BRANCH.zip --activate
|
||||
echo "CREATING WooCommerce PLUGIN DIR AT $WC_PLUGIN_DIR"
|
||||
mkdir $WC_PLUGIN_DIR
|
||||
echo "COPYING CHECKED OUT BRANCH TO $WC_PLUGIN_DIR"
|
||||
cp -R "$TRAVIS_BUILD_DIR" "$WP_CORE_DIR/wp-content/plugins/"
|
||||
ls "$WP_CORE_DIR/wp-content/plugins/woocommerce/"
|
||||
|
||||
# Compile assets and installing dependencies
|
||||
echo "COMPILING ASSETS IN $WC_PLUGIN_DIR"
|
||||
cd $WC_PLUGIN_DIR
|
||||
npm install
|
||||
composer install
|
||||
npm run build
|
||||
|
||||
echo "ACTIVATING WooCommerce PLUGIN"
|
||||
php wp-cli.phar plugin activate woocommerce
|
||||
echo "RUNNING WooCommerce UPDATE ROUTINE"
|
||||
php wp-cli.phar wc update
|
||||
|
||||
echo "DONE INSTALLING E2E SUITE."
|
||||
cd "$WORKING_DIR"
|
||||
echo "WORKING DIR: $WORKING_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
install_wp
|
||||
install_test_suite
|
||||
install_db
|
||||
install_e2e_site
|
||||
|
|
Loading…
Reference in New Issue