This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.travis.yml
129 lines (108 loc) · 3.34 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
language: php
branches:
only:
- master
- /^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/
services:
- mysql
cache:
apt: true
yarn: true
directories:
- $HOME/.composer/cache/files
addons:
apt:
packages:
- nginx
notifications:
email:
on_success: never
on_failure: change
php:
- 7.1
- 7.2
- nightly
env:
global:
- COMPOSER_NO_INTERACTION=1
matrix:
- WP_VERSION=nightly
- WP_VERSION=latest WITH_COVERAGE=true
- WP_VERSION=4.9.1
matrix:
allow_failures:
- php: nightly
- env: WP_VERSION=nightly
fast_finish: true
before_install:
# Disable test coverage on php nightly
- if [[ $(phpenv version-name) == "nightly" ]]; then export WITH_COVERAGE=false; fi
# Disable xDebug to speed up the build unless test coverage is needed
- if [[ "$WITH_COVERAGE" != "true" && $(phpenv version-name) != "nightly" ]]; then phpenv config-rm xdebug.ini; fi
# Install helper scripts
- travis_retry composer global require --prefer-dist --no-suggest typisttech/travis-nginx-wordpress
- export PATH=$HOME/.composer/vendor/bin:$PATH
- tnw-install-nginx
- tnw-install-wordpress
- tnw-prepare-codeception
# Enable WP_DEBUG
- wp core config --dbname=wordpress --dbuser=root --dbhost=localhost --locale=$en_US --force --path=/tmp/wordpress/ --extra-php="define( 'AUTOMATIC_UPDATER_DISABLED', true ); define( 'WP_DEBUG', true );"
# Build the production plugin
- travis_retry composer build
# Activate the plugin
- wp plugin install ./release/sunny.zip --force --activate --path=/tmp/wordpress
# Export a dump of plugin-activated database to the _data folder
- wp db export $TRAVIS_BUILD_DIR/tests/_data/dump.sql --path=/tmp/wordpress
install:
- travis_retry composer install --prefer-dist --no-suggest
script:
- if [[ "$WITH_COVERAGE" == "true" ]]; then vendor/bin/codecept run integration,unit --coverage --coverage-xml; fi
- if [[ "$WITH_COVERAGE" != "true" ]]; then vendor/bin/codecept run integration,unit; fi
- vendor/bin/codecept run acceptance
# WP REST API testing
- rm -dfr /tmp/wordpress/wp-content/plugins/sunny
- cp -R $TRAVIS_BUILD_DIR /tmp/wordpress/wp-content/plugins/sunny
- cd /tmp/wordpress/wp-content/plugins/sunny
- vendor/bin/codecept run restapi
# Go back to build directory
- cd $TRAVIS_BUILD_DIR
after_script:
- if [[ "$WITH_COVERAGE" == "true" ]]; then travis_retry tnw-upload-coverage-to-scrutinizer; fi
- if [[ "$WITH_COVERAGE" == "true" ]]; then travis_retry tnw-upload-coverage-to-codecov; fi
before_deploy:
- unzip -qo release/sunny.zip -d build
deploy:
- provider: releases
api_key: $GITHUB_ACCESS_TOKEN
file: release/sunny.zip
skip_cleanup: true
on:
condition: "$WP_VERSION = nightly"
php: 7.0
tags: true
repo: TypistTech/sunny
- provider: wordpress-plugin
edge:
source: TypistTech/dpl
branch: add-wordpress-plugin-deployment
slug: sunny
username: tangrufus
build_dir: build
assets_dir: assets
skip_cleanup: true
on:
condition: "$WP_VERSION = latest"
php: 7.0
tags: true
repo: TypistTech/sunny
- provider: pages
skip_cleanup: true
github_token: $GITHUB_ACCESS_TOKEN
local_dir: build
target_branch: nightly
project_name: "Sunny"
on:
branch: master
condition: "$WP_VERSION = latest"
php: 7.0
repo: TypistTech/sunny