-
Notifications
You must be signed in to change notification settings - Fork 3
141 lines (124 loc) · 3.89 KB
/
tests-e2e.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
name: E2E Tests
on:
push:
# Don't run for irrelevant changes.
paths-ignore:
- 'docs/**'
- '!.github/workflows/tests-e2e.yml'
- '.storybook/**'
- '.wordpress-org/**'
- '__mocks__/**'
- '__static__/**'
- 'readme.txt'
branches:
- main
- release/*
pull_request:
# Don't run for irrelevant changes.
paths-ignore:
- 'docs/**'
- '!.github/workflows/tests-e2e.yml'
- '.storybook/**'
- '.wordpress-org/**'
- '__mocks__/**'
- '__static__/**'
- 'readme.txt'
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
e2e:
name: '${{ matrix.browser }} - WP ${{ matrix.wp }}'
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
# TODO: add back Firefox once support is more mature.
include:
- browser: 'chrome'
wp: 'latest'
snapshots: true
- browser: 'chrome'
wp: '5.3.6'
snapshots: false
steps:
- name: Cancel previous
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2
# See https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
- name: Install libgbm1
run: sudo apt-get install libgbm1
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Setup Node
uses: actions/[email protected]
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Cache node modules
uses: pat-s/[email protected]
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
env:
cache-name: cache-node-modules
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer:v2.1.1
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Setup Composer cache
uses: pat-s/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
${{ runner.os }}-
# TODO: Remove need for `npm install puppeteer`.
- name: Install dependencies
run: |
npm ci
npm install puppeteer
composer install --prefer-dist --no-progress --no-interaction
env:
CI: true
PUPPETEER_PRODUCT: ${{ matrix.browser }}
- name: Build plugin
run: npm run build:js
env:
# TODO: remove eventually
DISABLE_PREVENT: true
DISABLE_QUICK_TIPS: true
- name: Start Docker environment
run: npm run env:start
env:
COMPOSE_INTERACTIVE_NO_CLI: true
WP_VERSION: ${{ matrix.wp }}
- name: Run E2E tests with percy
run: npm run test:e2e:percy
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_E2E }}
if: ( matrix.snapshots ) && ( github.event.pull_request.draft == false )
- name: Run E2E tests
run: npm run test:e2e
if: ( ! matrix.snapshots ) || ( github.event.pull_request.draft == true )
- name: Stop Docker environment
run: npm run env:stop
if: always()
env:
COMPOSE_INTERACTIVE_NO_CLI: true