2020-06-17 20:28:11 +00:00
|
|
|
language: generic
|
2018-11-27 17:12:48 +00:00
|
|
|
|
2020-06-17 20:28:11 +00:00
|
|
|
services:
|
|
|
|
- docker
|
2018-11-27 17:12:48 +00:00
|
|
|
|
2019-07-01 12:52:44 +00:00
|
|
|
cache:
|
2020-01-02 09:51:17 +00:00
|
|
|
directories:
|
2020-06-17 20:28:11 +00:00
|
|
|
- $HOME/.jest-cache
|
|
|
|
- $HOME/.nvm/.cache
|
2020-01-02 09:51:17 +00:00
|
|
|
- $HOME/.npm
|
|
|
|
- $HOME/.composer/cache
|
2018-11-27 17:12:48 +00:00
|
|
|
|
2019-12-11 15:04:25 +00:00
|
|
|
branches:
|
2020-01-02 09:51:17 +00:00
|
|
|
only:
|
2020-06-16 09:38:19 +00:00
|
|
|
- main
|
2019-12-11 15:04:25 +00:00
|
|
|
|
2020-06-17 20:28:11 +00:00
|
|
|
# Make sure NodeGit gets the correct C libs.
|
|
|
|
addons:
|
|
|
|
apt:
|
|
|
|
sources:
|
|
|
|
- ubuntu-toolchain-r-test
|
|
|
|
packages:
|
|
|
|
- libstdc++-4.9-dev
|
|
|
|
|
2019-07-01 12:52:44 +00:00
|
|
|
before_install:
|
2020-01-02 09:51:17 +00:00
|
|
|
- timedatectl
|
|
|
|
- nvm install --latest-npm
|
2020-06-17 20:28:11 +00:00
|
|
|
- |
|
|
|
|
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
|
2019-07-01 12:52:44 +00:00
|
|
|
|
|
|
|
before_script:
|
2020-01-02 09:51:17 +00:00
|
|
|
- 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
|
|
|
|
- |
|
2020-06-17 20:28:11 +00:00
|
|
|
if [[ ! -z "$PHP_UNIT" ]]; then
|
|
|
|
composer install
|
|
|
|
fi
|
|
|
|
- |
|
|
|
|
if [[ ! -z "$E2E_TESTS" ]]; then
|
2020-01-02 09:51:17 +00:00
|
|
|
composer install --no-dev
|
2020-06-17 20:28:11 +00:00
|
|
|
npm ci
|
|
|
|
if [[ ! -z "$GUTENBERG_LATEST" ]]; then
|
|
|
|
JSON='{"config": { "SCRIPT_DEBUG": false } }'
|
|
|
|
else
|
|
|
|
JSON='{"core": "WordPress/WordPress#'"$WP_VERSION"'", "config": { "SCRIPT_DEBUG": false } }'
|
|
|
|
fi
|
|
|
|
echo $JSON > .wp-env.override.json
|
|
|
|
npm run build:e2e-test
|
|
|
|
chmod -R 767 ./
|
|
|
|
npm run wp-env start
|
2020-01-02 09:51:17 +00:00
|
|
|
fi
|
|
|
|
- |
|
2020-06-17 20:28:11 +00:00
|
|
|
if [[ "$WP_TRAVISCI" == "phpcs" ]]; then
|
2020-01-02 09:51:17 +00:00
|
|
|
composer install
|
|
|
|
fi
|
2020-02-11 16:13:20 +00:00
|
|
|
|
2019-08-09 18:08:31 +00:00
|
|
|
jobs:
|
|
|
|
fast_finish: true
|
|
|
|
include:
|
|
|
|
- stage: build tests
|
|
|
|
name: PHP 7.1/unit-tests/Latest WP
|
|
|
|
php: 7.1
|
|
|
|
env:
|
2020-01-02 09:51:17 +00:00
|
|
|
- WP_VERSION=latest
|
2020-06-05 19:13:51 +00:00
|
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
2020-06-17 20:28:11 +00:00
|
|
|
- PHP_UNIT=1
|
2019-08-09 18:08:31 +00:00
|
|
|
script:
|
2020-06-17 20:28:11 +00:00
|
|
|
- npm run phpunit
|
2019-08-09 18:08:31 +00:00
|
|
|
- name: PHP 5.6/unit-tests/Latest WP
|
|
|
|
php: 5.6
|
|
|
|
env:
|
2020-01-02 09:51:17 +00:00
|
|
|
- WP_VERSION=latest
|
2020-06-05 19:13:51 +00:00
|
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
2020-06-17 20:28:11 +00:00
|
|
|
- PHP_UNIT=1
|
2019-08-09 18:08:31 +00:00
|
|
|
script:
|
2020-06-17 20:28:11 +00:00
|
|
|
- npm run phpunit
|
2019-08-09 18:08:31 +00:00
|
|
|
- name: PHP Linting Check
|
2020-02-14 20:16:58 +00:00
|
|
|
php: 7.3
|
2019-08-09 18:08:31 +00:00
|
|
|
env:
|
2020-01-02 09:51:17 +00:00
|
|
|
- WP_TRAVISCI=phpcs
|
2020-06-05 19:13:51 +00:00
|
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
2019-08-09 18:08:31 +00:00
|
|
|
script:
|
2020-01-02 09:51:17 +00:00
|
|
|
- npm run lint:php
|
2019-08-09 18:08:31 +00:00
|
|
|
- name: Javascript Tests
|
|
|
|
script:
|
2020-01-02 09:51:17 +00:00
|
|
|
- npm install
|
|
|
|
- npm run test
|
2020-01-31 20:04:37 +00:00
|
|
|
env:
|
2020-06-05 19:13:51 +00:00
|
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
2020-03-21 16:10:53 +00:00
|
|
|
- name: Javascript/CSS Lint check
|
2019-08-09 18:08:31 +00:00
|
|
|
script:
|
2020-01-02 09:51:17 +00:00
|
|
|
- npm install
|
2020-03-21 16:10:53 +00:00
|
|
|
- npm run lint:ci
|
2020-01-31 20:04:37 +00:00
|
|
|
env:
|
2020-06-05 19:13:51 +00:00
|
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
2020-06-16 12:18:34 +00:00
|
|
|
- name: E2E Tests (WP 5.2)
|
2020-02-11 16:13:20 +00:00
|
|
|
script:
|
2020-02-14 20:16:58 +00:00
|
|
|
- npm run test:e2e
|
2020-02-11 16:13:20 +00:00
|
|
|
env:
|
2020-06-16 12:18:34 +00:00
|
|
|
- WP_VERSION=5.2
|
2020-06-17 20:28:11 +00:00
|
|
|
- E2E_TESTS=1
|
2020-06-16 12:18:34 +00:00
|
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
|
|
|
- name: E2E Tests (WP 5.3)
|
|
|
|
script:
|
|
|
|
- npm run test:e2e
|
|
|
|
env:
|
|
|
|
- WP_VERSION=5.3
|
2020-06-17 20:28:11 +00:00
|
|
|
- E2E_TESTS=1
|
2020-06-16 12:18:34 +00:00
|
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
|
|
|
- name: E2E Tests (WP 5.4)
|
|
|
|
script:
|
|
|
|
- npm run test:e2e
|
|
|
|
env:
|
|
|
|
- WP_VERSION=5.4
|
2020-06-17 20:28:11 +00:00
|
|
|
- E2E_TESTS=1
|
2020-06-16 12:18:34 +00:00
|
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
|
|
|
- name: E2E Tests (WP 5.4 with Gutenberg plugin)
|
|
|
|
script:
|
2020-06-17 20:28:11 +00:00
|
|
|
- npm run wp-env run tests-cli "wp plugin install gutenberg --activate"
|
2020-06-16 12:18:34 +00:00
|
|
|
- npm install @wordpress/e2e-test-utils@latest
|
2020-06-17 20:28:11 +00:00
|
|
|
- chmod -R 767 ./
|
2020-06-16 12:18:34 +00:00
|
|
|
- npm run test:e2e
|
|
|
|
env:
|
|
|
|
- WP_VERSION=5.4
|
2020-06-17 20:28:11 +00:00
|
|
|
- E2E_TESTS=1
|
2020-06-16 12:18:34 +00:00
|
|
|
- GUTENBERG_LATEST=true
|
2020-06-05 19:13:51 +00:00
|
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
2020-03-22 15:40:42 +00:00
|
|
|
- stage: deploy
|
2020-06-16 09:38:19 +00:00
|
|
|
if: (NOT type IN (pull_request)) AND (branch = main)
|
2020-03-22 15:40:42 +00:00
|
|
|
name: Deploy Storybook
|
|
|
|
env:
|
2020-06-05 19:13:51 +00:00
|
|
|
- WOOCOMMERCE_BLOCKS_PHASE=3
|
2020-03-22 15:40:42 +00:00
|
|
|
install:
|
|
|
|
- npm ci
|
2020-03-22 16:31:57 +00:00
|
|
|
script:
|
2020-03-22 15:40:42 +00:00
|
|
|
- npm run storybook:build
|
|
|
|
deploy:
|
|
|
|
provider: pages
|
2020-03-22 16:31:57 +00:00
|
|
|
skip_cleanup: true
|
2020-03-22 15:40:42 +00:00
|
|
|
github_token: $GITHUB_TOKEN
|
|
|
|
keep_history: true
|
|
|
|
local_dir: storybook/dist
|
|
|
|
on:
|
2020-06-16 09:38:19 +00:00
|
|
|
branch: main
|