Permalink
Browse files

Run official theme tests as part of Travis builds (#219)

* Run official theme tests as part of Travis builds

* Do not run theme check on PHP 5.2

* Fix syntax error

* Add flags and ref Travis PHP version env var

* Copy theme to WP and activate

* Tweaks

* Rsync from .distignore file

* Run theme-check from bash script

* Tweak

* Install test suite

* Define DB creds

* Back to file, ping to PHP 5.6

* Fix substring length

* Create wp-config

* Change working dir

* Install core DB tables

* Reduce diff

* Skip email flag

* Generic wp install info

* Remove build process from Grunt

* Only run theme check just before deploy

* Add line to print wp-cli info

* Move env var

* Remove cli info

* Tweak curl line

* Message not needed

* Only test WP trunk on 7.1

* Move test back to scripts

* Test beta stages

* Syntax problem

* Another fix

* Playing with stages

* Tweak envs for stages

* Add regular tests as stage

* try a diff setup

* Remove matrix

* Put deploy at top level

* Skip after_script on theme check stage

* Test zip file integrity on deploy step

* Rename file, tweak config

* Add wp-cli cache dirs to travis config

* Update grunt packages: imagemin, uglify

* remove php52 from travis

* update packages
  • Loading branch information...
fjarrett committed Nov 17, 2017
1 parent 3681c0e commit 770cf6cc334d568273d79ea8eff93b695d3c8435
@@ -0,0 +1,30 @@
#!/bin/bash
set -e
export WP_CORE_DIR=/tmp/wordpress
mkdir -p $WP_CORE_DIR
cd $WP_CORE_DIR
php /tmp/wp.phar core download --version=$WP_VERSION
php /tmp/wp.phar config create \
--dbname=wordpress \
--dbuser=root \
--dbpass="" \
--skip-check
php /tmp/wp.phar db create
php /tmp/wp.phar core install \
--url=http://test.dev \
--title="WordPress Site" \
--admin_user=admin \
--admin_password=password \
--admin_email=admin@tests.dev \
--skip-email
php /tmp/wp.phar package install anhskohbo/wp-cli-themecheck
php /tmp/wp.phar plugin install theme-check --activate
export INSTALL_PATH=$WP_CORE_DIR/wp-content/themes/$WP_THEME
mkdir -p $INSTALL_PATH
rsync -av --exclude-from $TRAVIS_BUILD_DIR/.distignore --delete $TRAVIS_BUILD_DIR/ $INSTALL_PATH/
View
@@ -8,7 +8,6 @@ phpunit.xml.dist
readme.md
svn-username
bin/
build/
dev-lib/
languages/*.po
node_modules/
View
@@ -1,11 +1,9 @@
.dev/docs/build/
.dev/docs/sphinx/src/build/
.dev/docs/**/build/
.dev/docs/sphinx/src/documentation/
.DS_Store
.sass-cache/
.sublime-grunt.cache
bower_components/
build/
node_modules/
svn-url
svn-username
View
@@ -1,63 +1,89 @@
sudo: false
language: php
notifications:
email:
on_success: never
on_failure: change
cache:
directories:
- node_modules
- vendor
- $HOME/.composer/cache
- $HOME/.wp-cli/cache
- $HOME/.wp-cli/packages/cache
language:
- php
- node_js
php:
- 5.6
- 7.1
branches:
only:
- /^v\d.*$/
- master
- develop
php:
- 5.6
- 7.1
env:
- WP_VERSION=4.4 WP_MULTISITE=0
- WP_VERSION=latest WP_MULTISITE=0
- WP_VERSION=trunk WP_MULTISITE=0
global:
- WP_THEME=primer
matrix:
- WP_VERSION=4.4
- WP_VERSION=latest
- WP_VERSION=trunk
matrix:
fast_finish: true
exclude:
- php: 7.1
env: WP_VERSION=4.4 WP_MULTISITE=0
before_install:
- phpenv config-rm xdebug.ini
install:
- nvm install 6 && nvm use 6
- export DEV_LIB_PATH=.dev/dev-lib
- if [ ! -e "$DEV_LIB_PATH" ] && [ -L .travis.yml ]; then export DEV_LIB_PATH=$( dirname $( readlink .travis.yml ) ); fi
- if [ ! -e "$DEV_LIB_PATH" ]; then git clone https://github.com/xwp/wp-dev-lib.git $DEV_LIB_PATH; fi
- source $DEV_LIB_PATH/travis.install.sh
- curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar > /tmp/wp-cli.phar
- chmod +x /tmp/wp-cli.phar
script:
- source $DEV_LIB_PATH/travis.script.sh
after_script:
- source $DEV_LIB_PATH/travis.after_script.sh
jobs:
fast_finish: true
exclude:
- php: 5.6
env: WP_VERSION=trunk
- php: 7.1
env: WP_VERSION=4.4
include:
- stage: theme check
php: 7.1
env: WP_VERSION=latest
install:
- export THEME_CHECK=1
- curl -o /tmp/wp.phar -SL https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar
- chmod +x /tmp/wp.phar
- source .dev/travis.install-themecheck.sh
script:
- php /tmp/wp.phar themecheck --theme=$WP_THEME --no-interactive
after_script: true # skip by returning true
before_deploy:
- export RELEASE_FOLDER=primer
- php /tmp/wp-cli.phar package install wp-cli/dist-archive-command
- cp -r ${TRAVIS_BUILD_DIR} /tmp/${RELEASE_FOLDER}
- mv /tmp/${RELEASE_FOLDER} ${TRAVIS_BUILD_DIR}
- php /tmp/wp-cli.phar dist-archive ${RELEASE_FOLDER} ${TRAVIS_BUILD_DIR}/${RELEASE_FOLDER}.zip --format=zip --debug
- mkdir -p /tmp/$WP_THEME
- rsync -av --exclude-from $TRAVIS_BUILD_DIR/.distignore --delete $TRAVIS_BUILD_DIR/ /tmp/$WP_THEME/
- zip -rT $TRAVIS_BUILD_DIR/$WP_THEME.zip /tmp/$WP_THEME
deploy:
provider: releases
api_key:
secure: nZeGCRawe6Vh/D6Cll8Egu1oRCpB14x4w1G35yfYrjWqL7Hak+C5+Se4TziTX2RudQX0JV7jlaydqKSrNaChlLkIrAd2DUt8SRgZrWuh18VXFVcOM6gWEvDBdiHOdN7TMlkFM6a3VM3aiMpZqsNbYF4GrMYeZ6coJMdV6Sy6eLpux8hPNbK17fKmdBW+oZor54/arLV9gdPmfPGq/lcdC2/hk9BMOlwZ0dpqH7kS27PDF4gmIVUCgIq+zg4SLqWGMsaZaDzygjBPjL6CKz9ZT+MswplWtz6QTIPfvJVm4tLip9wa9HMv65COo7L1j/1fXwakC4VCGIpGy1m/cDqnL37gAF1wQZXXGrV9JPG7PpOGyNahQZwPoYY8OUJCB+k9AmEwg6s9oBRWFBcY9PQW9sMH5UEGIXerqWfETy7qxGUqKElxogEnYKB/m/YzFhfw72Ew9Ra+AdMjgZOE+KoPo57AYQgbOw1WtPxQDqbWFCuennw2eD+l8WVWGogKEB6f8q0QnzpP+3mjxoSV99nx0sv126YowCrK0r2o5HOztPXp7ArtC3fZWdlGnjx/XWHfwlv75YnI71gD413ffGUXtk4xsCbD3vNOChBlAVphQfJcTscfUDknJFaCB7w7V8pyPXKTuRirBxtSQjddFG21zAOELDZntBgPZ/0Ixu9VJmA=
file: primer.zip
file: $WP_THEME.zip
skip_cleanup: true
overwrite: true
on:
tags: true
repo: godaddy/wp-primer-theme
php: '7.1'
condition: "$WP_VERSION=trunk"
skip_cleanup: true
overwrite: true
condition: "$THEME_CHECK == 1"
View
@@ -35,26 +35,10 @@ module.exports = function( grunt ) {
options: {
force: true
},
build: [ 'build/' ],
docs: [ '.dev/docs/sphinx/src/documentation/' ]
},
copy: {
build: {
expand: true,
cwd: '.',
src: [
'*.css',
'*.php',
'*.txt',
'screenshot.png',
'assets/**',
'inc/**',
'languages/**/*.{mo,pot}',
'templates/**'
],
dest: 'build/'
},
docs_html: {
expand: true,
cwd: '.dev/docs/sphinx/src/documentation/',
@@ -160,7 +144,7 @@ module.exports = function( grunt ) {
options: {
domainPath: 'languages/',
include: [ '.+\.php' ],
exclude: [ '.dev/', 'build/', 'node_modules/', 'tests/', 'vendor/' ],
exclude: [ '.dev/', 'node_modules/', 'tests/', 'vendor/' ],
potComments: 'Copyright (c) {year} GoDaddy Operating Company, LLC. All Rights Reserved.',
potHeaders: {
'x-poedit-keywordslist': true
@@ -392,13 +376,12 @@ module.exports = function( grunt ) {
require( 'matchdep' ).filterDev( 'grunt-*' ).forEach( grunt.loadNpmTasks );
grunt.registerTask( 'default', [ 'sass', 'replace:charset', 'autoprefixer', 'cssjanus', 'cssmin', 'jshint', 'uglify', 'imagemin' ] );
grunt.registerTask( 'build', [ 'default', 'clean:build', 'copy:build' ] );
grunt.registerTask( 'check', [ 'devUpdate' ] );
grunt.registerTask( 'readme', [ 'wp_readme_to_markdown' ] );
grunt.registerTask( 'update-docs', [ 'readme', 'clean:docs', 'replace:docs_version', 'replace:docs', 'shell:sphinx', 'shell:docs', 'copy:readme', 'copy:docs_html', 'copy:docs_landing', 'replace:intro' ] );
grunt.registerTask( 'deploy-docs', [ 'update-docs', 'shell:deploy_docs' ] );
grunt.registerTask( 'update-pot', [ 'makepot' ] );
grunt.registerTask( 'update-mo', [ 'potomo' ] );
grunt.registerTask( 'version', [ 'replace', 'readme', 'build' ] );
grunt.registerTask( 'version', [ 'replace', 'readme' ] );
};

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 770cf6c

Please sign in to comment.