deep-web-solutions/wordpress-framework-core:.travis.yml@330f4a6
sudo: false
language: php
notifications:
email: false
php:
- '7.4'
services:
- mysql
matrix:
fast_finish: true
env:
global:
# the WordPress configuration must match the env variables in codeception.dist.yml
- WP_ROOT_FOLDER="/tmp/wordpress"
- WP_ADMIN_PATH="/wp-admin"
- WP_URL="http://127.0.0.1:8888"
- WP_DOMAIN="127.0.0.1:8888"
- ACCEPTANCE_TABLE_PREFIX="wp_"
- ACCEPTANCE_DB_NAME="test_acceptance"
- ACCEPTANCE_DB_HOST="127.0.0.1"
- ACCEPTANCE_DB_USER="root"
- ACCEPTANCE_DB_PASSWORD="" # intentionally blank
- INTEGRATION_DB_NAME="test_integration"
- INTEGRATION_DB_HOST="127.0.0.1"
- INTEGRATION_DB_USER="root"
- INTEGRATION_DB_PASSWORD="" # intentionally blank
- INTEGRATION_TABLE_PREFIX="wp_"
- ADMIN_EMAIL="admin@localhost.test"
- ADMIN_USERNAME="admin"
- ADMIN_PASSWORD="password"
- SNIFF=1
matrix:
- WP_VERSION=latest
cache:
apt: false
directories:
- "$HOME/.npm" # Keep the npm cache around to speed up installs.
before_install:
# Create the databases that will be used in the tests.
- mysql -e "CREATE DATABASE IF NOT EXISTS $ACCEPTANCE_DB_NAME;" -uroot
- mysql -e "CREATE DATABASE IF NOT EXISTS $INTEGRATION_DB_NAME;" -uroot
# Set up folders.
- mkdir -p $WP_ROOT_FOLDER
- mkdir tools
# Install wp-cli.
- wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -P $(pwd)/tools/
- chmod +x tools/wp-cli.phar && mv tools/wp-cli.phar tools/wp
# Append the 'tools' folder to the PATH.
- export PATH=$PATH:$(pwd)/tools
# Prepend the 'vendor/bin' folder to the PATH.
- export PATH=vendor/bin:$PATH
install:
- composer self-update
- composer install --prefer-source --no-interaction
# Install and configure WordPress.
- cd $WP_ROOT_FOLDER
- wp core download --version=$WP_VERSION
- wp config create --dbname="$ACCEPTANCE_DB_NAME" --dbuser="$ACCEPTANCE_DB_USER" --dbpass="$ACCEPTANCE_DB_PASSWORD" --dbhost="$ACCEPTANCE_DB_HOST" --dbprefix="$ACCEPTANCE_TABLE_PREFIX"
- wp core install --url="$WP_URL" --title="Test" --admin_user="$ADMIN_USERNAME" --admin_password="$ADMIN_PASSWORD" --admin_email="$ADMIN_EMAIL" --skip-email
- wp rewrite structure '/%postname%/' --hard
- wp core update-db
# Copy the plugin to the plugins directory.
- cp -r $TRAVIS_BUILD_DIR/tests/_support/plugins/test-plugin $WP_ROOT_FOLDER/wp-content/plugins/
- cp -r $TRAVIS_BUILD_DIR $WP_ROOT_FOLDER/wp-content/plugins/test-plugin/vendor/deep-web-solutions/wp-framework-core
# Generate the db export.
- wp db export $TRAVIS_BUILD_DIR/tests/_data/dump.sql
# Make sure directory is writeable.
- cd $TRAVIS_BUILD_DIR
- chmod -R 777 $WP_ROOT_FOLDER
before_script:
- php -S "$WP_DOMAIN" -t "$WP_ROOT_FOLDER" >/dev/null 2>&1 &
- phantomjs --webdriver=4444 >/dev/null 2>&1 &
script:
# Search for PHP syntax errors.
- find -L $TRAVIS_BUILD_DIR -path $TRAVIS_BUILD_DIR/vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
# Run PHPCS.
- if [[ "$SNIFF" == "1" ]]; then vendor/bin/phpcs $TRAVIS_BUILD_DIR ; fi
# Run tests.
- codecept run unit
- codecept run integration
- codecept run functional
- codecept run acceptance
Build Config
{
"env": {
"global": [
"KERL_BUILD_BACKEND=git",
"VERSION=20.1.5"
]
},
"addons": {
"artifacts": {
"paths": [
"${OS_NAME}"
],
"target_paths": [
"/binaries/${OS_NAME}/${LSB_RELEASE}/${ARCH}"
]
}
},
"matrix": {
"include": [
{
"env": [
"DIST=xenial"
],
"dist": "xenial",
"sudo": "required",
"group": "edge",
"language": "minimal"
},
{
"env": [
"DIST=trusty"
],
"dist": "trusty",
"sudo": "required",
"group": "edge"
},
{
"env": [
"DIST=precise"
],
"sudo": "required"
}
]
},
"script": "./bin/compile",
"install": [
"curl -o \"${HOME}/bin/kerl\" https://raw.githubusercontent.com/yrashk/kerl/master/kerl",
"chmod +x \"${HOME}/bin/kerl\""
],
"language": "erlang",
"after_success": "./bin/archive",
"before_install": [
"export OS_NAME=$(lsb_release -is | tr \"A-Z\" \"a-z\" || echo \"osx\")",
"export RELEASE=$(lsb_release -rs 2>/dev/null || sw_vers -productVersion | sed 's/^\\([0-9][0-9]*.[0-9][0-9]*\\).*/\\1/')",
"export TARGET_DIR=${TRAVIS_BUILD_DIR}/${OS_NAME}/${RELEASE}/$(uname -m)",
"mkdir -p ${TARGET_DIR}"
]
}