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
|
138
.travis.yml
138
.travis.yml
|
@ -4,47 +4,34 @@
|
||||||
# For use with the Underscores WordPress theme.
|
# For use with the Underscores WordPress theme.
|
||||||
# @link https://github.com/Automattic/_s
|
# @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.
|
# Declare project language.
|
||||||
# @link http://about.travis-ci.org/docs/user/languages/php/
|
# @link http://about.travis-ci.org/docs/user/languages/php/
|
||||||
language: php
|
language: php
|
||||||
|
|
||||||
# Declare versions of PHP to use. Use one decimal max.
|
# 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/
|
# @link http://docs.travis-ci.com/user/build-configuration/
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
fast_finish: true
|
||||||
- php: 5.6
|
|
||||||
env: WP_VERSION=master
|
include:
|
||||||
allow_failures:
|
# Current $required_php_version for WordPress: 5.2.4
|
||||||
- php: 5.6
|
# aliased to 5.2.17
|
||||||
fast_finish: true
|
- 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.
|
# Use this to prepare the system to install prerequisites or dependencies.
|
||||||
# e.g. sudo apt-get update.
|
# e.g. sudo apt-get update.
|
||||||
|
@ -55,57 +42,50 @@ matrix:
|
||||||
# e.g. copy database configurations, environment variables, etc.
|
# e.g. copy database configurations, environment variables, etc.
|
||||||
# Failures in this section will result in build status 'errored'.
|
# Failures in this section will result in build status 'errored'.
|
||||||
before_script:
|
before_script:
|
||||||
# Set up WordPress installation.
|
- export PHPCS_DIR=/tmp/phpcs
|
||||||
- export WP_DEVELOP_DIR=/tmp/wordpress/
|
- export SNIFFS_DIR=/tmp/sniffs
|
||||||
- mkdir -p $WP_DEVELOP_DIR
|
# Install CodeSniffer for WordPress Coding Standards checks.
|
||||||
# Use the Git mirror of WordPress.
|
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR; fi
|
||||||
- git clone --depth=1 --branch="$WP_VERSION" git://develop.git.wordpress.org/ $WP_DEVELOP_DIR
|
# Install WordPress Coding Standards.
|
||||||
# Set up theme information.
|
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $SNIFFS_DIR; fi
|
||||||
- theme_slug=$(basename $(pwd))
|
# Install PHP Compatibility sniffs.
|
||||||
- theme_dir=$WP_DEVELOP_DIR/src/wp-content/themes/$theme_slug
|
- if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $SNIFFS_DIR/PHPCompatibility; fi
|
||||||
- cd ..
|
# Set install path for PHPCS sniffs.
|
||||||
- mv $theme_slug $theme_dir
|
# @link https://github.com/squizlabs/PHP_CodeSniffer/blob/4237c2fc98cc838730b76ee9cee316f99286a2a7/CodeSniffer.php#L1941
|
||||||
# Set up WordPress configuration.
|
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs --config-set installed_paths $SNIFFS_DIR; fi
|
||||||
- cd $WP_DEVELOP_DIR
|
# After CodeSniffer install you should refresh your path.
|
||||||
- echo $WP_DEVELOP_DIR
|
- if [[ "$SNIFF" == "1" ]]; then phpenv rehash; fi
|
||||||
- cp wp-tests-config-sample.php wp-tests-config.php
|
# Install JSCS: JavaScript Code Style checker.
|
||||||
- sed -i "s/youremptytestdbnamehere/wordpress_test/" wp-tests-config.php
|
# @link http://jscs.info/
|
||||||
- sed -i "s/yourusernamehere/root/" wp-tests-config.php
|
- if [[ "$SNIFF" == "1" ]]; then npm install -g jscs; fi
|
||||||
- sed -i "s/yourpasswordhere//" wp-tests-config.php
|
# Install JSHint, a JavaScript Code Quality Tool.
|
||||||
# Create WordPress database.
|
# @link http://jshint.com/docs/
|
||||||
- mysql -e 'CREATE DATABASE wordpress_test;' -uroot
|
- if [[ "$SNIFF" == "1" ]]; then npm install -g jshint; fi
|
||||||
# Install CodeSniffer for WordPress Coding Standards checks.
|
# Pull in the WP Core jshint rules.
|
||||||
- git clone https://github.com/squizlabs/PHP_CodeSniffer.git php-codesniffer
|
- if [[ "$SNIFF" == "1" ]]; then wget https://develop.svn.wordpress.org/trunk/.jshintrc; 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.
|
|
||||||
# @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
|
|
||||||
# After CodeSniffer install you should refresh your path.
|
|
||||||
- phpenv rehash
|
|
||||||
|
|
||||||
# Run test script commands.
|
# Run test script commands.
|
||||||
# Default is specific to project language.
|
# Default is specific to project language.
|
||||||
# All commands must exit with code 0 on success. Anything else is considered failure.
|
# All commands must exit with code 0 on success. Anything else is considered failure.
|
||||||
script:
|
script:
|
||||||
# Search for PHP syntax errors.
|
# Search for PHP syntax errors.
|
||||||
- find . \( -name '*.php' \) -exec php -lf {} \;
|
- find -L . -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
|
||||||
# WordPress Coding Standards
|
# Run the theme through JSHint.
|
||||||
# @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
|
- if [[ "$SNIFF" == "1" ]]; then jshint .; fi
|
||||||
# @link http://pear.php.net/package/PHP_CodeSniffer/
|
# Run the theme through JavaScript Code Style checker.
|
||||||
# -p flag: Show progress of the run.
|
- if [[ "$SNIFF" == "1" ]]; then jscs .; fi
|
||||||
# -s flag: Show sniff codes in all reports.
|
# WordPress Coding Standards.
|
||||||
# -v flag: Print verbose output.
|
# @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
|
||||||
# -n flag: Do not print warnings. (shortcut for --warning-severity=0)
|
# @link http://pear.php.net/package/PHP_CodeSniffer/
|
||||||
# --standard: Use WordPress as the standard.
|
# -p flag: Show progress of the run.
|
||||||
# --extensions: Only sniff PHP files.
|
# -s flag: Show sniff codes in all reports.
|
||||||
- $WP_DEVELOP_DIR/php-codesniffer/scripts/phpcs -p -s -v -n . --standard=./codesniffer.ruleset.xml --extensions=php
|
# -v flag: Print verbose output.
|
||||||
|
# -n flag: Do not print warnings. (shortcut for --warning-severity=0)
|
||||||
|
# --standard: Use WordPress as the standard.
|
||||||
|
# --extensions: Only sniff PHP files.
|
||||||
|
- if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs -p -s -v -n . --standard=./codesniffer.ruleset.xml --extensions=php; fi
|
||||||
|
|
||||||
# Receive notifications for build results.
|
# Receive notifications for build results.
|
||||||
# @link http://docs.travis-ci.com/user/notifications/#Email-notifications
|
# @link http://docs.travis-ci.com/user/notifications/#Email-notifications
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
|
|
@ -12,4 +12,7 @@
|
||||||
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
|
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
|
||||||
<exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
|
<exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
|
||||||
</rule>
|
</rule>
|
||||||
</ruleset>
|
|
||||||
|
<!-- 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() {
|
function _s_scripts() {
|
||||||
wp_enqueue_style( '_s-style', get_stylesheet_uri() );
|
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' ) ) {
|
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
||||||
wp_enqueue_script( 'comment-reply' );
|
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.
|
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
|
||||||
*/
|
*/
|
||||||
function _s_customize_preview_js() {
|
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' );
|
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.
|
* Theme Customizer enhancements for a better user experience.
|
||||||
*
|
*
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
( function( $ ) {
|
( function( $ ) {
|
||||||
|
|
||||||
// Site title and description.
|
// Site title and description.
|
||||||
wp.customize( 'blogname', function( value ) {
|
wp.customize( 'blogname', function( value ) {
|
||||||
value.bind( function( to ) {
|
value.bind( function( to ) {
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
$( '.site-description' ).text( to );
|
$( '.site-description' ).text( to );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Header text color.
|
// Header text color.
|
||||||
wp.customize( 'header_textcolor', function( value ) {
|
wp.customize( 'header_textcolor', function( value ) {
|
||||||
value.bind( function( to ) {
|
value.bind( function( to ) {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/**
|
/**
|
||||||
* navigation.js
|
* File navigation.js.
|
||||||
*
|
*
|
||||||
* Handles toggling the navigation menu for small screens and enables tab
|
* Handles toggling the navigation menu for small screens and enables tab
|
||||||
* support for dropdown menus.
|
* support for dropdown menus.
|
||||||
*/
|
*/
|
||||||
( function() {
|
( function() {
|
||||||
var container, button, menu, links, subMenus;
|
var container, button, menu, links, subMenus, i, len;
|
||||||
|
|
||||||
container = document.getElementById( 'site-navigation' );
|
container = document.getElementById( 'site-navigation' );
|
||||||
if ( ! container ) {
|
if ( ! container ) {
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
subMenus = menu.getElementsByTagName( 'ul' );
|
subMenus = menu.getElementsByTagName( 'ul' );
|
||||||
|
|
||||||
// Set menu items with submenus to aria-haspopup="true".
|
// 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' );
|
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.
|
* Helps with accessibility for keyboard only users.
|
||||||
*
|
*
|
||||||
* Learn more: https://git.io/vWdr2
|
* Learn more: https://git.io/vWdr2
|
||||||
*/
|
*/
|
||||||
( function() {
|
( function() {
|
||||||
var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
|
var isWebkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
|
||||||
is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
|
isOpera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
|
||||||
is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -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() {
|
window.addEventListener( 'hashchange', function() {
|
||||||
var id = location.hash.substring( 1 ),
|
var id = location.hash.substring( 1 ),
|
||||||
element;
|
element;
|
||||||
|
|
Reference in New Issue