forked from codesnippetspro/code-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.travis.yml
More file actions
78 lines (63 loc) · 2.18 KB
/
Copy path.travis.yml
File metadata and controls
78 lines (63 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Declare project language.
# @link http://about.travis-ci.org/docs/user/languages/php/
language: php
# Use container-based infrastructure
sudo: false
# Declare versions of PHP to use. Use one decimal max.
php:
- "5.5"
- "5.4"
- "5.6"
env:
# Trunk
- WP_VERSION=master WP_MULTISITE=0
- WP_VERSION=master WP_MULTISITE=1
# Latest stable version
- WP_VERSION=stable WP_MULTISITE=0
- WP_VERSION=stable WP_MULTISITE=1
# Prepare the system by installing prerequisites and dependencies.
# Failures in this section will result in build status 'errored'.
before_install:
- composer self-update
- npm install -g grunt-cli
# Prepare your build for testing.
# Failures in this section will result in build status 'errored'.
before_script:
- pwd
- PROJECT_DIR=$(pwd)
# set up WP install
- export WP_DEVELOP_DIR=/tmp/wordpress
- mkdir -p $WP_DEVELOP_DIR
- git clone --depth=1 git://develop.git.wordpress.org/ $WP_DEVELOP_DIR/
- cd $WP_DEVELOP_DIR
- if [[ $WP_VERSION == 'stable' ]]; then git fetch --tags; export WP_VERSION=$(git tag | sort -n | tail -1); fi
- git checkout $WP_VERSION
# Build plugin
- cd $PROJECT_DIR
- plugin_slug=$(basename $PROJECT_DIR)
- plugin_dir=$WP_DEVELOP_DIR/src/wp-content/plugins/$plugin_slug
- composer install
- vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs
- npm install
- grunt
- grunt package
- mv $PROJECT_DIR/dist $plugin_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
- cd $PROJECT_DIR
# 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 . -maxdepth 1 \( -name '*.php' \) -exec php -lf {} \;
- find php/ \( -name '*.php' \) -exec php -lf {} \;
# Run Grunt tests
- grunt test