forked from google/site-kit-wp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
137 lines (127 loc) · 3.9 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Site Kit by Google, Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
sudo: required
dist: xenial
language: php
notifications:
email:
on_success: never
on_failure: change
cache:
directories:
- $HOME/.cache/composer
- $HOME/.phpbrew
- $HOME/.npm
branches:
only:
- master
- develop
- adsense-setup-refactoring
# Before install, failures in this section will result in build status 'errored'
before_install:
- |
if [[ "$JS" == "1" ]] || [[ "$VRT" == "1" ]] || [[ "$E2E" == "1" ]] || [[ "$SNIFF" == "1" ]]; then
nvm install
npm ci
fi
- |
if [[ "$PHP" == "1" ]] || [[ "$E2E" == "1" ]] || [[ "$SNIFF" == "1" ]]; then
docker run --rm -v "$PWD:/app" -v "$HOME/.cache/composer:/tmp/cache" composer install
fi
- |
if [[ "$VRT" == "1" ]]; then
docker run --rm -v "$PWD:/app" -v "$HOME/.cache/composer:/tmp/cache" composer install --no-scripts
fi
- |
if [[ "$WP_VERSION" == "latest" ]]; then
curl -s http://api.wordpress.org/core/version-check/1.7/ > /tmp/wp-latest.json
WP_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
fi
- |
if [[ "$PHP" == "1" ]]; then
git clone --depth=1 --branch="$WP_VERSION" git://develop.git.wordpress.org/ /tmp/wordpress
cp /tmp/wordpress/wp-tests-config-sample.php /tmp/wordpress/tests/phpunit/wp-tests-config.php
export WP_DEVELOP_DIR=/tmp/wordpress
export WP_TESTS_DIR=/tmp/wordpress/tests/phpunit
bash tests/bin/install-wp-tests.sh wordpress_test root '' localhost
fi
script:
- |
if [[ "$SNIFF" == "1" ]]; then
composer lint || exit 1
npm run lint:js || exit 1
npm run lint:css || exit 1
fi
- |
if [[ "$JS" == "1" ]]; then
npm run test:js || exit 1 # JS unit tests
npm run test || exit 1 # Bundle size test
fi
- |
if [[ "$VRT" == "1" ]]; then
travis_retry npm run test:visualtest || exit 1
fi
- |
if [[ "$PHP" == "1" ]]; then
composer test || exit 1
fi
- |
if [[ "$E2E" == "1" ]]; then
npm run build:test || exit 1 # Build for tests.
npm run env:start || exit 1
npm run test:e2e:ci || exit 1 # E2E tests.
fi
jobs:
allow_failures:
- php: nightly
- env: E2E=1 WP_VERSION=nightly
include:
- stage: test
name: Lint
php: 7.4
env: WP_VERSION=4.7 SNIFF=1 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
- name: PHP Tests (PHP 5.6, WordPress 4.7)
php: 5.6
env: WP_VERSION=4.7 PHP=1
- name: PHP Tests (PHP 7.4, WordPress latest)
php: 7.4
env: WP_VERSION=latest PHP=1
- name: PHP Tests (PHP 7.4, WordPress Multisite latest)
php: 7.4
env: WP_VERSION=latest WP_MULTISITE=1 PHP=1
- name: JS Tests
php: 7.4
env: WP_VERSION=latest JS=1 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
- name: Visual Regression
env: VRT=1
- name: PHP Tests (PHP nightly, WordPress trunk)
stage: test
php: nightly
env: WP_VERSION=master PHP=1
- stage: test
name: E2E Tests (WordPress latest)
env: E2E=1
- stage: test
name: E2E Tests (WordPress nightly)
env: E2E=1 WP_VERSION=nightly
- stage: test
name: E2E Tests (WordPress 4.7)
env: E2E=1 WP_VERSION=4.7.13
- stage: test
name: E2E Tests (WordPress 4.9, Gutenberg 4.9)
env: E2E=1 WP_VERSION=4.9.10 GUTENBERG_VERSION=4.9.0
services:
- docker
- mysql