Skip to content

Commit 7f7808f

Browse files
authored
Ci updates with plugin tests (#137)
- Now runs each plugin individually to catch any issues in the plugins composer.json - Moves coverage report into its own jobs
1 parent bf97b60 commit 7f7808f

File tree

11 files changed

+231
-40
lines changed

11 files changed

+231
-40
lines changed

.github/workflows/pull-request.yml

Lines changed: 78 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
php-versions: ['8.0', '8.1', '8.2']
11+
php-versions: ['8.1', '8.2']
1212

13-
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
13+
name: Test PHP ${{ matrix.php-versions }}
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v2
@@ -21,7 +21,6 @@ jobs:
2121
php-version: ${{ matrix.php-versions }}
2222
extensions: mbstring, intl, sqlite3, xml, simplexml, mysqli
2323
tools: composer:v2
24-
coverage: xdebug
2524

2625
- name: Matrix PHP Version
2726
run: |
@@ -37,33 +36,59 @@ jobs:
3736
cp config/.env.example config/.env
3837
cp config/app_local.example.php config/app_local.php
3938
40-
- name: Test Suite + Static Analysis (PHP 8.0)
41-
if: ${{ matrix.php-versions == '8.0' }}
39+
- name: Test Suite + Static Analysis
40+
if: ${{ matrix.php-versions}}
4241
run: |
4342
composer analyze
4443
45-
- name: Upload coverage results to Coveralls (PHP 8.0)
46-
if: ${{ matrix.php-versions == '8.0' }}
44+
#
45+
# Run coverage report
46+
#
47+
coverage:
48+
runs-on: ubuntu-latest
49+
strategy:
50+
matrix:
51+
php-versions: ['8.1']
52+
53+
name: Coverage Report
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v2
57+
58+
- name: Setup PHP
59+
uses: shivammathur/setup-php@v2
60+
with:
61+
php-version: ${{ matrix.php-versions }}
62+
extensions: mbstring, intl, sqlite3, xml, simplexml, mysqli
63+
tools: composer:v2
64+
coverage: xdebug
65+
66+
- name: Composer Check
67+
run: composer validate
68+
69+
- name: Install
70+
run: |
71+
composer install --prefer-dist --no-interaction --no-progress
72+
cp config/.env.example config/.env
73+
cp config/app_local.example.php config/app_local.php
74+
75+
- name: Coverage Report
4776
env:
4877
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4978
run: |
5079
composer global require php-coveralls/php-coveralls
5180
export CODECOVERAGE=1 && vendor/bin/phpunit --verbose --coverage-clover=clover.xml
5281
php-coveralls --coverage_clover=clover.xml -v
5382
54-
- name: Test Suite (PHP 8.1)
55-
if: ${{ matrix.php-versions == '8.1' }}
56-
run: |
57-
composer test
58-
5983
#
6084
# CakePHP version compatability
6185
#
62-
compatibility:
86+
cakephp:
6387
runs-on: ubuntu-latest
6488
strategy:
6589
matrix:
66-
version: ['~4.2.0', '~4.3.0', '^4.4']
90+
version: ['^4.4']
91+
name: Test CakePHP ${{ matrix.version }}
6792
steps:
6893
- name: Checkout
6994
uses: actions/checkout@v2
@@ -74,9 +99,6 @@ jobs:
7499
php-version: '8.1'
75100
extensions: mbstring, intl, sqlite3, xml, simplexml, mysqli
76101

77-
- name: PHP Version
78-
run: php -v
79-
80102
- name: CakePHP ${{matrix.version}} Compatability
81103
run: |
82104
cp config/.env.example config/.env
@@ -85,3 +107,42 @@ jobs:
85107
composer require cakephp/cakephp:${{matrix.version}} --no-update
86108
composer install --prefer-dist --no-progress
87109
composer test
110+
111+
#
112+
# Test plugins individually
113+
#
114+
plugins:
115+
runs-on: ubuntu-latest
116+
strategy:
117+
matrix:
118+
plugin: [
119+
'bake',
120+
'core',
121+
'collection-view',
122+
'crud',
123+
'exception-render',
124+
'hal-view',
125+
'json-ld-view',
126+
'jwt-auth'
127+
]
128+
name: Test ${{ matrix.plugin }}
129+
steps:
130+
- name: Checkout
131+
uses: actions/checkout@v2
132+
133+
- name: Setup PHP
134+
uses: shivammathur/setup-php@v2
135+
with:
136+
php-version: '8.1'
137+
extensions: mbstring, intl, sqlite3, xml, simplexml, mysqli
138+
139+
- name: PHP Version
140+
run: php -v
141+
142+
- name: ${{matrix.plugin}} tests
143+
run: |
144+
cp config/.env.example config/.env
145+
cp plugins/${{matrix.plugin}}/composer.json .
146+
rm -rf composer.lock
147+
composer install
148+
vendor/bin/phpunit plugins/${{matrix.plugin}}

composer.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
"MixerApi\\ExceptionRender\\": "plugins/exception-render/src/",
5454
"MixerApi\\HalView\\": "plugins/hal-view/src/",
5555
"MixerApi\\JsonLdView\\": "plugins/json-ld-view/src/",
56-
"MixerApi\\JwtAuth\\": "plugins/jwt-auth/src/",
57-
"MixerApi\\Rest\\": "plugins/rest/src/"
56+
"MixerApi\\JwtAuth\\": "plugins/jwt-auth/src/"
5857
}
5958
},
6059
"autoload-dev": {
@@ -73,15 +72,12 @@
7372
"MixerApi\\ExceptionRender\\Test\\App\\": "plugins/exception-render/tests/test_app/src/",
7473
"MixerApi\\HalView\\Test\\": "plugins/hal-view/tests/",
7574
"MixerApi\\HalView\\Test\\App\\": "plugins/hal-view/tests/test_app/src/",
76-
"MixerApi\\JwtAuth\\Test\\": "plugins/jwt-auth/tests/",
77-
"MixerApi\\JwtAuth\\Test\\App\\": "plugins/jwt-auth/tests/test_app/src/",
7875
"MixerApi\\JsonLdView\\Test\\": "plugins/json-ld-view/tests/",
7976
"MixerApi\\JsonLdView\\Test\\App\\": "plugins/json-ld-view/tests/test_app/src/",
77+
"MixerApi\\JwtAuth\\Test\\": "plugins/jwt-auth/tests/",
78+
"MixerApi\\JwtAuth\\Test\\App\\": "plugins/jwt-auth/tests/test_app/src/",
8079
"MixerApi\\Test\\": "plugins/mixerapi/tests/",
81-
"MixerApi\\Test\\App\\": "plugins/mixerapi/tests/test_app/src/",
82-
"MixerApi\\Rest\\Test\\": "plugins/rest/tests/",
83-
"MixerApi\\Rest\\Test\\App\\": "plugins/rest/tests/test_app/src/",
84-
"MixerApi\\Rest\\Test\\MyPlugin\\": "plugins/rest/tests/plugins/MyPlugin/"
80+
"MixerApi\\Test\\App\\": "plugins/mixerapi/tests/test_app/src/"
8581
}
8682
},
8783
"scripts": {

plugins/bake/composer.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@
99
"cakephp/cakephp": "^4.2",
1010
"cakephp/bake": "^2.1"
1111
},
12+
"require-dev": {
13+
"josegonzalez/dotenv": "^3.2",
14+
"phpunit/phpunit": "^9.0"
15+
},
1216
"autoload": {
1317
"psr-4": {
1418
"MixerApi\\Bake\\": "src/"
1519
}
1620
},
21+
"autoload-dev": {
22+
"psr-4": {
23+
"MixerApi\\Bake\\": "plugins/bake/src/",
24+
"MixerApi\\Bake\\Test\\": "plugins/bake/tests/",
25+
"MixerApi\\Bake\\Test\\App\\": "plugins/bake/tests/test_app/src/"
26+
}
27+
},
1728
"support": {
1829
"issues": "https://github.com/mixerapi/mixerapi-dev/issues",
1930
"source": "https://github.com/mixerapi/bake"
@@ -23,5 +34,12 @@
2334
"name": "MixerApi",
2435
"role": "Organization"
2536
}
26-
]
37+
],
38+
"config": {
39+
"allow-plugins": {
40+
"dealerdirect/phpcodesniffer-composer-installer": true,
41+
"cakephp/plugin-installer": true,
42+
"phpro/grumphp": true
43+
}
44+
}
2745
}

