forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
191 lines (164 loc) · 7.18 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
language: generic
services:
- docker
notifications:
email:
on_success: never
on_failure: change
cache:
directories:
- $HOME/.composer/cache
- $HOME/.jest-cache
- $HOME/.npm
- $HOME/.nvm/.cache
branches:
only:
- master
- rnmobile/master
- /rnmobile\/release.*/
- /wp\/.*/
env:
global:
- WP_DEVELOP_DIR: ./wordpress
- LOCAL_SCRIPT_DEBUG: false
- INSTALL_WORDPRESS: true
# Make sure NodeGit gets the correct C libs.
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libstdc++-4.9-dev
before_install:
- nvm install --latest-npm
- |
if [[ "$INSTALL_WORDPRESS" = "true" ]]; then
# Upgrade docker-compose.
sudo rm /usr/local/bin/docker-compose
curl -sL https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose
sudo mv docker-compose /usr/local/bin
fi
install:
# Build Gutenberg.
- npm ci
- npm run build
- |
if [[ "$INSTALL_WORDPRESS" = "true" ]]; then
echo '{ "config": { "SCRIPT_DEBUG": false, "WP_PHP_BINARY": "php" } }' > .wp-env.override.json
npm run wp-env start
fi
- |
if [[ "$E2E_ROLE" = "author" ]]; then
npm run wp-env run tests-cli "wp user create author [email protected] --role=author --user_pass=authpass"
npm run wp-env run tests-cli "wp post update 1 --post_author=2"
fi
jobs:
include:
- name: Lint
install:
- npm ci
# eslint-plugin-import/no-extraneous-dependencies relies on modules to
# be "installed", which in practice requires that packages be built,
# presumably so that pkg.main can be resolved.
#
# See: https://github.com/benmosher/eslint-plugin-import/blob/92caa35/resolvers/node/index.js
- node ./bin/packages/build.js
script:
- npm run lint
- name: Lint ES5 only
install:
- npm ci
- npm run build
script:
- npx eslint --parser-options=ecmaVersion:5 --no-eslintrc --no-ignore ./build/**/*.js
- name: Typecheck
install:
- npm ci
script:
- npm run build:package-types
- name: Build artifacts
install:
# A "full" install is executed, since `npm ci` does not always exit
# with an error status code if the lock file is inaccurate.
#
# See: https://github.com/WordPress/gutenberg/issues/16157
- npm install
script:
- npm run check-local-changes
- name: License compatibility
install:
- npm ci
script:
- npm run check-licenses
- name: JavaScript unit tests
env: INSTALL_WORDPRESS=false
install:
- npm ci
# It's not necessary to run the full build, since Jest can interpret
# source files with `babel-jest`. Some packages have their own custom
# build tasks, however. These must be run.
- npx lerna run build
script:
- npm run test-unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache"
- name: JavaScript native mobile tests
install:
- npm ci
# It's not necessary to run the full build, since Jest can interpret
# source files with `babel-jest`. Some packages have their own custom
# build tasks, however. These must be run.
- npx lerna run build
script:
- npm run test-unit:native -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache"
- name: PHP unit tests
env: WP_ENV_TESTS_PORT=8887 WP_ENV_PORT=8886 # TODO: Remove tests port when scripts/env is replaced with wp-env.
script:
- chmod -R 767 ./build
- npm run test-php && npm run test-unit-php-multisite
- name: PHP unit tests (PHP 5.6)
env: LOCAL_PHP=5.6-fpm WP_ENV_TESTS_PORT=8887 WP_ENV_PORT=8886 # TODO: Remove tests port when scripts/env is replaced with wp-env.
script:
- chmod -R 767 ./build
- npm run test-php && npm run test-unit-php-multisite
- name: E2E tests (Admin) (1/4)
env: FORCE_REDUCED_MOTION=true
script:
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 0' < ~/.jest-e2e-tests )
- name: E2E tests (Admin) (2/4)
env: FORCE_REDUCED_MOTION=true
script:
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 1' < ~/.jest-e2e-tests )
- name: E2E tests (Admin) (3/4)
env: FORCE_REDUCED_MOTION=true
script:
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 2' < ~/.jest-e2e-tests )
- name: E2E tests (Admin) (4/4)
env: FORCE_REDUCED_MOTION=true
script:
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 3' < ~/.jest-e2e-tests )
- name: E2E tests (Author) (1/4)
env: E2E_ROLE=author FORCE_REDUCED_MOTION=true
script:
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 0' < ~/.jest-e2e-tests )
- name: E2E tests (Author) (2/4)
env: E2E_ROLE=author FORCE_REDUCED_MOTION=true
script:
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 1' < ~/.jest-e2e-tests )
- name: E2E tests (Author) (3/4)
env: E2E_ROLE=author FORCE_REDUCED_MOTION=true
script:
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 2' < ~/.jest-e2e-tests )
- name: E2E tests (Author) (4/4)
env: E2E_ROLE=author FORCE_REDUCED_MOTION=true
script:
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == 3' < ~/.jest-e2e-tests )
allow_failures:
# nothing is allowed to fail at the moment