forked from woocommerce/woocommerce-blocks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
158 lines (150 loc) · 4.58 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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