Skip to content

Commit 713807d

Browse files
authored
Switch to using the Core local environment (WordPress#17004)
1 parent 02c5f39 commit 713807d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+928
-1090
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ gutenberg.zip
1010
*.log
1111
phpcs.xml
1212
yarn.lock
13-
docker-compose.override.yml
1413
/wordpress
1514

1615
playground/dist

.travis.yml

+82-58
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,79 @@ cache:
1616
- $HOME/.jest-cache
1717
- $HOME/.npm
1818
- $HOME/.nvm/.cache
19-
- $HOME/.phpbrew
2019

2120
branches:
2221
only:
2322
- master
2423

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+
2532
before_install:
2633
- 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
2992
3093
jobs:
3194
include:
@@ -52,125 +115,86 @@ jobs:
52115
- npm run check-licenses
53116

54117
- name: JavaScript unit tests
118+
env: INSTALL_WORDPRESS=false
55119
install:
56120
- npm ci
57-
script:
58121
# It's not necessary to run the full build, since Jest can interpret
59122
# source files with `babel-jest`. Some packages have their own custom
60123
# build tasks, however. These must be run.
61124
- npx lerna run build
125+
script:
62126
- npm run test-unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache"
63127

64128
- name: JavaScript native mobile tests
65129
install:
66130
- npm ci
67-
script:
68131
# It's not necessary to run the full build, since Jest can interpret
69132
# source files with `babel-jest`. Some packages have their own custom
70133
# build tasks, however. These must be run.
71134
- npx lerna run build
135+
script:
72136
- npm run test-unit:native -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache"
73137

74-
- name: PHP unit tests (Docker)
75-
env: WP_VERSION=latest DOCKER=true
138+
- name: PHP unit tests
139+
env: INSTALL_COMPOSER=true
76140
script:
77-
- ./bin/run-wp-unit-tests.sh
141+
- npm run test-php && npm run test-unit-php-multisite
78142

79143
- 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
83145
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
97147

98148
- 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=
102150
script:
103151
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
104152
- $( 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 )
105153

106154
- 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=
110156
script:
111157
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
112158
- $( 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 )
113159

114160
- 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=
118162
script:
119163
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
120164
- $( 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 )
121165

122166
- 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=
126168
script:
127169
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
128170
- $( 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 )
129171

130172
- 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=
134174
script:
135175
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
136176
- $( 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 )
137177

138178
- 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=
142180
script:
143181
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
144182
- $( 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 )
145183

146184
- 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=
150186
script:
151187
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
152188
- $( 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 )
153189

154190
- 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=
158192
script:
159193
- $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests
160194
- $( 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 )
161195

162196
allow_failures:
163197
- 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
174198

175199
before_deploy:
176200
- npm install

bin/bootstrap-env.sh

-12
This file was deleted.
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
wordpress-develop:
3+
volumes:
4+
- %PLUGIN_MOUNT_DIR%:/var/www/${LOCAL_DIR-src}/wp-content/plugins/%PLUGIN_INSTALL_DIR%
5+
- %PLUGIN_MOUNT_DIR%/packages/e2e-tests/plugins:/var/www/${LOCAL_DIR-src}/wp-content/plugins/gutenberg-test-plugins
6+
- %PLUGIN_MOUNT_DIR%/packages/e2e-tests/mu-plugins:/var/www/${LOCAL_DIR-src}/wp-content/mu-plugins
7+
php:
8+
volumes:
9+
- %PLUGIN_MOUNT_DIR%:/var/www/${LOCAL_DIR-src}/wp-content/plugins/%PLUGIN_INSTALL_DIR%
10+
- %PLUGIN_MOUNT_DIR%/packages/e2e-tests/plugins:/var/www/${LOCAL_DIR-src}/wp-content/plugins/gutenberg-test-plugins
11+
- %PLUGIN_MOUNT_DIR%/packages/e2e-tests/mu-plugins:/var/www/${LOCAL_DIR-src}/wp-content/mu-plugins
12+
cli:
13+
volumes:
14+
- %PLUGIN_MOUNT_DIR%:/var/www/${LOCAL_DIR-src}/wp-content/plugins/%PLUGIN_INSTALL_DIR%
15+
phpunit:
16+
volumes:
17+
- %PLUGIN_MOUNT_DIR%:/var/www/${LOCAL_DIR-src}/wp-content/plugins/%PLUGIN_INSTALL_DIR%

bin/includes.sh

-134
This file was deleted.

0 commit comments

Comments
 (0)