forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
230 lines (200 loc) · 8.57 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
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:
- PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
- WP_DEVELOP_DIR: ./wordpress
- LOCAL_SCRIPT_DEBUG: false
- INSTALL_COMPOSER: 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
# Download and unpack WordPress.
curl -sL https://github.com/WordPress/WordPress/archive/master.zip -o /tmp/wordpress-latest.zip
unzip -q /tmp/wordpress-latest.zip -d /tmp
mkdir -p wordpress/src
mv /tmp/WordPress-master/* wordpress/src
# Create the upload directory with permissions that Travis can handle.
mkdir -p wordpress/src/wp-content/uploads
chmod 767 wordpress/src/wp-content/uploads
# Grab the tools we need for WordPress' local-env.
curl -sL https://github.com/WordPress/wordpress-develop/archive/master.zip -o /tmp/wordpress-develop.zip
unzip -q /tmp/wordpress-develop.zip -d /tmp
mv \
/tmp/wordpress-develop-master/tools \
/tmp/wordpress-develop-master/tests \
/tmp/wordpress-develop-master/.env \
/tmp/wordpress-develop-master/docker-compose.yml \
/tmp/wordpress-develop-master/wp-cli.yml \
/tmp/wordpress-develop-master/*config-sample.php \
/tmp/wordpress-develop-master/package.json wordpress
# Install WordPress. The additional dependencies are required by the copied `wordpress-develop` tools.
cd wordpress
npm install dotenv wait-on
npm run env:start
sleep 10
npm run env:install
cd ..
# Connect Gutenberg to WordPress.
npm run env connect
npm run env cli plugin activate gutenberg
fi
- |
if [[ "$INSTALL_COMPOSER" = "true" ]]; then
npm run env docker-run -- php composer install
fi
- |
if [[ "$E2E_ROLE" = "author" ]]; then
npm run env cli -- user create author [email protected] --role=author --user_pass=authpass
npm run env cli -- post update 1 --post_author=2
fi
jobs:
include:
- name: Lint
install:
- npm ci
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: 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: INSTALL_COMPOSER=true
script:
- npm run test-php && npm run test-unit-php-multisite
- name: PHP unit tests (PHP 5.6)
env: INSTALL_COMPOSER=true LOCAL_PHP=5.6-fpm
script:
- npm run test-php && npm run test-unit-php-multisite
- name: E2E tests (Admin) (1/4)
env: FORCE_REDUCED_MOTION=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
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 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
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 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
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 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
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 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
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 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
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 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
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 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
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 )
- stage: deploy
if: (NOT type IN (pull_request)) AND (branch = master)
name: Deploy Playground
env: INSTALL_WORDPRESS=false
install:
- npm ci
before_deploy:
- npm run storybook:build
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
keep_history: true
local_dir: playground/dist
on:
branch: master
allow_failures:
# nothing is allowed to fail at the moment