forked from mirror/_s
Merge pull request #888 from jrfnl/feature/slim-down-travis
Slim down the travis script - remove superfluous checks. Fixes #881.
This commit is contained in:
commit
6ae11474be
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"preset": "wordpress",
|
||||
"fileExtensions": [ ".js" ],
|
||||
"excludeFiles": [
|
||||
"js/**.min.js"
|
||||
]
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
js/**.min.js
|
108
.travis.yml
108
.travis.yml
|
@ -4,48 +4,35 @@
|
|||
# For use with the Underscores WordPress theme.
|
||||
# @link https://github.com/Automattic/_s
|
||||
|
||||
# Ditch sudo and use containers.
|
||||
# @link http://docs.travis-ci.com/user/migrating-from-legacy/#Why-migrate-to-container-based-infrastructure%3F
|
||||
# @link http://docs.travis-ci.com/user/workers/container-based-infrastructure/#Routing-your-build-to-container-based-infrastructure
|
||||
sudo: false
|
||||
|
||||
# Declare project language.
|
||||
# @link http://about.travis-ci.org/docs/user/languages/php/
|
||||
language: php
|
||||
|
||||
# Declare versions of PHP to use. Use one decimal max.
|
||||
php:
|
||||
# aliased to a recent 5.5.x version
|
||||
- "5.5"
|
||||
# aliased to a recent 5.4.x version
|
||||
- "5.4"
|
||||
# aliased to a recent 5.3.x version
|
||||
- "5.3"
|
||||
# Current $required_php_version for WordPress: 5.2.4
|
||||
- "5.2"
|
||||
|
||||
# Declare which versions of WordPress to test against.
|
||||
# Also declare whether or not to test in Multisite.
|
||||
env:
|
||||
# Trunk
|
||||
# @link https://github.com/WordPress/WordPress
|
||||
- WP_VERSION=master WP_MULTISITE=0
|
||||
- WP_VERSION=master WP_MULTISITE=1
|
||||
# WordPress 4.2
|
||||
# @link https://github.com/WordPress/WordPress/tree/4.2-branch
|
||||
- WP_VERSION=4.2 WP_MULTISITE=0
|
||||
- WP_VERSION=4.2 WP_MULTISITE=1
|
||||
# WordPress 4.1
|
||||
# @link https://github.com/WordPress/WordPress/tree/4.1-branch
|
||||
- WP_VERSION=4.1 WP_MULTISITE=0
|
||||
- WP_VERSION=4.1 WP_MULTISITE=1
|
||||
|
||||
# Declare 5.6 beta in test matrix.
|
||||
# @link https://buddypress.trac.wordpress.org/ticket/5620
|
||||
# @link http://docs.travis-ci.com/user/build-configuration/
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.6
|
||||
env: WP_VERSION=master
|
||||
allow_failures:
|
||||
- php: 5.6
|
||||
fast_finish: true
|
||||
|
||||
include:
|
||||
# Current $required_php_version for WordPress: 5.2.4
|
||||
# aliased to 5.2.17
|
||||
- php: '5.2'
|
||||
# aliased to a recent 5.6.x version
|
||||
- php: '5.6'
|
||||
env: SNIFF=1
|
||||
# aliased to a recent 7.x version
|
||||
- php: '7.0'
|
||||
# aliased to a recent hhvm version
|
||||
- php: 'hhvm'
|
||||
|
||||
allow_failures:
|
||||
- php: 'hhvm'
|
||||
|
||||
# Use this to prepare the system to install prerequisites or dependencies.
|
||||
# e.g. sudo apt-get update.
|
||||
# Failures in this section will result in build status 'errored'.
|
||||
|
@ -55,46 +42,39 @@ matrix:
|
|||
# e.g. copy database configurations, environment variables, etc.
|
||||
# Failures in this section will result in build status 'errored'.
|
||||
before_script:
|
||||
# Set up WordPress installation.
|
||||
- export WP_DEVELOP_DIR=/tmp/wordpress/
|
||||
- mkdir -p $WP_DEVELOP_DIR
|
||||
# Use the Git mirror of WordPress.
|
||||
- git clone --depth=1 --branch="$WP_VERSION" git://develop.git.wordpress.org/ $WP_DEVELOP_DIR
|
||||
# Set up theme information.
|
||||
- theme_slug=$(basename $(pwd))
|
||||
- theme_dir=$WP_DEVELOP_DIR/src/wp-content/themes/$theme_slug
|
||||
- cd ..
|
||||
- mv $theme_slug $theme_dir
|
||||
# Set up WordPress configuration.
|
||||
- cd $WP_DEVELOP_DIR
|
||||
- echo $WP_DEVELOP_DIR
|
||||
- cp wp-tests-config-sample.php wp-tests-config.php
|
||||
- sed -i "s/youremptytestdbnamehere/wordpress_test/" wp-tests-config.php
|
||||
- sed -i "s/yourusernamehere/root/" wp-tests-config.php
|
||||
- sed -i "s/yourpasswordhere//" wp-tests-config.php
|
||||
# Create WordPress database.
|
||||
- mysql -e 'CREATE DATABASE wordpress_test;' -uroot
|
||||
- export PHPCS_DIR=/tmp/phpcs
|
||||
- export SNIFFS_DIR=/tmp/sniffs
|
||||
# Install CodeSniffer for WordPress Coding Standards checks.
|
||||
- git clone https://github.com/squizlabs/PHP_CodeSniffer.git php-codesniffer
|
||||
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR; fi
|
||||
# Install WordPress Coding Standards.
|
||||
- git clone https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wordpress-coding-standards
|
||||
# Hop into CodeSniffer directory.
|
||||
- cd php-codesniffer
|
||||
# Set install path for WordPress Coding Standards.
|
||||
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $SNIFFS_DIR; fi
|
||||
# Install PHP Compatibility sniffs.
|
||||
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $SNIFFS_DIR/PHPCompatibility; fi
|
||||
# Set install path for PHPCS sniffs.
|
||||
# @link https://github.com/squizlabs/PHP_CodeSniffer/blob/4237c2fc98cc838730b76ee9cee316f99286a2a7/CodeSniffer.php#L1941
|
||||
- scripts/phpcs --config-set installed_paths ../wordpress-coding-standards
|
||||
# Hop into themes directory.
|
||||
- cd $theme_dir
|
||||
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs --config-set installed_paths $SNIFFS_DIR; fi
|
||||
# After CodeSniffer install you should refresh your path.
|
||||
- phpenv rehash
|
||||
- if [[ "$SNIFF" == "1" ]]; then phpenv rehash; fi
|
||||
# Install JSCS: JavaScript Code Style checker.
|
||||
# @link http://jscs.info/
|
||||
- if [[ "$SNIFF" == "1" ]]; then npm install -g jscs; fi
|
||||
# Install JSHint, a JavaScript Code Quality Tool.
|
||||
# @link http://jshint.com/docs/
|
||||
- if [[ "$SNIFF" == "1" ]]; then npm install -g jshint; fi
|
||||
# Pull in the WP Core jshint rules.
|
||||
- if [[ "$SNIFF" == "1" ]]; then wget https://develop.svn.wordpress.org/trunk/.jshintrc; fi
|
||||
|
||||
# Run test script commands.
|
||||
# Default is specific to project language.
|
||||
# All commands must exit with code 0 on success. Anything else is considered failure.
|
||||
script:
|
||||
# Search for PHP syntax errors.
|
||||
- find . \( -name '*.php' \) -exec php -lf {} \;
|
||||
# WordPress Coding Standards
|
||||
- find -L . -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
|
||||
# Run the theme through JSHint.
|
||||
- if [[ "$SNIFF" == "1" ]]; then jshint .; fi
|
||||
# Run the theme through JavaScript Code Style checker.
|
||||
- if [[ "$SNIFF" == "1" ]]; then jscs .; fi
|
||||
# WordPress Coding Standards.
|
||||
# @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
|
||||
# @link http://pear.php.net/package/PHP_CodeSniffer/
|
||||
# -p flag: Show progress of the run.
|
||||
|
@ -103,7 +83,7 @@ script:
|
|||
# -n flag: Do not print warnings. (shortcut for --warning-severity=0)
|
||||
# --standard: Use WordPress as the standard.
|
||||
# --extensions: Only sniff PHP files.
|
||||
- $WP_DEVELOP_DIR/php-codesniffer/scripts/phpcs -p -s -v -n . --standard=./codesniffer.ruleset.xml --extensions=php
|
||||
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs -p -s -v -n . --standard=./codesniffer.ruleset.xml --extensions=php; fi
|
||||
|
||||
# Receive notifications for build results.
|
||||
# @link http://docs.travis-ci.com/user/notifications/#Email-notifications
|
||||
|
|
|
@ -12,4 +12,7 @@
|
|||
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
|
||||
<exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
|
||||
</rule>
|
||||
|
||||
<!-- Include sniffs for PHP cross-version compatibility. -->
|
||||
<rule ref="PHPCompatibility"/>
|
||||
</ruleset>
|
|
@ -116,9 +116,9 @@ add_action( 'widgets_init', '_s_widgets_init' );
|
|||
function _s_scripts() {
|
||||
wp_enqueue_style( '_s-style', get_stylesheet_uri() );
|
||||
|
||||
wp_enqueue_script( '_s-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
|
||||
wp_enqueue_script( '_s-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
|
||||
|
||||
wp_enqueue_script( '_s-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
|
||||
wp_enqueue_script( '_s-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
|
||||
|
||||
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
||||
wp_enqueue_script( 'comment-reply' );
|
||||
|
|
|
@ -21,6 +21,6 @@ add_action( 'customize_register', '_s_customize_register' );
|
|||
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*/
|
||||
function _s_customize_preview_js() {
|
||||
wp_enqueue_script( '_s_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true );
|
||||
wp_enqueue_script( '_s_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true );
|
||||
}
|
||||
add_action( 'customize_preview_init', '_s_customize_preview_js' );
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* customizer.js
|
||||
* File customizer.js.
|
||||
*
|
||||
* Theme Customizer enhancements for a better user experience.
|
||||
*
|
||||
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
( function( $ ) {
|
||||
|
||||
// Site title and description.
|
||||
wp.customize( 'blogname', function( value ) {
|
||||
value.bind( function( to ) {
|
||||
|
@ -18,6 +19,7 @@
|
|||
$( '.site-description' ).text( to );
|
||||
} );
|
||||
} );
|
||||
|
||||
// Header text color.
|
||||
wp.customize( 'header_textcolor', function( value ) {
|
||||
value.bind( function( to ) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* navigation.js
|
||||
* File navigation.js.
|
||||
*
|
||||
* Handles toggling the navigation menu for small screens and enables tab
|
||||
* support for dropdown menus.
|
||||
*/
|
||||
( function() {
|
||||
var container, button, menu, links, subMenus;
|
||||
var container, button, menu, links, subMenus, i, len;
|
||||
|
||||
container = document.getElementById( 'site-navigation' );
|
||||
if ( ! container ) {
|
||||
|
@ -47,7 +47,7 @@
|
|||
subMenus = menu.getElementsByTagName( 'ul' );
|
||||
|
||||
// Set menu items with submenus to aria-haspopup="true".
|
||||
for ( var i = 0, len = subMenus.length; i < len; i++ ) {
|
||||
for ( i = 0, len = subMenus.length; i < len; i++ ) {
|
||||
subMenus[i].parentNode.setAttribute( 'aria-haspopup', 'true' );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/**
|
||||
* skip-link-focus-fix.js
|
||||
* File skip-link-focus-fix.js.
|
||||
*
|
||||
* Helps with accessibility for keyboard only users.
|
||||
*
|
||||
* Learn more: https://git.io/vWdr2
|
||||
*/
|
||||
( function() {
|
||||
var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
|
||||
is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
|
||||
is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1;
|
||||
var isWebkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
|
||||
isOpera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
|
||||
isIe = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1;
|
||||
|
||||
if ( ( is_webkit || is_opera || is_ie ) && document.getElementById && window.addEventListener ) {
|
||||
if ( ( isWebkit || isOpera || isIe ) && document.getElementById && window.addEventListener ) {
|
||||
window.addEventListener( 'hashchange', function() {
|
||||
var id = location.hash.substring( 1 ),
|
||||
element;
|
||||
|
|
Reference in New Issue