forked from ampproject/amp-wp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
176 lines (152 loc) · 5.81 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
# Tell Travis CI we're using PHP
language: php
# Using trusty instead of precise because we don't need PHP 5.2 or 5.3 anymore.
dist: trusty
addons:
apt:
packages:
# Needed for `xmllint`.
- libxml2-utils
notifications:
email:
on_success: never
on_failure: change
cache:
directories:
- $HOME/.composer/cache
- $HOME/.jest-cache
- $HOME/.npm
- $HOME/.nvm/.cache
- $HOME/phpunit-bin
branches:
only:
- master
- develop
- /^\d+\.\d+$/
install:
- nvm install
- composer install
- export DEV_LIB_PATH=vendor/xwp/wp-dev-lib/scripts
- export DIFF_HEAD=HEAD
- source "$DEV_LIB_PATH/travis.install.sh"
before_script:
- phpenv config-rm xdebug.ini || echo "xdebug.ini does not exist."
script:
- npm run build:js
- npm run build:css
- source "$DEV_LIB_PATH/travis.script.sh"
- |
if [[ ! -z "$PHPUNIT_EXTRA_SUITE" ]]; then
echo "Running phpunit testsuite $PHPUNIT_EXTRA_SUITE"
travis_retry phpunit --testsuite $PHPUNIT_EXTRA_SUITE
fi
after_script:
- source "$DEV_LIB_PATH/travis.after_script.sh"
jobs:
fast_finish: true
# These need to be exact matches, including whitespace!
allow_failures:
# PHP unit tests (7.3, WordPress trunk)
- env: WP_VERSION=trunk DEV_LIB_ONLY=phpunit INSTALL_PWA_PLUGIN=1
# PHP and JavaScript unit tests (7.3, WordPress trunk, with code coverage)
- env: WP_VERSION=latest DEV_LIB_ONLY=phpunit INSTALL_PWA_PLUGIN=1 RUN_PHPUNIT_COVERAGE=1
# PHP unit tests (7.4, WordPress trunk)
- env: WP_VERSION=trunk DEV_LIB_ONLY=phpunit INSTALL_PWA_PLUGIN=1
php: 7.4snapshot
include:
- stage: lint
name: Lint (PHP, JavaScript, and configuration files)
php: "7.3"
env: WP_VERSION=latest DEV_LIB_ONLY=phpsyntax
before_script:
- phpenv config-rm xdebug.ini || echo "xdebug.ini does not exist."
- composer require --dev localheinz/composer-normalize --ignore-platform-reqs
script:
- source "$DEV_LIB_PATH/travis.script.sh"
- composer validate --no-check-all
- composer normalize --dry-run
- npm run lint
- npm run build:js
after_success:
- npx sizereport --config
- stage: analyze
name: Static analysis (PHP)
php: "7.3"
install:
- composer install
script:
- composer analyze
- stage: test
name: JavaScript unit tests
php: "7.3"
env: WP_VERSION=latest DEV_LIB_SKIP=phpcs,eslint,xmllint,phpsyntax,phpunit
script:
- source "$DEV_LIB_PATH/travis.script.sh"
- npm run test:js -- --ci --cacheDirectory="$HOME/.jest-cache"
- name: E2E tests
php: "7.3"
env: WP_VERSION=latest DEV_LIB_SKIP=phpcs,eslint,xmllint,phpsyntax,phpunit
install:
- nvm install
- composer install
- npm install
script:
- npm run build:js
- npm run build:css
- npm run env:start
- npm run test:e2e:ci
- npm run env:stop
- name: PHP unit tests w/ external-http (7.3, WordPress latest)
php: "7.3"
env: WP_VERSION=latest DEV_LIB_ONLY=phpunit INSTALL_PWA_PLUGIN=1 PHPUNIT_EXTRA_SUITE=external-http
- name: PHP unit tests (7.2, WordPress latest)
php: "7.2"
env: WP_VERSION=latest DEV_LIB_ONLY=phpunit,phpsyntax INSTALL_PWA_PLUGIN=1
- name: PHP unit tests (7.1, WordPress latest)
php: "7.1"
env: WP_VERSION=latest DEV_LIB_ONLY=phpunit,phpsyntax INSTALL_PWA_PLUGIN=1
- name: PHP unit tests (7.0, WordPress 5.1)
php: "7.0"
env: WP_VERSION=5.1 DEV_LIB_ONLY=phpunit,phpsyntax INSTALL_PWA_PLUGIN=1
- name: PHP unit tests (5.6, WordPress 5.0)
php: "5.6"
env: WP_VERSION=5.0 DEV_LIB_ONLY=phpunit,phpsyntax INSTALL_PWA_PLUGIN=1
- name: PHP unit tests w/ external-http (5.6, WordPress 4.9)
php: "5.6"
env: WP_VERSION=4.9 DEV_LIB_ONLY=phpunit,phpsyntax PHPUNIT_EXTRA_SUITE=external-http
- name: PHP unit tests (7.3, WordPress trunk)
php: "7.3"
env: WP_VERSION=trunk DEV_LIB_ONLY=phpunit INSTALL_PWA_PLUGIN=1
- name: PHP unit tests (7.4, WordPress trunk)
php: "7.4snapshot"
env: WP_VERSION=trunk DEV_LIB_ONLY=phpunit INSTALL_PWA_PLUGIN=1
- name: PHP and JavaScript unit tests (7.3, WordPress trunk, with code coverage)
if: branch = develop AND type = push
php: "7.3"
env: WP_VERSION=latest DEV_LIB_ONLY=phpunit INSTALL_PWA_PLUGIN=1 RUN_PHPUNIT_COVERAGE=1
before_script:
- echo "Running unit tests with code coverage..."
script:
- npm run build:js
- npm run build:css
- source "$DEV_LIB_PATH/travis.script.sh"
- bash <(curl -s https://codecov.io/bash) -cF php -f /tmp/wordpress/src/wp-content/plugins/amp/build/logs/clover.xml
- npm run test:js -- --collectCoverage
- bash <(curl -s https://codecov.io/bash) -cF javascript -f build/logs/lcov.info
- name: Libraries that are meant to be externalized (5.6)
php: "5.6"
env: TEST_SKIP_PHPSTAN=1
install:
- composer --working-dir=lib/common install
- composer --working-dir=lib/optimizer install
script:
- composer --working-dir=lib/common test
- composer --working-dir=lib/optimizer test
- name: Libraries that are meant to be externalized (7.3)
php: "7.3"
install:
- composer --working-dir=lib/common install
- composer --working-dir=lib/optimizer install
script:
- composer --working-dir=lib/common test
- composer --working-dir=lib/optimizer test