Skip to content

Commit

Permalink
Switch to using the Core local environment (#17004)
Browse files Browse the repository at this point in the history
  • Loading branch information
pento authored and ntwb committed Sep 3, 2019
1 parent 13af8c0 commit 232aca6
Show file tree
Hide file tree
Showing 42 changed files with 928 additions and 1,090 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ gutenberg.zip
*.log
phpcs.xml
yarn.lock
docker-compose.override.yml
/wordpress

playground/dist
Expand Down
140 changes: 82 additions & 58 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,79 @@ cache:
- $HOME/.jest-cache
- $HOME/.npm
- $HOME/.nvm/.cache
- $HOME/.phpbrew

branches:
only:
- master

env:
global:
- PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
- WP_DEVELOP_DIR: ./wordpress
- LOCAL_SCRIPT_DEBUG: false
- INSTALL_COMPOSER: false
- INSTALL_WORDPRESS: true

before_install:
- nvm install

env: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
- |
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://wordpress.org/nightly-builds/wordpress-latest.zip -o /tmp/wordpress-latest.zip
unzip -q /tmp/wordpress-latest.zip -d /tmp
mkdir -p wordpress/src
mv /tmp/wordpress/* 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.
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:
Expand All @@ -52,125 +115,86 @@ jobs:
- npm run check-licenses

- name: JavaScript unit tests
env: INSTALL_WORDPRESS=false
install:
- npm ci
script:
# 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
script:
# 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 (Docker)
env: WP_VERSION=latest DOCKER=true
- name: PHP unit tests
env: INSTALL_COMPOSER=true
script:
- ./bin/run-wp-unit-tests.sh
- npm run test-php && npm run test-unit-php-multisite

- name: PHP unit tests (PHP 5.6)
language: php
php: 5.6
env: WP_VERSION=latest
env: INSTALL_COMPOSER=true LOCAL_PHP=5.6-fpm
script:
- ./bin/run-wp-unit-tests.sh
if: branch = master and type != "pull_request"

- name: PHP unit tests (PHP 5.3)
env: WP_VERSION=latest SWITCH_TO_PHP=5.3
script:
- ./bin/run-wp-unit-tests.sh
if: branch = master and type != "pull_request"

- name: PHP unit tests (PHP 5.2)
env: WP_VERSION=latest SWITCH_TO_PHP=5.2
script:
- ./bin/run-wp-unit-tests.sh
- npm run test-php && npm run test-unit-php-multisite

- name: E2E tests (Admin) (1/4)
env: WP_VERSION=latest SCRIPT_DEBUG=false PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
install:
- ./bin/setup-travis-e2e-tests.sh
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: WP_VERSION=latest SCRIPT_DEBUG=false PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
install:
- ./bin/setup-travis-e2e-tests.sh
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: WP_VERSION=latest SCRIPT_DEBUG=false PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
install:
- ./bin/setup-travis-e2e-tests.sh
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: WP_VERSION=latest SCRIPT_DEBUG=false PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
install:
- ./bin/setup-travis-e2e-tests.sh
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: WP_VERSION=latest SCRIPT_DEBUG=false E2E_ROLE=author PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
install:
- ./bin/setup-travis-e2e-tests.sh
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: WP_VERSION=latest SCRIPT_DEBUG=false E2E_ROLE=author PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
install:
- ./bin/setup-travis-e2e-tests.sh
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: WP_VERSION=latest SCRIPT_DEBUG=false E2E_ROLE=author PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
install:
- ./bin/setup-travis-e2e-tests.sh
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: WP_VERSION=latest SCRIPT_DEBUG=false E2E_ROLE=author PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=
install:
- ./bin/setup-travis-e2e-tests.sh
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 )

allow_failures:
- name: JavaScript native mobile tests
- name: PHP unit tests (PHP 5.3)
env: WP_VERSION=latest SWITCH_TO_PHP=5.3
script:
- ./bin/run-wp-unit-tests.sh
if: branch = master and type != "pull_request"

- name: PHP unit tests (PHP 5.2)
env: WP_VERSION=latest SWITCH_TO_PHP=5.2
script:
- ./bin/run-wp-unit-tests.sh

before_deploy:
- npm install
Expand Down
12 changes: 0 additions & 12 deletions bin/bootstrap-env.sh

This file was deleted.

17 changes: 17 additions & 0 deletions bin/docker-compose.override.yml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
wordpress-develop:
volumes:
- %PLUGIN_MOUNT_DIR%:/var/www/${LOCAL_DIR-src}/wp-content/plugins/%PLUGIN_INSTALL_DIR%
- %PLUGIN_MOUNT_DIR%/packages/e2e-tests/plugins:/var/www/${LOCAL_DIR-src}/wp-content/plugins/gutenberg-test-plugins
- %PLUGIN_MOUNT_DIR%/packages/e2e-tests/mu-plugins:/var/www/${LOCAL_DIR-src}/wp-content/mu-plugins
php:
volumes:
- %PLUGIN_MOUNT_DIR%:/var/www/${LOCAL_DIR-src}/wp-content/plugins/%PLUGIN_INSTALL_DIR%
- %PLUGIN_MOUNT_DIR%/packages/e2e-tests/plugins:/var/www/${LOCAL_DIR-src}/wp-content/plugins/gutenberg-test-plugins
- %PLUGIN_MOUNT_DIR%/packages/e2e-tests/mu-plugins:/var/www/${LOCAL_DIR-src}/wp-content/mu-plugins
cli:
volumes:
- %PLUGIN_MOUNT_DIR%:/var/www/${LOCAL_DIR-src}/wp-content/plugins/%PLUGIN_INSTALL_DIR%
phpunit:
volumes:
- %PLUGIN_MOUNT_DIR%:/var/www/${LOCAL_DIR-src}/wp-content/plugins/%PLUGIN_INSTALL_DIR%
134 changes: 0 additions & 134 deletions bin/includes.sh

This file was deleted.

Loading

0 comments on commit 232aca6

Please sign in to comment.