Skip to content

Commit 8354a14

Browse files
committed
Add workflow to run tests
1 parent 9682b4a commit 8354a14

2 files changed

Lines changed: 52 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Run Plugin Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php-version: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
16+
wp-version: [ '6.0', '6.1', '6.2', '6.3', '6.4', '6.5', '6.6' ]
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '22'
25+
26+
- name: Set up PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: '7.4'
30+
31+
- name: Install npm dependencies
32+
run: npm ci
33+
34+
- name: Install Composer dependencies
35+
run: composer install --prefer-dist --no-interaction --no-progress
36+
37+
- name: Write .wp-env.override.json
38+
run: |
39+
echo '{' > .wp-env.override.json
40+
echo ' "core": "WordPress/WordPress#${{ matrix.wp-version }}",' >> .wp-env.override.json
41+
echo ' "phpVersion": "${{ matrix.php-version }}"' >> .wp-env.override.json
42+
echo '}' >> .wp-env.override.json
43+
44+
- name: Run wp-env and PHPUnit tests
45+
run: |
46+
npm run start:env
47+
npm run test
48+
49+
- name: Stop wp-env
50+
if: always()
51+
run: npm run stop:env

.wp-env.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"core": "WordPress/WordPress#6.0",
2+
"core": null,
33
"plugins": ["."],
44
"phpVersion": "7.4",
55
"config": {

0 commit comments

Comments
 (0)