Skip to content

Commit df7d116

Browse files
authored
Merge pull request #59 from t-hamano/dev/multiple-version-actions
Use matrix on GitHub Actions
2 parents 670e159 + 8aa5db4 commit df7d116

File tree

10 files changed

+197
-254
lines changed

10 files changed

+197
-254
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ trim_trailing_whitespace = true
88
indent_style = tab
99
indent_size = 2
1010

11+
[*.{yml,yaml}]
12+
indent_style = space
13+
indent_size = 2
14+
1115
[*.md]
1216
trim_trailing_whitespace = false

.github/workflows/run-test-and-deploy.yml

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,64 @@
1-
name: Tests and Deploy
1+
name: Test and Deploy
22

33
on:
44
push:
5+
branches-ignore:
6+
- '**'
57
tags:
6-
- "*"
8+
- '*'
79

810
jobs:
9-
10-
lint:
11-
name: Lint
11+
test:
1212
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
php-versions: [ '7.3', '7.4', '8.0' ]
16+
wp-versions: [ 'WordPress#5.9', 'WordPress#6.0' ]
17+
# wp-versions: [ 'WordPress#5.9', 'WordPress#6.0', 'WordPress' ]
18+
name: PHP ${{ matrix.php-versions }} / ${{ matrix.wp-versions }} Test
19+
1320
steps:
1421
- uses: actions/checkout@v3
15-
- uses: actions/setup-node@v3
22+
23+
- name: Use Node.js 14.x
24+
uses: actions/setup-node@v3
1625
with:
17-
node-version: 14.x
26+
node-version: '14'
1827

1928
- name: Npm install and build
2029
run: |
2130
npm ci
2231
npm run build
2332
24-
- name: Composer install
25-
run: composer install
26-
27-
- name: Set phpcs
28-
run: composer phpcs
33+
- name: Composer install and set phpcs
34+
run: |
35+
composer install
36+
composer phpcs
2937
30-
- name: Running the tests
38+
- name: Running lint check
3139
run: npm run lint
3240

33-
e2e-tests:
34-
name: E2E Tests
35-
runs-on: ubuntu-latest
36-
steps:
37-
- uses: actions/checkout@v3
38-
- uses: actions/setup-node@v3
39-
with:
40-
node-version: 14.x
41-
42-
- name: Npm install and build
43-
run: |
44-
npm ci
45-
npm run build
46-
4741
- name: Install WordPress
4842
run: |
49-
npm run wp-env start
43+
WP_ENV_CORE=WordPress/${{ matrix.wp-versions }} WP_ENV_PHP_VERSION=${{ matrix.php-versions }} npm run wp-env start
44+
npm run wp-env run cli wp core version
45+
npm run wp-env run cli wp cli info
5046
51-
- name: Running the tests
52-
run: |
53-
npm run test:e2e
47+
- name: Running e2e tests
48+
run: npm run test:e2e
5449

5550
deploy:
5651
name: Deploy to WP.org
5752
runs-on: ubuntu-latest
58-
needs: [lint, e2e-tests]
53+
needs: [ test ]
5954
steps:
6055
- name: Checkout
6156
uses: actions/checkout@main
62-
- uses: actions/setup-node@v3
57+
58+
- name: Use Node.js 14.x
59+
uses: actions/setup-node@v3
6360
with:
64-
node-version: 14.x
61+
node-version: '14'
6562

6663
- name: Npm install and build
6764
run: |

.github/workflows/run-test.yml

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,51 @@
1-
name: Tests
1+
name: Test
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
tags-ignore:
6+
- '**'
7+
branches:
8+
- '*'
69
pull_request:
7-
branches: [ main, develop ]
10+
branches:
11+
- '*'
812

913
jobs:
10-
11-
lint:
12-
name: Lint
14+
test:
1315
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
php-versions: [ '7.3', '7.4', '8.0' ]
19+
wp-versions: [ 'WordPress#5.9', 'WordPress#6.0' ]
20+
# wp-versions: [ 'WordPress#5.9', 'WordPress#6.0', 'WordPress' ]
21+
name: PHP ${{ matrix.php-versions }} / ${{ matrix.wp-versions }} Test
22+
1423
steps:
1524
- uses: actions/checkout@v3
16-
- uses: actions/setup-node@v3
25+
26+
- name: Use Node.js 14.x
27+
uses: actions/setup-node@v3
1728
with:
18-
node-version: 14.x
29+
node-version: '14'
1930

2031
- name: Npm install and build
2132
run: |
2233
npm ci
2334
npm run build
2435
25-
- name: Composer install
26-
run: composer install
27-
28-
- name: Set phpcs
29-
run: composer phpcs
36+
- name: Composer install and set phpcs
37+
run: |
38+
composer install
39+
composer phpcs
3040
31-
- name: Running the tests
41+
- name: Running lint check
3242
run: npm run lint
3343

34-
e2e-tests:
35-
name: E2E Tests
36-
runs-on: ubuntu-latest
37-
steps:
38-
- uses: actions/checkout@v3
39-
- uses: actions/setup-node@v3
40-
with:
41-
node-version: 14.x
42-
43-
- name: Npm install and build
44-
run: |
45-
npm ci
46-
npm run build
47-
4844
- name: Install WordPress
4945
run: |
50-
npm run wp-env start
46+
WP_ENV_CORE=WordPress/${{ matrix.wp-versions }} WP_ENV_PHP_VERSION=${{ matrix.php-versions }} npm run wp-env start
47+
npm run wp-env run cli wp core version
48+
npm run wp-env run cli wp cli info
5149
52-
- name: Running the tests
53-
run: |
54-
npm run test:e2e
50+
- name: Running e2e tests
51+
run: npm run test:e2e

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.vscode
2+
artifacts/
23
build/
34
node_modules/
45
vendor/
56
.wp-env.override.json
6-
artifacts/

.wp-env.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
2-
"plugins": [ "." ],
2+
"plugins": [
3+
".",
4+
"https://downloads.wordpress.org/plugin/classic-editor.zip"
5+
],
36
"config": {
47
"WP_DEBUG": true
58
}

0 commit comments

Comments
 (0)