-
Notifications
You must be signed in to change notification settings - Fork 6
/
.travis.yml
170 lines (145 loc) · 5.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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Copyright 2020 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
#
# http://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.
cache:
directories:
- $HOME/.composer/cache
- $HOME/.jest-cache
- $HOME/.npm
- $HOME/.nvm/.cache
- $HOME/phpunit-bin
notifications:
email:
on_success: never
on_failure: change
webhooks: "https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN"
language: php
dist: trusty
services:
- mysql
- docker
addons:
apt:
packages:
- libxml2-utils
branches:
only:
- master
- develop
- /^\d+\.\d+$/
env:
global:
- PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
- COVERALLS_PARALLEL=true
before_install:
- nvm install
- nvm use
install:
- npm install
- npm run build:js
- export DEV_LIB_PATH=vendor/xwp/wp-dev-lib/scripts
- export DIFF_HEAD=HEAD
- export DEFAULT_BASE_BRANCH=main
- export PROJECT_TYPE=plugin
- source "$DEV_LIB_PATH/travis.install.sh"
before_script:
- phpenv config-rm xdebug.ini || echo "xdebug.ini does not exist."
script:
- source "$DEV_LIB_PATH/travis.script.sh"
after_script:
- source "$DEV_LIB_PATH/travis.after_script.sh"
jobs:
fast_finish: true
include:
- stage: lint
name: Lint (PHP, JavaScript, and configuration files)
php: "7.4"
env: WP_VERSION=latest DEV_LIB_ONLY=xmllint,phpsyntax
script:
- source "$DEV_LIB_PATH/travis.script.sh"
- npm run lint
- stage: test
name: E2E tests with Docker (7.4, WordPress latest, with code coverage)
php: "7.4"
env: NODE_ENV=teste2e COVERALLS_REPO_TOKEN=$CR_TOKEN
before_install:
- unset PUPPETEER_SKIP_CHROMIUM_DOWNLOAD
- nvm install
- nvm use
- set PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
before_script:
- sudo service mysql stop
- echo "Running E2E tests with code coverage ..."
script:
- npm run env:start
- docker-compose exec wordpress bash -c "chown -R www-data:www-data /var/www/html/wp-content/" # ensure WP folders have correct permissions
- docker-compose exec mysql bash -c "chown -R mysql:mysql /var/lib/mysql"
- npm run wp -- wp core install --title=WordPress --admin_user=admin --admin_password=password [email protected] --skip-email --url=http://localhost:8088
- npm run wp -- wp plugin activate material-design
- sudo chown -R travis:travis plugin/tests node_modules # ensure coverage folder can be created
- npm run test:e2e:coveralls
- name: E2E tests with Docker (7.3, WordPress 5.2)
php: "7.3"
env: NODE_ENV=teste2e PHP_VERSION=php7.3-apache WP_VERSION=5.2
before_install:
- unset PUPPETEER_SKIP_CHROMIUM_DOWNLOAD
- nvm install
- nvm use
- set PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
before_script:
- sudo service mysql stop
- echo "Running E2E tests"
script:
- npm run env:start
- docker-compose exec wordpress bash -c "chown -R www-data:www-data /var/www/html/wp-content/" # ensure WP folders have correct permissions
- docker-compose exec mysql bash -c "chown -R mysql:mysql /var/lib/mysql"
- npm run wp -- wp core install --title=WordPress --admin_user=admin --admin_password=password [email protected] --skip-email --url=http://localhost:8088
- npm run wp -- wp plugin activate material-design
- sudo chown -R travis:travis plugin/tests node_modules
- npm run test:e2e
- name: JS unit tests (7.4, WordPress latest, with code coverage)
php: "7.4"
env: COVERALLS_REPO_TOKEN=$CR_TOKEN
before_script:
- echo "Running JS unit tests with code coverage ..."
script:
- npm run build:js
- npm run test:js:coveralls
- name: PHP unit tests (7.4, WordPress latest, with code coverage)
php: "7.4"
env: WP_VERSION=latest DEV_LIB_ONLY=phpunit,coverage
before_script:
- echo "Running PHP unit tests with code coverage ..."
script:
- source "$DEV_LIB_PATH/travis.script.sh"
- name: PHP unit tests (7.3, WordPress latest)
php: "7.3"
env: WP_VERSION=latest DEV_LIB_ONLY=phpunit
- name: PHP unit tests (7.2, WordPress latest)
php: "7.2"
env: WP_VERSION=latest DEV_LIB_ONLY=phpunit
- name: PHP unit tests (7.1, WordPress latest)
php: "7.1"
env: WP_VERSION=latest DEV_LIB_ONLY=phpunit
- name: PHP unit tests (7.0, WordPress 5.3)
php: "7.0"
env: WP_VERSION=5.3 DEV_LIB_ONLY=phpunit
- name: PHP unit tests (5.6, WordPress 5.2)
php: "5.6"
env: WP_VERSION=5.2 DEV_LIB_ONLY=phpunit
- name: PHP unit tests (7.4, WordPress trunk)
php: "7.4"
env: WP_VERSION=trunk DEV_LIB_ONLY=phpunit
- name: PHP unit tests (5.6, WordPress trunk)
php: "5.6"
env: WP_VERSION=trunk DEV_LIB_ONLY=phpunit