-
Notifications
You must be signed in to change notification settings - Fork 22
204 lines (170 loc) · 5.95 KB
/
lint-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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: Coding Standards and Tests
on:
push:
branches:
- master
- develop
pull_request:
jobs:
lint:
name: "Coding Standards"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "14"
- name: Install dependencies
run: npm ci
- name: Run coding standards check
run: npm run lint
test-e2e:
needs: [lint]
name: "E2E tests (PHP ${{ matrix.php_versions }}, WordPress ${{ matrix.wp_versions }})"
runs-on: ubuntu-latest
timeout-minutes: 30
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
php_versions: [7.4]
wp_versions: [5.9, 6.0]
include:
- php_versions: 7.3
wp_versions: 5.9
env:
NODE_ENV: teste2e
WP_VERSION: ${{ matrix.wp_versions }}
PHP_VERSION: php${{ matrix.php_versions }}-apache
WORDPRESS_DEBUG: 0
steps:
- uses: actions/checkout@v2
- uses: hmarr/debug-action@v2
- uses: actions/setup-node@v1
with:
node-version: "14"
- name: Install dependencies
run: npm ci
- name: Build assets
run: npm run build:js
- name: Sleep for 10 seconds
uses: jakejarvis/wait-action@master
with:
time: '10s'
- uses: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
with:
key: image-${{ matrix.php_versions }}-${{ matrix.wp_versions }}-{hash}
- name: Start docker local env
run: |
npm run env:start
docker-compose exec -T wordpress bash -c "chown -R www-data:www-data /var/www/html/wp-content/" # ensure WP folders have correct permissions
docker-compose exec -T mysql bash -c "chown -R mysql:mysql /var/lib/mysql"
- name: Docker containers debug information
run: |
docker ps -a
- name: Sleep for 10 seconds
uses: jakejarvis/wait-action@master
with:
time: '10s'
- name: Install WordPress
run: |
npm run wp -- wp core install --title=WordPress --admin_user=admin --admin_password=password [email protected] --skip-email --url=http://localhost:8088 --quiet
npm run wp -- wp plugin activate material-design
- name: Run E2E tests with coverage
run: |
sudo chown -R runner:runner plugin/tests node_modules # ensure coverage folder can be created
npm run test:e2e:coverage
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./plugin/tests/coverage/e2e/lcov.info
flag-name: "E2E Tests"
parallel: true
test-js:
needs: [lint]
name: "JS unit tests (with code coverage)"
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "14"
- name: Install dependencies
run: npm ci
- name: Run JS tests
run: npm run test:js:coverage
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./plugin/tests/coverage/js/lcov.info
flag-name: "JS Unit Tests"
parallel: true
test-php:
needs: [lint]
name: "PHP tests (PHP ${{ matrix.php_versions }}, WordPress ${{ matrix.wp_versions }})"
timeout-minutes: 20
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
php_versions: [7.4, 7.3, 7.2, 7.1]
wp_versions: ["latest"]
os: [ubuntu-latest]
include:
- php_versions: 7.4
wp_versions: "trunk"
os: ubuntu-latest
experimental: true
- php_versions: "7.0"
wp_versions: "latest"
os: ubuntu-18.04 # Use ubuntu-18.4 which has MySQL 5.7 for back-compat < PHP7.0
- php_versions: 5.6.20
wp_versions: "latest"
os: ubuntu-18.04
env:
WP_VERSION: ${{ matrix.wp_versions }}
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS: ${{ matrix.php_versions == 7.4 && matrix.wp_versions == 'latest' }}
PROJECT_TYPE: plugin
steps:
- uses: actions/checkout@v2
- name: Setup PHP ${{ matrix.php_versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_versions }}
tools: phpunit
- name: Start MySQL
run: |
sudo systemctl enable mysql.service
sudo systemctl start mysql.service
- name: Install dependencies
run: composer install
- name: Copy block.json files
run: for file in ./plugin/assets/src/block-editor/blocks/*/block.json; do dest="${file/.\/plugin\/assets\/src\/block-editor\//./plugin/assets/js/}"; mkdir -p `dirname $dest`; cp $file $dest; done
- name: Install and Run tests
if: ${{ matrix.php_versions == '7.0' || matrix.php_versions == '5.6.20' }}
run: |
wget -O bin/phpunit https://phar.phpunit.de/phpunit-5.phar
chmod +x bin/phpunit
source bin/php-tests.sh wordpress_test root root localhost false bin/phpunit
- name: Install and Run tests
if: ${{ matrix.php_versions != '7.0' && matrix.php_versions != '5.6.20' }}
run: source bin/php-tests.sh wordpress_test root root localhost
finish:
needs: [test-e2e, test-js, test-php]
name: Finish
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true