Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into features/wp-grap…
Browse files Browse the repository at this point in the history
…hql#156-optionsMutations
  • Loading branch information
hughdevore committed Nov 15, 2017
2 parents a6e0227 + 865614e commit 191f37c
Show file tree
Hide file tree
Showing 215 changed files with 88,787 additions and 34 deletions.
102 changes: 81 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,51 +12,111 @@ branches:
- master
- develop

cache:
apt: true
directories:
- vendor
- $HOME/.composer/cache

# Set the global environment variables
env:
global:
- WP_CORE_DIR: /tmp/wordpress
- WP_VERSION: latest
- COVERAGE: false

# Set the various variables for the environments to test
matrix:
include:
- php: 5.5
env: WP_VERSION=latest WP_MULTISITE=0 PHP_UNIT_VERSION=4.8
env: WP_MULTISITE=0 PHP_UNIT_VERSION=4.8
- php: 5.6
env: WP_VERSION=latest WP_MULTISITE=0 PHP_UNIT_VERSION=4.8
env: WP_MULTISITE=0 PHP_UNIT_VERSION=4.8
- php: 7.0
env: WP_VERSION=latest WP_MULTISITE=0 PHP_UNIT_VERSION=5.7
env: WP_MULTISITE=0 PHP_UNIT_VERSION=5.7
- php: 7.1
env: WP_VERSION=latest WP_MULTISITE=0 PHP_UNIT_VERSION=6.3
env: WP_MULTISITE=0 PHP_UNIT_VERSION=6.3 COVERAGE=true APIGEN_DOCS=true LINT_SCHEMA=true
- php: 5.5
env: WP_VERSION=latest WP_MULTISITE=1 PHP_UNIT_VERSION=4.8
env: WP_MULTISITE=1 PHP_UNIT_VERSION=4.8
- php: 5.6
env: WP_VERSION=latest WP_MULTISITE=1 PHP_UNIT_VERSION=4.8
env: WP_MULTISITE=1 PHP_UNIT_VERSION=4.8
- php: 7.0
env: WP_VERSION=latest WP_MULTISITE=1 PHP_UNIT_VERSION=5.7
env: WP_MULTISITE=1 PHP_UNIT_VERSION=5.7
- php: 7.1
env: WP_VERSION=latest WP_MULTISITE=1 PHP_UNIT_VERSION=6.3
env: WP_MULTISITE=1 PHP_UNIT_VERSION=6.3
fast_finish: true

# Composer package installation
install:
- cd $TRAVIS_BUILD_DIR
# Install composer packages, will also trigger dump-autoload
- composer install
# Install coveralls.phar
- wget -c -nc --retry-connrefused --tries=0 https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
- chmod +x coveralls.phar
- php coveralls.phar --version
# Install WP CLI
- curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
- chmod +x wp-cli.phar
- sudo mv wp-cli.phar /usr/local/bin/wp

before_script:
# Install WordPress and the Test Suite
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
# Update composer
- composer self-update
- composer require phpunit/phpunit:$PHP_UNIT_VERSION
# Install APIGen and PHPUnit, using the specified version for the PHP version we're running
- composer require apigen/apigen:^4.1 phpunit/phpunit:$PHP_UNIT_VERSION
- composer install --no-interaction
# Make a directory for storing logs
- mkdir -p build/logs
- ls -al

script:
- vendor/bin/phpunit --group ajax
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml
# Execute unit tests with coverage if specified, otherwise without coverage
- |
if [ $COVERAGE == true ]; then
vendor/bin/phpunit --group ajax
vendor/bin/phpunit --coverage-clover build/logs/clover.xml
else
vendor/bin/phpunit --group ajax --no-coverage
vendor/bin/phpunit --no-coverage
fi
after_success:
- travis_retry php coveralls.phar -v
# Install coveralls.phar
# Upload coverage to coveralls
- |
if [ $COVERAGE == true ]; then
wget -c -nc --retry-connrefused --tries=0 https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
chmod +x coveralls.phar
php coveralls.phar --version
travis_retry php coveralls.phar -v
fi
# Install GraphQL Schema Linter
# Move to the WordPress Install
# Generate the Static Schema
# Lint the Schema
- |
if [ $LINT_SCHEMA == true ]; then
npm install -g graphql-schema-linter
cd $WP_CORE_DIR
wp graphql generate-static-schema
cd $WP_CORE_DIR/wp-content/plugins/wp-graphql
graphql-schema-linter ./schema.graphql
fi
# Generate the APIGen Docs
- |
if [ $APIGEN_DOCS == true ]; then
cd $TRAVIS_BUILD_DIR
vendor/bin/apigen generate --source="src" --destination $TRAVIS_BUILD_DIR/apigen --template-theme bootstrap
fi
cache:
directories:
- vendor
- $HOME/.composer/cache
deploy:
# Deploy the Generated API docs to the wp-graphql-api-docs repo
- provider: pages
# This is set in the Travis CI dashboard
github_token: $APIGEN_GITHUB_TOKEN
local_dir: $TRAVIS_BUILD_DIR/apigen
repo: wp-graphql/wp-graphql-api-docs
target_branch: master
# Make sure this is true to ensure the files that were built in the previous step are not cleaned up before deploy
skip_cleanup: true
on:
# Probably switch this to master?
all_branches: develop
30 changes: 30 additions & 0 deletions bin/install-wp-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DB_HOST=${4-localhost}
WP_VERSION=${5-latest}
SKIP_DB_CREATE=${6-false}

PLUGIN_DIR=$(pwd)
WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}

Expand Down Expand Up @@ -120,8 +121,37 @@ install_db() {

# create database
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
mysqladmin create wpgraphql --user="$DB_USER" --password="$DB_PASS"$EXTRA
}

configure_wordpress() {

cd $WP_CORE_DIR
wp config create --dbname=wpgraphql --dbuser=root --dbpass="$DB_PASS" --dbhost="$DB_HOST" --skip-check --force=true
wp core install --url=wpgraphql.test --title="WPGraphQL Tests" --admin_user=admin --admin_password=password --admin_email=admin@wpgraphql.test
wp rewrite structure '/%year%/%monthnum%/%postname%/'

}

activate_plugin() {

# Add this repo as a plugin to the repo
ln -s $PLUGIN_DIR $WP_CORE_DIR/wp-content/plugins/wp-graphql

cd $WP_CORE_DIR

# activate the plugin
wp plugin activate wp-graphql

# List active plugins
wp plugin list

# Flush the permalinks
wp rewrite flush
}

install_wp
install_test_suite
install_db
configure_wordpress
activate_plugin
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "GraphQL API for WordPress",
"type": "wordpress-plugin",
"license": "GPLv3",
"version": "0.0.21",
"version": "0.0.22",
"authors": [
{
"name": "Jason Bahl",
Expand Down Expand Up @@ -38,4 +38,4 @@
"src/"
]
}
}
}
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 191f37c

Please sign in to comment.