159 lines
4.6 KiB
YAML
159 lines
4.6 KiB
YAML
language: generic
|
|
|
|
services:
|
|
- docker
|
|
|
|
cache:
|
|
directories:
|
|
- $HOME/.jest-cache
|
|
- $HOME/.nvm/.cache
|
|
- $HOME/.npm
|
|
- $HOME/.composer/cache
|
|
|
|
branches:
|
|
only:
|
|
- trunk
|
|
|
|
# Make sure NodeGit gets the correct C libs.
|
|
addons:
|
|
apt:
|
|
sources:
|
|
- ubuntu-toolchain-r-test
|
|
packages:
|
|
- libstdc++-4.9-dev
|
|
|
|
before_install:
|
|
- timedatectl
|
|
- nvm install --latest-npm
|
|
- |
|
|
if [[ ! -z "$E2E_TESTS" ]]; 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
|
|
|
|
before_script:
|
|
- export PATH="$HOME/.composer/vendor/bin:$PATH"
|
|
- |
|
|
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
|
|
phpenv config-rm xdebug.ini
|
|
else
|
|
echo "xdebug.ini does not exist"
|
|
fi
|
|
- |
|
|
if [[ ! -z "$PHP_UNIT" ]]; then
|
|
composer install
|
|
fi
|
|
- |
|
|
if [[ ! -z "$E2E_TESTS" ]]; then
|
|
composer install --no-dev
|
|
npm ci
|
|
if [[ ! -z "$GUTENBERG_LATEST" ]]; then
|
|
JSON='{"config": { "SCRIPT_DEBUG": false, "JETPACK_AUTOLOAD_DEV": true } }'
|
|
else
|
|
JSON='{"core": "WordPress/WordPress#'"$WP_VERSION"'", "config": { "SCRIPT_DEBUG": false, "JETPACK_AUTOLOAD_DEV": true } }'
|
|
fi
|
|
echo $JSON > .wp-env.override.json
|
|
npm run build:e2e-test
|
|
chmod -R 767 ./
|
|
npm run wp-env start
|
|
fi
|
|
- |
|
|
if [[ "$WP_TRAVISCI" == "phpcs" ]]; then
|
|
composer install
|
|
fi
|
|
|
|
jobs:
|
|
fast_finish: true
|
|
include:
|
|
- stage: build tests
|
|
name: PHP 7.1/unit-tests/Latest WP
|
|
php: 7.1
|
|
env:
|
|
- WP_VERSION=latest
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
|
- PHP_UNIT=1
|
|
script:
|
|
- echo 'woocommerce_blocks_phase = 3' > blocks.ini
|
|
- npm run phpunit
|
|
- name: PHP 5.6/unit-tests/Latest WP
|
|
php: 5.6
|
|
env:
|
|
- WP_VERSION=latest
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
|
- PHP_UNIT=1
|
|
script:
|
|
- echo 'woocommerce_blocks_phase = 3' > blocks.ini
|
|
- npm run phpunit
|
|
- name: Javascript Tests
|
|
script:
|
|
- npm install
|
|
- npm run test
|
|
env:
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
|
- name: E2E Tests (WP 5.3)
|
|
script:
|
|
- npm run test:e2e
|
|
env:
|
|
- WP_VERSION=5.3
|
|
- E2E_TESTS=1
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
|
- name: E2E Tests (WP 5.4)
|
|
script:
|
|
- npm run test:e2e
|
|
env:
|
|
- WP_VERSION=5.4
|
|
- E2E_TESTS=1
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
|
- name: E2E Tests (WP 5.5)
|
|
script:
|
|
- npm run test:e2e
|
|
env:
|
|
- WP_VERSION=5.5
|
|
- E2E_TESTS=1
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
|
- name: E2E Tests (WP 5.5 with Gutenberg plugin)
|
|
script:
|
|
- npm run wp-env run tests-cli "wp plugin install gutenberg --activate"
|
|
- npm install @wordpress/e2e-test-utils@latest
|
|
- chmod -R 767 ./
|
|
- npm run test:e2e
|
|
env:
|
|
- WP_VERSION=5.5
|
|
- E2E_TESTS=1
|
|
- GUTENBERG_LATEST=true
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
|
- stage: deploy
|
|
if: (NOT type IN (pull_request)) AND (branch = trunk)
|
|
name: Deploy Storybook
|
|
env:
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
|
install:
|
|
- npm ci
|
|
script:
|
|
- npm run storybook:build
|
|
deploy:
|
|
provider: pages
|
|
skip_cleanup: true
|
|
github_token: $GITHUB_TOKEN
|
|
keep_history: true
|
|
local_dir: storybook/dist
|
|
on:
|
|
branch: trunk
|
|
# @TODO: Investigate why is WP 5.4 + GB e2e test failing and don't allow it to fail.
|
|
allow_failures:
|
|
- name: E2E Tests (WP 5.5 with Gutenberg plugin)
|
|
script:
|
|
- npm run wp-env run tests-cli "wp plugin install gutenberg --activate"
|
|
- npm install @wordpress/e2e-test-utils@latest
|
|
- chmod -R 767 ./
|
|
- npm run test:e2e
|
|
env:
|
|
- WP_VERSION=5.5
|
|
- E2E_TESTS=1
|
|
- GUTENBERG_LATEST=true
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
|
|