forked from htmlburger/wpemerge-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
80 lines (71 loc) · 2.26 KB
/
.travis.yml
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
79
80
# Modified version of the TwentySeventeen theme .travis.yml file.
# @link https://github.com/WordPress/twentyseventeen/blob/master/.travis.yml
dist: trusty
sudo: false
language: php
php:
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
env:
- WP_VERSION=master WP_MULTISITE=0
- WP_VERSION=5.0 WP_MULTISITE=0
- WP_VERSION=4.9 WP_MULTISITE=0
- WP_VERSION=4.8 WP_MULTISITE=0
- WP_VERSION=4.7 WP_MULTISITE=0
matrix:
fast_finish: true
include:
- php: 5.5
env: WP_VERSION=4.7 WP_MULTISITE=0 LINT=1
- php: 5.5
env: WP_VERSION=4.7 WP_MULTISITE=1
before_install:
# Update composer.
- composer self-update
# Output the Node version.
- node -v
# Output the NPM version.
- npm -v
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 Twenty Seventeen 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
# Hop into themes directory.
- cd $theme_dir
# Make sure dev dependencies are installed.
- composer install
# Setup test environment.
- composer install-test-env
# Install Yarn.
- if [[ "$LINT" == "1" ]]; then npm install -g yarn; fi
# Output the Yarn version.
- if [[ "$LINT" == "1" ]]; then yarn -v; fi
# Install node packages.
- if [[ "$LINT" == "1" ]]; then yarn install; fi
script:
# Check all PHP files for syntax errors.
# The usage of bash + || exit 1 is to ensure xargs does not exit on first error.
- find app/ theme/ \( -name '*.php' \) | xargs -n1 bash -c 'php -lf $0 || exit 1'
# Run build.
- if [[ "$LINT" == "1" ]]; then yarn build; fi
# Run lints.
- if [[ "$LINT" == "1" ]]; then yarn lint; fi