Skip to content

Commit 264494e

Browse files
committed
Separate test config.
1 parent 48c5a6d commit 264494e

File tree

2 files changed

+123
-11
lines changed

2 files changed

+123
-11
lines changed

.github/workflows/phpunit.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
test:
8+
runs-on: ubuntu-latest
9+
services:
10+
mysql:
11+
image: mysql:5.7
12+
env:
13+
MYSQL_ALLOW_EMPTY_PASSWORD: true
14+
MYSQL_ROOT_PASSWORD: root
15+
MYSQL_DATABASE: wordpress_test
16+
ports:
17+
- 3306:3306
18+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
19+
strategy:
20+
matrix:
21+
include:
22+
- php: 8.0
23+
wp: trunk
24+
25+
name: PHP ${{ matrix.php }} / WP ${{ matrix.wp }} Test
26+
steps:
27+
- uses: actions/checkout@v2
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@master
31+
with:
32+
tools: phpunit-polyfills, phpunit
33+
php-version: ${{ matrix.php }}
34+
extensions: mbstring, intl , mysqli
35+
ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
36+
coverage: xdebug #optional, setup coverage driver
37+
38+
- name: Check PHP Version
39+
run: php -v
40+
41+
- name: Cache composer packages
42+
uses: actions/cache@v2
43+
with:
44+
path: vendor
45+
key: composer-${{ hashFiles('composer.lock') }}
46+
47+
- name: Composer install
48+
run: composer install --optimize-autoloader --prefer-dist
49+
50+
- name: Install WP Tests
51+
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wp }} true
52+
53+
- name: Build
54+
run: |
55+
bash ./bin/build.sh
56+
57+
- name: phpunit tests
58+
run: |
59+
phpunit
60+
WP_MULTISITE=1 phpunit
61+
62+
lint:
63+
runs-on: ubuntu-latest
64+
name: PHP lint
65+
steps:
66+
- uses: actions/checkout@v2
67+
- name: Setup PHP
68+
uses: shivammathur/setup-php@v2
69+
with:
70+
php-version: 7.3
71+
extensions: mbstring, intl #optional, setup extensions
72+
ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
73+
coverage: xdebug #optional, setup coverage driver
74+
75+
- name: Check PHP Version
76+
run: php -v
77+
78+
- name: Cache composer packages
79+
uses: actions/cache@v2
80+
with:
81+
path: vendor
82+
key: composer-${{ hashFiles('composer.lock') }}
83+
84+
- name: Composer install
85+
run: composer install --optimize-autoloader --prefer-dist
86+
87+
- name: phpcs tests
88+
run: composer phpcs
89+
90+
release:
91+
name: Release
92+
runs-on: ubuntu-latest
93+
needs: [test,lint]
94+
steps:
95+
- uses: actions/checkout@v2
96+
- name: Build
97+
if: contains(github.ref, 'tags/')
98+
run: |
99+
bash ./bin/build.sh
100+
- name: WordPress Plugin Deploy
101+
if: contains(github.ref, 'tags/')
102+
uses: 10up/action-wordpress-plugin-deploy@master
103+
env:
104+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
105+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
106+
SLUG: custom-post-type-permalinks

.github/workflows/push-test-deploy.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ jobs:
1919
strategy:
2020
matrix:
2121
include:
22-
- php: '8.0'
23-
wp: trunk
2422
- php: 7.4
2523
wp: latest
24+
- php: 7.3
25+
wp: latest
26+
- php: 7.2
27+
wp: latest
2628
- php: 7.2
2729
wp: 5.7
2830
- php: 7.0
@@ -33,9 +35,8 @@ jobs:
3335
name: PHP ${{ matrix.php }} / WP ${{ matrix.wp }} Test
3436
steps:
3537
- uses: actions/checkout@v2
36-
3738
- name: Setup PHP
38-
uses: shivammathur/setup-php@master
39+
uses: shivammathur/setup-php@v2
3940
with:
4041
php-version: ${{ matrix.php }}
4142
extensions: mbstring, intl , mysqli
@@ -45,14 +46,19 @@ jobs:
4546
- name: Check PHP Version
4647
run: php -v
4748

49+
- name: Install phpunit global
50+
run: |
51+
composer global require "phpunit/phpunit=5.7.*|6.*.*|7.*.*"
52+
phpunit --version
53+
4854
- name: Cache composer packages
4955
uses: actions/cache@v2
5056
with:
5157
path: vendor
52-
key: composer-${{ hashFiles('composer.json') }}
58+
key: composer-${{ hashFiles('composer.lock') }}
5359

5460
- name: Composer install
55-
run: composer install
61+
run: composer install --optimize-autoloader --prefer-dist
5662

5763
- name: Install WP Tests
5864
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wp }} true
@@ -63,8 +69,8 @@ jobs:
6369
6470
- name: phpunit tests
6571
run: |
66-
composer test
67-
WP_MULTISITE=1 composer test
72+
phpunit
73+
WP_MULTISITE=1 phpunit
6874
6975
lint:
7076
runs-on: ubuntu-latest
@@ -74,7 +80,7 @@ jobs:
7480
- name: Setup PHP
7581
uses: shivammathur/setup-php@v2
7682
with:
77-
php-version: 7.4
83+
php-version: 7.3
7884
extensions: mbstring, intl #optional, setup extensions
7985
ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
8086
coverage: xdebug #optional, setup coverage driver
@@ -86,10 +92,10 @@ jobs:
8692
uses: actions/cache@v2
8793
with:
8894
path: vendor
89-
key: composer-${{ hashFiles('composer.json') }}
95+
key: composer-${{ hashFiles('composer.lock') }}
9096

9197
- name: Composer install
92-
run: composer install
98+
run: composer install --optimize-autoloader --prefer-dist
9399

94100
- name: phpcs tests
95101
run: composer phpcs

0 commit comments

Comments
 (0)