Skip to content

Instantly share code, notes, and snippets.

@atwellpub
Created September 30, 2014 18:13
Show Gist options
  • Save atwellpub/7016a1097c659f4208cf to your computer and use it in GitHub Desktop.
Save atwellpub/7016a1097c659f4208cf to your computer and use it in GitHub Desktop.
# Travis CI Configuration File
# Tell Travis CI we're using PHP
language: php
# PHP version used in first build configuration.
php:
- "5.5"
# WordPress version used in first build configuration.
env:
- WP_VERSION=master
# Next we define our matrix of additional build configurations to test against.
# The versions listed above will automatically create our first configuration,
# so it doesn't need to be re-defined below.
# WP_VERSION specifies the tag to use. The way these tests are configured to run
# requires at least WordPress 3.8. Specify "master" to test against SVN trunk.
# Note that Travis CI supports listing these above to automatically build a
# matrix of configurations, but we're being nice here by manually building a
# total of four configurations even though we're testing 4 versions of PHP
# along with 2 versions of WordPress (which would build 8 configs otherwise).
# This takes half as long to run while still providing adequate coverage.
matrix:
include:
- php: "5.3"
env: WP_VERSION=master
- php: "5.4"
env: WP_VERSION=3.8.1
# Clones WordPress and configures our testing environment.
before_script:
- export PLUGIN_SLUG=$(basename $(pwd))
- git clone --depth=50 --branch="$WP_VERSION" git://develop.git.wordpress.org/ /tmp/wordpress
- git clone --branch="master" https://github.com/inboundnow/cta.git /tmp/wordpress/wp-content/plugins/cta
- git clone --branch="master" https://github.com/inboundnow/leads.git /tmp/wordpress/wp-content/plugins/leads
- cd ..
- curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
- php wp-cli.phar --info
- chmod +x wp-cli.phar
- sudo mv wp-cli.phar /usr/local/bin/wp
- mv "$PLUGIN_SLUG" "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG"
- cd /tmp/wordpress
- mysql -e "CREATE DATABASE wordpress_tests;" -uroot
- cp wp-tests-config-sample.php wp-tests-config.php
- sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
- sed -i "s/yourusernamehere/travis/" wp-tests-config.php
- sed -i "s/yourpasswordhere//" wp-tests-config.php
- cd "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG"
- ls -l
script: phpunit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment