-
Notifications
You must be signed in to change notification settings - Fork 7
/
.travis.yml
executable file
·263 lines (224 loc) · 9.39 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
sudo: required
dist: trusty
# language: php
addons:
# note: instead of using firefox latest we are using a bit older version due to configuration issues of w3c protocol for remote webdriver. But now it is also a wise combination to use one browser(right now chrome) with latest version and one browser with a bit older version( right now firefox). Anyway in future we will need full coverage of everything as per standards ranging from devices, browsers and their versions, language(php)/DB(mysql) version, wp versions, woo versions etc. Except third party services the selenimu server and its dockers are providing featurs to use all browser, devices(MAC etc. environment) and versions combinations.
chrome: stable
# firefox: latest #TODO here in future we should setup just the required browser for environment for e.g. we use only one browser per php version so this thing should be conditioned based on php version and load only one browser by moving below if possible or otherwise using some other condition
firefox: "55"
notifications:
email:
on_success: never
on_failure: change
branches:
only:
- dev
- master
services:
- mysql
- xvfb
before_install:
- mysql -e 'CREATE DATABASE IF NOT EXISTS wordpress_test;'
- mysql -u root --default-character-set=utf8 wordpress_test < wordpress-from-wordpress.org-download/wordpress/db.sql
- mysql -e 'CREATE DATABASE IF NOT EXISTS WBC_TEST_ENV_with_sample_data_wp_latest_1;'
- mysql -u root --default-character-set=utf8 WBC_TEST_ENV_with_sample_data_wp_latest_1 < wordpress-from-wordpress.org-download/WBC_TEST_ENV_with_sample_data/wordpress-latest-1/db.sql
cache:
directories:
- $HOME/.composer/cache #_switch
env:
global:
- PATH="$TRAVIS_BUILD_DIR/vendor/bin:$PATH"
- WP_CLI_BIN_DIR="$TRAVIS_BUILD_DIR/vendor/bin"
# - WP_VERSION=latest WP_MULTISITE=0
- WP_MULTISITE=0
- NODE_VERSION="12.0"
# Define vars.
- export WP_VERSION=master
- export WP_DEVELOP_DIR=/tmp/wordpress/src
- export SERVER_ROOT_DIR=/
- export WP_CORE_DIR=/tmp/wordpress/src
# - export WP_CEPT_SERVER='127.0.0.1:8888' #moved below
# matrix:
# include:
# # - language: node_js
# # node_js:
# # - "10.21.0"
# # before_script:
# # - sleep 30s
# # - echo "cd to WP_DEVELOP_DIR..."
# # - cd $WP_DEVELOP_DIR
# - language: php
# # php: 7.2
# - php:
# - 7.1
# - 7.0
# # - 5.3
language: php
php:
- 7.3
- 7.2
- 5.6
# - 7.2 #.3
# - 7.2.2
# env: WP_VERSION=latest
before_script:
# - sudo apt-get update
# - sudo apt-get install apache2 libapache2-mod-fastcgi
# # enable php-fpm
# - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
# - sudo a2enmod rewrite actions fastcgi alias
# - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
# - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
# - sudo chown -R travis:travis /var/lib/apache2/fastcgi
# - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
# # configure apache virtual hosts
# - sudo cp -f build/travis-ci-apache /etc/apache2/sites-available/000-default.conf
# - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
# - sudo service apache2 restart
# # Increase the shared memory mountpoint. Chrome or something in the tests is
# # taking up more shared memory than is available which causes tests to fail.
# # See https://github.com/SeleniumHQ/docker-selenium/issues/431
# - sudo mount -o remount,size=32G /run/shm
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- |
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
echo "TRAVIS_BUILD_DIR... $TRAVIS_BUILD_DIR"
phpenv config-rm xdebug.ini
else
echo "TRAVIS_BUILD_DIR... $TRAVIS_BUILD_DIR"
echo "xdebug.ini does not exist"
fi
# - |
# if [[ ! -z "$WP_VERSION" ]] ; then
# bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
# composer global require "phpunit/phpunit=5.*"
# fi
- |
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
composer global require wp-coding-standards/wpcs
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
fi
# Install WordPress
- source travis.sh
- install-wordpress
# - install_test_suite
# - move_things
- |
if [[ $(test_environment) == "WBC_TEST_ENV_default" ]]; then
export WP_CEPT_SERVER='127.0.0.1:8888'
else
export WP_CEPT_SERVER='127.0.0.1:8888'
fi
# Start up a web server.
# - php -S "$WP_CEPT_SERVER" -t "$WP_CORE_DIR" >/dev/null 2>&1 &
- php -S "$WP_CEPT_SERVER" -t "$SERVER_ROOT_DIR" >/dev/null 2>&1 &
# Start up the webdriver.
#- phantomjs --webdriver=4444 >/dev/null 2>&1 &
# - phantomjs --webdriver=4444 >/dev/null 2>&1 &
# #selenium
# - git clone https://github.com/srimaln91/selenium-installer.git
# - cd selenium-installer
# - sudo bash selenium_install.sh
# - selenium start &
# # - sleep 5s
# - cd ..
#selenium, chrome etc.
- echo "Config required"
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start
- echo "Download selenium-server-standalone jar file"
# - wget -c -nc --retry-connrefused --tries=0 https://bit.ly/2TlkRyu -O selenium-server-standalone.jar
# - wget -c -nc --retry-connrefused --tries=0 http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar -O selenium-server-standalone.jar
- |
if [[ $(test_environment) == "WBC_TEST_ENV_default" ]]; then
wget -c -nc --retry-connrefused --tries=0 http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar -O selenium-server-standalone.jar
else
wget -c -nc --retry-connrefused --tries=0 http://selenium-release.storage.googleapis.com/3.7/selenium-server-standalone-3.7.1.jar -O selenium-server-standalone.jar
fi
- echo "Download chromedriver"
# # - wget https://chromedriver.storage.googleapis.com/74.0.3729.6/chromedriver_linux64.zip
# - wget https://chromedriver.storage.googleapis.com/2.27/chromedriver_linux64.zip
# - unzip -o -q chromedriver_linux64.zip
- |
if [[ $(test_environment) == "WBC_TEST_ENV_default" ]]; then
wget https://chromedriver.storage.googleapis.com/2.27/chromedriver_linux64.zip
unzip -o -q chromedriver_linux64.zip
else
wget https://github.com/mozilla/geckodriver/releases/download/v0.20.1/geckodriver-v0.20.1-linux64.tar.gz
tar -xzf geckodriver-v0.20.1-linux64.tar.gz
fi
- echo "Run selenium-server"
# # # - nohup bash -c "java -jar selenium-server-standalone.jar &" && sleep 1; cat nohup.out
# # - nohup bash -c "java -jar selenium-server-standalone.jar &" && sleep 1;
# - nohup bash -c "java -jar selenium-server-standalone.jar -Dwebdriver.chrome.driver=\"chromedriver\" -Dwebdriver.chrome.whitelistedIps=\"localhost\" &" && sleep 1;
- |
if [[ $(test_environment) == "WBC_TEST_ENV_default" ]]; then
nohup bash -c "java -jar selenium-server-standalone.jar -Dwebdriver.chrome.driver=\"chromedriver\" -Dwebdriver.chrome.whitelistedIps=\"localhost\" &" && sleep 1;
else
nohup bash -c "java -jar -Dwebdriver.gecko.driver=\"geckodriver\" selenium-server-standalone.jar -enablePassThrough false &" && sleep 1;
fi
# Install Codeception and WP Browser.
# Doing this last gives the webdriver and server time to start up.
- composer_and_wp_plugins_install_update
# #install normal wordpress from wordpress main repo etc.
# - echo "curl based install..."
# - curl --data "user_name=USERNAMEHERE&admin_password=PasswordHere&admin_password2=PasswordHere&admin_email=username@email.addr&blog_public=checked&Submit=submit" "$WP_CEPT_SERVER/wp-admin/install.php?step=2"
script:
# - |
# if [[ ! -z "$WP_VERSION" ]] ; then
# phpunit
# WP_MULTISITE=1 phpunit
# fi
# - |
# if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
# phpcs
# fi
# set the url in yml file(s) as per the test environment, we can use different yml files also but this is easy to setup and faster if we need to maintain single var
- edit_codeception_yml_file
- php vendor/bin/codecept clean
- php vendor/bin/codecept build
- php vendor/bin/codecept run --steps --debug
#echo the output
- echo_necessary_output
- pwd
- ls -l /home/travis/build/EmptyOps/woocommerce-bundle-choice/deploy/
# - vendor/bin/wpcept run
# - language: node_js
# node_js:
# - "10.21.0"
# script: npm test #node_modules/karma/bin/karma start karma.conf.js --single-run
# before_install:
# - export DISPLAY=:99.0
# - sh -e /etc/init.d/xvfb start
# before_script:
# - npm install
#- php: 7.1
# env: WP_VERSION=latest
#- php: 7.0
# env: WP_VERSION=latest
#- php: 5.6
# env: WP_VERSION=latest
#- php: 5.6
# env: WP_VERSION=trunk
#- php: 5.6
# env: WP_TRAVISCI=phpcs
# - php: 5.3
# env: WP_VERSION=latest
# - language: php
# php: 5.3
# # env: WP_VERSION=latest
# before_script:
# - env: WP_VERSION=set_suitable
# - env: WBC_TEST_ENV=with_sample_data
# dist: precise
deploy:
#
# Auto-deploys the built plugin to WordPress.org on push to master branch
#
provider: script
skip_cleanup: true
script: /home/travis/build/EmptyOps/woocommerce-bundle-choice/deploy/deploy.sh
on:
branch: master
php: 7.2