plugins/collection-view/composer.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@
99
"cakephp/cakephp": "^4.2",
1010
"adbario/php-dot-notation": "^2.3"
1111
},
12+
"require-dev": {
13+
"josegonzalez/dotenv": "^3.2",
14+
"phpunit/phpunit": "^9.0"
15+
},
1216
"autoload": {
1317
"psr-4": {
1418
"MixerApi\\CollectionView\\": "src/"
1519
}
1620
},
21+
"autoload-dev": {
22+
"psr-4": {
23+
"MixerApi\\CollectionView\\": "plugins/collection-view/src/",
24+
"MixerApi\\CollectionView\\Test\\": "plugins/collection-view/tests/",
25+
"MixerApi\\CollectionView\\Test\\App\\": "plugins/collection-view/tests/test_app/src/"
26+
}
27+
},
1728
"support": {
1829
"issues": "https://github.com/mixerapi/mixerapi-dev/issues",
1930
"source": "https://github.com/mixerapi/collection-view"
@@ -23,5 +34,12 @@
2334
"name": "MixerApi",
2435
"role": "Organization"
2536
}
26-
]
37+
],
38+
"config": {
39+
"allow-plugins": {
40+
"dealerdirect/phpcodesniffer-composer-installer": true,
41+
"cakephp/plugin-installer": true,
42+
"phpro/grumphp": true
43+
}
44+
}
2745
}

