@@ -16,16 +16,79 @@ cache:
16
16
- $HOME/.jest-cache
17
17
- $HOME/.npm
18
18
- $HOME/.nvm/.cache
19
- - $HOME/.phpbrew
20
19
21
20
branches :
22
21
only :
23
22
- master
24
23
24
+ env :
25
+ global :
26
+ - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD : true
27
+ - WP_DEVELOP_DIR : ./wordpress
28
+ - LOCAL_SCRIPT_DEBUG : false
29
+ - INSTALL_COMPOSER : false
30
+ - INSTALL_WORDPRESS : true
31
+
25
32
before_install :
26
33
- nvm install
27
-
28
- env : PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
34
+ - |
35
+ if [[ "$INSTALL_WORDPRESS" = "true" ]]; then
36
+ # Upgrade docker-compose.
37
+ sudo rm /usr/local/bin/docker-compose
38
+ curl -sL https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose
39
+ chmod +x docker-compose
40
+ sudo mv docker-compose /usr/local/bin
41
+ fi
42
+
43
+ install :
44
+ # Build Gutenberg.
45
+ - npm ci
46
+ - npm run build
47
+ - |
48
+ if [[ "$INSTALL_WORDPRESS" = "true" ]]; then
49
+ # Download and unpack WordPress.
50
+ curl -sL https://wordpress.org/nightly-builds/wordpress-latest.zip -o /tmp/wordpress-latest.zip
51
+ unzip -q /tmp/wordpress-latest.zip -d /tmp
52
+ mkdir -p wordpress/src
53
+ mv /tmp/wordpress/* wordpress/src
54
+
55
+ # Create the upload directory with permissions that Travis can handle.
56
+ mkdir -p wordpress/src/wp-content/uploads
57
+ chmod 767 wordpress/src/wp-content/uploads
58
+
59
+ # Grab the tools we need for WordPress' local-env.
60
+ curl -sL https://github.com/WordPress/wordpress-develop/archive/master.zip -o /tmp/wordpress-develop.zip
61
+ unzip -q /tmp/wordpress-develop.zip -d /tmp
62
+ mv \
63
+ /tmp/wordpress-develop-master/tools \
64
+ /tmp/wordpress-develop-master/tests \
65
+ /tmp/wordpress-develop-master/.env \
66
+ /tmp/wordpress-develop-master/docker-compose.yml \
67
+ /tmp/wordpress-develop-master/wp-cli.yml \
68
+ /tmp/wordpress-develop-master/*config-sample.php \
69
+ /tmp/wordpress-develop-master/package.json wordpress
70
+
71
+ # Install WordPress.
72
+ cd wordpress
73
+ npm install dotenv wait-on
74
+ npm run env:start
75
+ sleep 10
76
+ npm run env:install
77
+ cd ..
78
+
79
+ # Connect Gutenberg to WordPress.
80
+ npm run env connect
81
+ npm run env cli plugin activate gutenberg
82
+ fi
83
+ - |
84
+ if [[ "$INSTALL_COMPOSER" = "true" ]]; then
85
+ npm run env docker-run -- php composer install
86
+ fi
87
+ - |
88
+ if [[ "$E2E_ROLE" = "author" ]]; then
89
+ npm run env cli -- user create author [email protected] --role=author --user_pass=authpass
90
+ npm run env cli -- post update 1 --post_author=2
91
+ fi
29
92
30
93
jobs :
31
94
include :
@@ -52,125 +115,86 @@ jobs:
52
115
- npm run check-licenses
53
116
54
117
- name : JavaScript unit tests
118
+ env : INSTALL_WORDPRESS=false
55
119
install :
56
120
- npm ci
57
- script :
58
121
# It's not necessary to run the full build, since Jest can interpret
59
122
# source files with `babel-jest`. Some packages have their own custom
60
123
# build tasks, however. These must be run.
61
124
- npx lerna run build
125
+ script :
62
126
- npm run test-unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache"
63
127
64
128
- name : JavaScript native mobile tests
65
129
install :
66
130
- npm ci
67
- script :
68
131
# It's not necessary to run the full build, since Jest can interpret
69
132
# source files with `babel-jest`. Some packages have their own custom
70
133
# build tasks, however. These must be run.
71
134
- npx lerna run build
135
+ script :
72
136
- npm run test-unit:native -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache"
73
137
74
- - name : PHP unit tests (Docker)
75
- env : WP_VERSION=latest DOCKER =true
138
+ - name : PHP unit tests
139
+ env : INSTALL_COMPOSER =true
76
140
script :
77
- - ./bin/ run-wp -unit-tests.sh
141
+ - npm run test-php && npm run test -unit-php-multisite
78
142
79
143
- name : PHP unit tests (PHP 5.6)
80
- language : php
81
- php : 5.6
82
- env : WP_VERSION=latest
144
+ env : INSTALL_COMPOSER=true LOCAL_PHP=5.6-fpm
83
145
script :
84
- - ./bin/run-wp-unit-tests.sh
85
- if : branch = master and type != "pull_request"
86
-
87
- - name : PHP unit tests (PHP 5.3)
88
- env : WP_VERSION=latest SWITCH_TO_PHP=5.3
89
- script :
90
- - ./bin/run-wp-unit-tests.sh
91
- if : branch = master and type != "pull_request"
92
-
93
- - name : PHP unit tests (PHP 5.2)
94
- env : WP_VERSION=latest SWITCH_TO_PHP=5.2
95
- script :
96
- - ./bin/run-wp-unit-tests.sh
146
+ - npm run test-php && npm run test-unit-php-multisite
97
147
98
148
- name : E2E tests (Admin) (1/4)
99
- env : WP_VERSION=latest SCRIPT_DEBUG=false PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
100
- install :
101
- - ./bin/setup-travis-e2e-tests.sh
149
+ env : FORCE_REDUCED_MOTION=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
102
150
script :
103
151
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
104
152
- $( 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 )
105
153
106
154
- name : E2E tests (Admin) (2/4)
107
- env : WP_VERSION=latest SCRIPT_DEBUG=false PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
108
- install :
109
- - ./bin/setup-travis-e2e-tests.sh
155
+ env : FORCE_REDUCED_MOTION=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
110
156
script :
111
157
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
112
158
- $( 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 )
113
159
114
160
- name : E2E tests (Admin) (3/4)
115
- env : WP_VERSION=latest SCRIPT_DEBUG=false PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
116
- install :
117
- - ./bin/setup-travis-e2e-tests.sh
161
+ env : FORCE_REDUCED_MOTION=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
118
162
script :
119
163
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
120
164
- $( 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 )
121
165
122
166
- name : E2E tests (Admin) (4/4)
123
- env : WP_VERSION=latest SCRIPT_DEBUG=false PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
124
- install :
125
- - ./bin/setup-travis-e2e-tests.sh
167
+ env : FORCE_REDUCED_MOTION=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
126
168
script :
127
169
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
128
170
- $( 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 )
129
171
130
172
- name : E2E tests (Author) (1/4)
131
- env : WP_VERSION=latest SCRIPT_DEBUG=false E2E_ROLE=author PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
132
- install :
133
- - ./bin/setup-travis-e2e-tests.sh
173
+ env : E2E_ROLE=author FORCE_REDUCED_MOTION=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
134
174
script :
135
175
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
136
176
- $( 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 )
137
177
138
178
- name : E2E tests (Author) (2/4)
139
- env : WP_VERSION=latest SCRIPT_DEBUG=false E2E_ROLE=author PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
140
- install :
141
- - ./bin/setup-travis-e2e-tests.sh
179
+ env : E2E_ROLE=author FORCE_REDUCED_MOTION=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
142
180
script :
143
181
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
144
182
- $( 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 )
145
183
146
184
- name : E2E tests (Author) (3/4)
147
- env : WP_VERSION=latest SCRIPT_DEBUG=false E2E_ROLE=author PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
148
- install :
149
- - ./bin/setup-travis-e2e-tests.sh
185
+ env : E2E_ROLE=author FORCE_REDUCED_MOTION=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
150
186
script :
151
187
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
152
188
- $( 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 )
153
189
154
190
- name : E2E tests (Author) (4/4)
155
- env : WP_VERSION=latest SCRIPT_DEBUG=false E2E_ROLE=author PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
156
- install :
157
- - ./bin/setup-travis-e2e-tests.sh
191
+ env : E2E_ROLE=author FORCE_REDUCED_MOTION=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
158
192
script :
159
193
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
160
194
- $( 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 )
161
195
162
196
allow_failures :
163
197
- name : JavaScript native mobile tests
164
- - name : PHP unit tests (PHP 5.3)
165
- env : WP_VERSION=latest SWITCH_TO_PHP=5.3
166
- script :
167
- - ./bin/run-wp-unit-tests.sh
168
- if : branch = master and type != "pull_request"
169
-
170
- - name : PHP unit tests (PHP 5.2)
171
- env : WP_VERSION=latest SWITCH_TO_PHP=5.2
172
- script :
173
- - ./bin/run-wp-unit-tests.sh
174
198
175
199
before_deploy :
176
200
- npm install
0 commit comments