forked from htmlburger/wpemerge-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
97 lines (86 loc) · 2.57 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Modified version of the TwentySeventeen theme .travis.yml file.
# @link https://github.com/WordPress/twentyseventeen/blob/master/.travis.yml
language: php
os: linux
dist: trusty
php:
- 7.4
- 7.3
- 7.2
- 5.6
env:
- WP_VERSION=master
- WP_VERSION=5.4
- WP_VERSION=5.3
cache:
directories:
- /tmp/wordpress
jobs:
fast_finish: true
include:
- php: 5.6
env: WP_VERSION=5.4
- php: 5.6
env: WP_VERSION=5.3
- php: 5.6
env: WP_VERSION=4.9
- php: 5.6
env: WP_VERSION=4.7
- php: 5.5
env: WP_VERSION=4.9
- php: 5.5
env: WP_VERSION=4.7 WP_MULTISITE=1
- php: 5.5
env: WP_VERSION=4.7 LINT=1
before_install:
- WP_DIR=/tmp/wordpress
- APP_SLUG=$(basename $PWD)
- APP_DIR=$WP_DIR/src/wp-content/plugins/$APP_SLUG
# Install required Node version.
- nvm install 12
- nvm use 12
# Output the Node version.
- node -v
# Output the NPM version.
- npm -v
before_cache:
- mv $APP_DIR/node_modules $WP_DIR/node_modules-cache || true
- mv $APP_DIR/vendor $WP_DIR/vendor-cache
- rm -rf $APP_DIR
before_script:
# Set up WordPress installation.
- >
if [ ! -d "$WP_DIR/src" ];
then git clone --depth=1 --branch="$WP_VERSION" git://develop.git.wordpress.org/ $WP_DIR && rm -rf "$WP_DIR/.git";
else (mv $WP_DIR/node_modules-cache $PWD/node_modules || true) && mv $WP_DIR/vendor-cache $PWD/vendor;
fi
# Set up app.
- ln -s $PWD $APP_DIR
# Set up WordPress configuration.
- cd $WP_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 $APP_DIR
# Make sure dev dependencies are installed.
- composer install
# Setup test environment.
- composer run 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 ./ -maxdepth 1 -name '*.php' | xargs -n1 bash -c 'php -lf $0 || exit 1'
- find app/ views/ \( -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