plugins/core/composer.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@
99
"cakephp/cakephp": "^4.2",
1010
"thecodingmachine/class-explorer": "^1.1"
1111
},
12+
"require-dev": {
13+
"josegonzalez/dotenv": "^3.2",
14+
"phpunit/phpunit": "^9.0"
15+
},
1216
"autoload": {
1317
"psr-4": {
1418
"MixerApi\\Core\\": "src/"
1519
}
1620
},
21+
"autoload-dev": {
22+
"psr-4": {
23+
"MixerApi\\Core\\": "plugins/core/src/",
24+
"MixerApi\\Core\\Test\\": "plugins/core/tests/",
25+
"MixerApi\\Core\\Test\\App\\": "plugins/core/tests/test_app/src/"
26+
}
27+
},
1728
"support": {
1829
"issues": "https://github.com/mixerapi/mixerapi-dev/issues",
1930
"source": "https://github.com/mixerapi/core"
@@ -23,5 +34,12 @@
2334
"name": "MixerApi",
2435
"role": "Organization"
2536
}
26-
]
37+
],
38+
"config": {
39+
"allow-plugins": {
40+
"dealerdirect/phpcodesniffer-composer-installer": true,
41+
"cakephp/plugin-installer": true,
42+
"phpro/grumphp": true
43+
}
44+
}
2745
}

plugins/crud/composer.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,31 @@
77
"php": "^8.0",
88
"cakephp/cakephp": "^4.2"
99
},
10+
"require-dev": {
11+
"friendsofcake/search": "^6.0",
12+
"josegonzalez/dotenv": "^3.2",
13+
"phpunit/phpunit": "^9.0"
14+
},
1015
"suggest": {
1116
"friendsofcake/search": "Integrates with mixerapi/crud for easy paginatable search filters"
1217
},
1318
"autoload": {
1419
"psr-4": {
1520
"MixerApi\\Crud\\": "src/"
1621
}
22+
},
23+
"autoload-dev": {
24+
"psr-4": {
25+
"MixerApi\\Crud\\": "plugins/crud/src/",
26+
"MixerApi\\Crud\\Test\\": "plugins/crud/tests/",
27+
"MixerApi\\Crud\\Test\\App\\": "plugins/crud/tests/test_app/src/"
28+
}
29+
},
30+
"config": {
31+
"allow-plugins": {
32+
"dealerdirect/phpcodesniffer-composer-installer": true,
33+
"cakephp/plugin-installer": true,
34+
"phpro/grumphp": true
35+
}
1736
}
1837
}

plugins/exception-render/composer.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@
99
"cakephp/cakephp": "^4.2"
1010
},
1111
"require-dev": {
12-
"cnizzardini/cakephp-swagger-bake": "^2.1"
12+
"cnizzardini/cakephp-swagger-bake": "^2.1",
13+
"josegonzalez/dotenv": "^3.2",
14+
"phpunit/phpunit": "^9.0"
1315
},
1416
"autoload": {
1517
"psr-4": {
1618
"MixerApi\\ExceptionRender\\": "src/"
1719
}
1820
},
21+
"autoload-dev": {
22+
"psr-4": {
23+
"MixerApi\\ExceptionRender\\": "plugins/exception-render/src/",
24+
"MixerApi\\ExceptionRender\\Test\\": "plugins/exception-render/tests/",
25+
"MixerApi\\ExceptionRender\\Test\\App\\": "plugins/exception-render/tests/test_app/src/"
26+
}
27+
},
1928
"support": {
2029
"issues": "https://github.com/mixerapi/mixerapi-dev/issues",
2130
"source": "https://github.com/mixerapi/exception-render"
@@ -25,5 +34,12 @@
2534
"name": "MixerApi",
2635
"role": "Organization"
2736
}
28-
]
37+
],
38+
"config": {
39+
"allow-plugins": {
40+
"dealerdirect/phpcodesniffer-composer-installer": true,
41+
"cakephp/plugin-installer": true,
42+
"phpro/grumphp": true
43+
}
44+
}
2945
}

plugins/hal-view/composer.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@
99
"cakephp/cakephp": "^4.2",
1010
"mixerapi/core": "^1.0"
1111
},
12+
"require-dev": {
13+
"josegonzalez/dotenv": "^3.2",
14+
"phpunit/phpunit": "^9.0"
15+
},
1216
"autoload": {
1317
"psr-4": {
1418
"MixerApi\\HalView\\": "src/"
1519
}
1620
},
21+
"autoload-dev": {
22+
"psr-4": {
23+
"MixerApi\\HalView\\": "plugins/hal-view/src/",
24+
"MixerApi\\HalView\\Test\\": "plugins/hal-view/tests/",
25+
"MixerApi\\HalView\\Test\\App\\": "plugins/hal-view/tests/test_app/src/"
26+
}
27+
},
1728
"support": {
1829
"issues": "https://github.com/mixerapi/mixerapi-dev/issues",
1930
"source": "https://github.com/mixerapi/hal-view"
@@ -24,6 +35,11 @@
2435
"role": "Organization"
2536
}
2637
],
27-
"prefer-stable": true,
28-
"minimum-stability": "dev"
38+
"config": {
39+
"allow-plugins": {
40+
"dealerdirect/phpcodesniffer-composer-installer": true,
41+
"cakephp/plugin-installer": true,
42+
"phpro/grumphp": true
43+
}
44+
}
2945
}

0 commit comments

Comments
 (0)