-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (60 loc) · 2.32 KB
/
test.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
name: Test
on:
pull_request:
branches:
- main
jobs:
php_unit:
name: php unit test
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1','8.0','7.4']
wp-versions: ['6.2','6.1']
services:
mysql:
image: mysql:5.7
ports:
- 3306
env:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
steps:
- uses: actions/checkout@v3
- name: Read .node-version
run: echo "{NODEVERSION}={$(cat .node-version)}" >> $GITHUB_OUTPUT
id: nodenv
- name: Setup Node.js (.node-version)
uses: actions/setup-node@v3
with:
node-version: '${{ steps.nodenv.outputs.NODEVERSION }}'
- name: Cache multiple paths
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: install npm scripts
run: npm install
- name: Install Composer Packages
run: composer install
- name: Install WP-CLI
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
- name: Build
run: npm run build
- name: Install several WordPress version by wp-env.override.json
run: WP_ENV_PHP_VERSION=${{ matrix.php-versions }} WP_ENV_CORE=WordPress/WordPress#${{ matrix.wp-versions }} npm run wp-env start --update
- name: Check WordPress Version
run: npm run wp-env run cli wp core version
- name: Start Environment
run: npx wp-env start && sudo chmod -R 777 ~/wp-env
- name: Run PHP Unit Test
run: npm run phpunit