-
Notifications
You must be signed in to change notification settings - Fork 64
155 lines (128 loc) · 3.94 KB
/
run-tests.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
name: Tests
on:
pull_request:
branches:
- master
jobs:
php:
name: PHP Unit
runs-on: ubuntu-latest
strategy:
matrix:
phpVersion: ["7.4", "8.3"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Setup WP-CLI
uses: godaddy-wordpress/setup-wp-cli@1
- name: Install dependencies and build
run: |
npm i -g yarn
composer install
yarn install --immutable
yarn build
- name: Setup wp-env
uses: godaddy-wordpress/setup-wp-env@v1
with:
core: 'WordPress/WordPress#6.5'
phpVersion: ${{ matrix.phpVersion }}
plugins: '["https://downloads.wordpress.org/plugin/coblocks.zip","https://downloads.wordpress.org/plugin/woocommerce.zip"]'
themes: '["."]'
- name: Run tests
run: |
wp-env run tests-wordpress /var/www/html/wp-content/themes/go/vendor/bin/phpunit -c /var/www/html/wp-content/themes/go/phpunit.xml --verbose
js:
name: JS Unit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Run tests
run: yarn run test:js
a11y:
name: Accessibility
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup wp-env
uses: godaddy-wordpress/setup-wp-env@v1
with:
core: 'WordPress/WordPress#6.5'
phpVersion: '8.3'
plugins: '["https://downloads.wordpress.org/plugin/coblocks.zip","https://downloads.wordpress.org/plugin/woocommerce.zip"]'
themes: '["."]'
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Setup WP-CLI
uses: godaddy-wordpress/setup-wp-cli@1
- name: Install dependencies and build
run: |
npm i -g yarn
composer install
yarn install --immutable
yarn build
- name: Prepare tests
run: |
wp-env run cli wp db import wp-content/themes/go/.dev/tests/a11y-test-db.sql
- name: Run tests
run: |
A11Y=$(yarn test:a11y)
echo "$A11Y"
if [[ $A11Y != *"All accessibility tests have passed"* ]]; then
exit 1
fi
e2e:
name: Customizer E2E
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup wp-env
uses: godaddy-wordpress/setup-wp-env@v1
with:
core: 'WordPress/WordPress#6.5'
phpVersion: '8.3'
plugins: '["https://downloads.wordpress.org/plugin/coblocks.zip","https://downloads.wordpress.org/plugin/woocommerce.zip"]'
themes: '["."]'
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Setup WP-CLI
uses: godaddy-wordpress/setup-wp-cli@1
- name: Install dependencies and build
run: |
npm i -g yarn
composer install
yarn install --immutable
yarn build
- name: Prepare tests
run: |
wp-env run cli wp theme activate go
wp-env run cli wp option update permalink_structure '/%postname%'
- name: Run tests
run: yarn test:e2e:customizer -- --record
- name: Upload failure video
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: customizer.spec.js.mp4
path: ./.dev/tests/cypress/videos/**/*.mp4
retention-days: 1