37
37
default : false
38
38
required : false
39
39
type : boolean
40
+ supportedChecksCommand :
41
+ description : The make command to invoke listing the different tasks to run across all versions, will also act as a prefix for All, Direct on OS, Lowest, Locked, and Highest task lists.
42
+ default : " task-list-ci"
43
+ required : false
44
+ type : string
40
45
41
46
# defaults:
42
47
# run:
84
89
- supported-versions-matrix
85
90
outputs :
86
91
version : ${{ steps.supported-threading-matrix.outputs.result }}
92
+ primary : ${{ steps.primary.outputs.result }}
87
93
steps :
88
94
- id : supported-threading-matrix
89
95
uses : actions/github-script@v7
@@ -102,6 +108,19 @@ jobs:
102
108
return ['nts'];
103
109
}
104
110
return ['nts', 'zts'];
111
+ - id : primary
112
+ uses : actions/github-script@v7
113
+ env :
114
+ PHP_EXTENSIONS : ${{ needs.supported-versions-matrix.outputs.extensions }}
115
+ with :
116
+ script : |
117
+ const phpExtensions = JSON.parse(process.env.PHP_EXTENSIONS);
118
+ for(var i = 0; i <= phpExtensions.length; i++) {
119
+ if (phpExtensions[i] == 'parallel') {
120
+ return 'zts';
121
+ }
122
+ }
123
+ return 'nts';
105
124
supported-checks-matrix :
106
125
name : Supported Checks Matrix
107
126
runs-on : ${{ inputs.runsOnChaos }}
@@ -110,7 +129,11 @@ jobs:
110
129
- supported-versions-matrix
111
130
outputs :
112
131
check : ${{ steps.supported-checks-matrix.outputs.check }}
113
- run-tests : ${{ steps.run-tests.outputs.result }}
132
+ all : ${{ steps.supported-checks-matrix.outputs.all }}
133
+ dos : ${{ steps.supported-checks-matrix.outputs.dos }}
134
+ low : ${{ steps.supported-checks-matrix.outputs.low }}
135
+ locked : ${{ steps.supported-checks-matrix.outputs.locked }}
136
+ high : ${{ steps.supported-checks-matrix.outputs.high }}
114
137
steps :
115
138
- uses : actions/checkout@v4
116
139
with :
@@ -121,19 +144,150 @@ jobs:
121
144
- id : supported-checks-matrix
122
145
name : Generate check
123
146
run : |
124
- printf "Checks found: %s\r\n" $(make task-list-ci)
125
- printf "check=%s" $(make task-list-ci) >> $GITHUB_OUTPUT
147
+ printf "Checks found: %s\r\n" $(make ${{ inputs.supportedChecksCommand }} || echo "[]")
148
+ printf "check=%s\n" $(make ${{ inputs.supportedChecksCommand }} || echo "[]") >> $GITHUB_OUTPUT
149
+ printf "All Checks found: %s\r\n" $(make ${{ inputs.supportedChecksCommand }}-all || echo "[]")
150
+ printf "all=%s\n" $(make ${{ inputs.supportedChecksCommand }}-all || echo "[]") >> $GITHUB_OUTPUT
151
+ printf "Directly on OS Checks found: %s\r\n" $(make ${{ inputs.supportedChecksCommand }}-dos || echo "[]")
152
+ printf "dos=%s\n" $(make ${{ inputs.supportedChecksCommand }}-dos || echo "[]") >> $GITHUB_OUTPUT
153
+ printf "Low Checks found: %s\r\n" $(make ${{ inputs.supportedChecksCommand }}-low || echo "[]")
154
+ printf "low=%s\n" $(make ${{ inputs.supportedChecksCommand }}-low || echo "[]") >> $GITHUB_OUTPUT
155
+ printf "Locked Checks found: %s\r\n" $(make ${{ inputs.supportedChecksCommand }}-locked || echo "[]")
156
+ printf "locked=%s\n" $(make ${{ inputs.supportedChecksCommand }}-locked || echo "[]") >> $GITHUB_OUTPUT
157
+ printf "High Checks found: %s\r\n" $(make ${{ inputs.supportedChecksCommand }}-high || echo "[]")
158
+ printf "high=%s\n" $(make ${{ inputs.supportedChecksCommand }}-high || echo "[]") >> $GITHUB_OUTPUT
159
+ working-directory : ${{ inputs.workingDirectory }}
160
+ compile-matrix :
161
+ name : Compile the matrix
162
+ runs-on : ubuntu-latest
163
+ needs :
164
+ - supported-checks-matrix
165
+ - supported-versions-matrix
166
+ - supported-threading-matrix
167
+ outputs :
168
+ qa : ${{ steps.compile-qa-matrix.outputs.result }}
169
+ directly-on-os : ${{ steps.compile-directly-on-os-matrix.outputs.result }}
170
+ steps :
126
171
- uses : actions/github-script@v7
127
- id : run-tests
172
+ name : Compile the QA matrix
173
+ id : compile-qa-matrix
128
174
env :
129
- CHECKS : ${{ steps.supported-checks-matrix.outputs.check }}
175
+ PHP_LOWEST : " ${{ needs.supported-versions-matrix.outputs.lowest }}"
176
+ PHP_VERSIONS : ${{ needs.supported-versions-matrix.outputs.version }}
177
+ PHP_TO_THREAD_OR_NOT_TO_THREAD : ${{ needs.supported-threading-matrix.outputs.version }}
178
+ THREAD_PRIMARY : ${{ needs.supported-threading-matrix.outputs.primary }}
179
+ COMPOSER : ' ["lowest", "locked", "highest"]'
180
+ CHECKS : ${{ needs.supported-checks-matrix.outputs.check }}
181
+ CHECKS_ALL : ${{ needs.supported-checks-matrix.outputs.all }}
182
+ CHECKS_LOW : ${{ needs.supported-checks-matrix.outputs.low }}
183
+ CHECKS_LOCKED : ${{ needs.supported-checks-matrix.outputs.locked }}
184
+ CHECKS_HIGH : ${{ needs.supported-checks-matrix.outputs.high }}
130
185
with :
131
186
script : |
187
+ let matrix = [];
188
+ const phpLowest = JSON.parse(process.env.PHP_LOWEST);
189
+ const phpVersions = JSON.parse(process.env.PHP_VERSIONS);
190
+ const phpToThreadOrNotToThread = JSON.parse(process.env.PHP_TO_THREAD_OR_NOT_TO_THREAD);
191
+ const threadPrimary = JSON.parse(process.env.THREAD_PRIMARY);
192
+ const composer = JSON.parse(process.env.COMPOSER);
132
193
const checks = JSON.parse(process.env.CHECKS);
133
- console.log(checks);
134
- console.log(checks.includes("unit-testing"));
135
- console.log(checks.includes("unit-testing") ? "yes" : "no");
136
- return checks.includes("unit-testing") ? "yes" : "no";
194
+ const checksAll = JSON.parse(process.env.CHECKS_ALL);
195
+ const checksLow = JSON.parse(process.env.CHECKS_LOW);
196
+ const checksLocked = JSON.parse(process.env.CHECKS_LOCKED);
197
+ const checksHigh = JSON.parse(process.env.CHECKS_HIGH);
198
+ for (const checkLow in checksLow) {
199
+ matrix.push({
200
+ php: phpLowest,
201
+ "php-to-thread-or-not-to-thread": threadPrimary,
202
+ composer: 'lowest',
203
+ check: checksLow[checkLow],
204
+ });
205
+ }
206
+ for (const checkLocked in checksLocked) {
207
+ matrix.push({
208
+ php: phpLowest,
209
+ "php-to-thread-or-not-to-thread": threadPrimary,
210
+ composer: 'locked',
211
+ check: checksLocked[checkLocked],
212
+ });
213
+ }
214
+ for (const checkHigh in checksHigh) {
215
+ matrix.push({
216
+ php: phpLowest,
217
+ "php-to-thread-or-not-to-thread": threadPrimary,
218
+ composer: 'highest',
219
+ check: checksHigh[checkHigh],
220
+ });
221
+ }
222
+ for (const ztsOrNts in phpToThreadOrNotToThread) {
223
+ for (const composerAction in composer) {
224
+ for (const phpVersion in phpVersions) {
225
+ for (const checkAll in checksAll) {
226
+ matrix.push({
227
+ php: phpVersions[phpVersion],
228
+ "php-to-thread-or-not-to-thread": phpToThreadOrNotToThread[ztsOrNts],
229
+ composer: composer[composerAction],
230
+ check: checksAll[checkAll],
231
+ });
232
+ }
233
+ for (const check in checks) {
234
+ matrix.push({
235
+ php: phpVersions[phpVersion],
236
+ "php-to-thread-or-not-to-thread": phpToThreadOrNotToThread[ztsOrNts],
237
+ composer: composer[composerAction],
238
+ check: checks[check],
239
+ });
240
+ }
241
+ }
242
+ }
243
+ }
244
+ console.log(JSON.stringify(matrix, null, 4));
245
+ return matrix;
246
+ - uses : actions/github-script@v7
247
+ name : Compile the Direction on OS matrix
248
+ id : compile-directly-on-os-matrix
249
+ env :
250
+ OS : ${{ (contains(needs.supported-versions-matrix.outputs.extensions, 'pcntl') == false || contains(needs.supported-versions-matrix.outputs.extensions, 'parallel') == false) && '["ubuntu-latest", "windows-latest", "macos-latest"]' || '["ubuntu-latest", "macos-latest"]' }}
251
+ PHP_VERSIONS : ${{ needs.supported-versions-matrix.outputs.version }}
252
+ THREAD_PRIMARY : ${{ needs.supported-threading-matrix.outputs.primary }}
253
+ COMPOSER : ' ["lowest", "locked", "highest"]'
254
+ CHECKS : ${{ needs.supported-checks-matrix.outputs.check }}
255
+ CHECKS_DOS : ${{ needs.supported-checks-matrix.outputs.dos }}
256
+ with :
257
+ script : |
258
+ let matrix = [];
259
+ const oses = JSON.parse(process.env.OS);
260
+ const phpVersions = JSON.parse(process.env.PHP_VERSIONS);
261
+ const threadPrimary = JSON.parse(process.env.THREAD_PRIMARY);
262
+ const composer = JSON.parse(process.env.COMPOSER);
263
+ const checks = JSON.parse(process.env.CHECKS_DOS === "[]" ? '["unit-testing"]' : process.env.CHECKS);
264
+ const checksDos = JSON.parse(process.env.CHECKS_DOS);
265
+ for (const os in oses) {
266
+ for (const composerAction in composer) {
267
+ for (const phpVersion in phpVersions) {
268
+ for (const checkDos in checksDos) {
269
+ matrix.push({
270
+ os: oses[os],
271
+ php: phpVersions[phpVersion],
272
+ "php-to-thread-or-not-to-thread": threadPrimary,
273
+ composer: composer[composerAction],
274
+ check: checksDos[checkDos],
275
+ });
276
+ }
277
+ for (const check in checks) {
278
+ matrix.push({
279
+ os: oses[os],
280
+ php: phpVersions[phpVersion],
281
+ "php-to-thread-or-not-to-thread": threadPrimary,
282
+ composer: composer[composerAction],
283
+ check: checks[check],
284
+ });
285
+ }
286
+ }
287
+ }
288
+ }
289
+ console.log(JSON.stringify(matrix, null, 4));
290
+ return matrix;
137
291
can-require :
138
292
name : Test we can require "${{ matrix.package-name }}" on PHP ${{ matrix.php }} (${{ matrix.php-to-thread-or-not-to-thread }})
139
293
if : ${{ inputs.isProject == false }}
@@ -171,14 +325,9 @@ jobs:
171
325
strategy :
172
326
fail-fast : false
173
327
matrix :
174
- php : ${{ fromJson(inputs.isProject == false && needs.supported-versions-matrix.outputs.version || format('["{0}"]', needs.supported-versions-matrix.outputs.lowest)) }}
175
- php-to-thread-or-not-to-thread : ${{ fromJson(needs.supported-threading-matrix.outputs.version) }}
176
- composer : ${{ fromJson(inputs.isProject == false && '["lowest", "locked", "highest"]' || '["locked"]') }}
177
- check : ${{ fromJson(needs.supported-checks-matrix.outputs.check) }}
328
+ include : ${{ fromJson(needs.compile-matrix.outputs.qa) }}
178
329
needs :
179
- - supported-checks-matrix
180
- - supported-versions-matrix
181
- - supported-threading-matrix
330
+ - compile-matrix
182
331
runs-on : ubuntu-latest
183
332
container :
184
333
image : ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-${{ matrix.php-to-thread-or-not-to-thread }}-alpine-dev-root
@@ -206,21 +355,18 @@ jobs:
206
355
env :
207
356
COVERALLS_REPO_TOKEN : ${{ secrets.COVERALLS_REPO_TOKEN }}
208
357
COVERALLS_RUN_LOCALLY : ${{ secrets.COVERALLS_RUN_LOCALLY }}
209
- tests- directly-on-os :
210
- name : Run tests on PHP ${{ matrix.php }} (${{ matrix.php-to-thread-or-not-to-thread }}) with ${{ matrix.composer }} dependency preference (${{ matrix.os }})
358
+ directly-on-os :
359
+ name : Run ${{ matrix.check }} on PHP ${{ matrix.php }} (${{ matrix.php-to-thread-or-not-to-thread }}) with ${{ matrix.composer }} dependency preference (${{ matrix.os }})
211
360
strategy :
212
361
fail-fast : false
213
362
matrix :
214
- os : ${{ fromJson((contains(needs.supported-versions-matrix.outputs.extensions, 'pcntl') == false || contains(needs.supported-versions-matrix.outputs.extensions, 'parallel') == false) && '["ubuntu-latest", "windows-latest", "macos-latest"]' || '["ubuntu-latest", "macos-latest"]') }}
215
- php : ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
216
- php-to-thread-or-not-to-thread : ${{ fromJson(needs.supported-threading-matrix.outputs.version) }}
217
- composer : [lowest, locked, highest]
363
+ include : ${{ fromJson(needs.compile-matrix.outputs.directly-on-os) }}
218
364
needs :
219
365
- supported-checks-matrix
220
366
- supported-versions-matrix
221
- - supported-threading -matrix
367
+ - compile -matrix
222
368
runs-on : ${{ matrix.os }}
223
- if : ${{ needs.supported-checks-matrix.outputs.run-tests == '"yes"' && inputs.isProject == false }}
369
+ if : ${{ inputs.isProject == false }}
224
370
env : ${{ fromJson(inputs.env) }}
225
371
services : ${{ fromJson(inputs.services) }}
226
372
steps :
@@ -238,15 +384,8 @@ jobs:
238
384
with :
239
385
dependency-versions : ${{ matrix.composer }}
240
386
working-directory : ${{ inputs.workingDirectory }}
241
- - run : make unit-testing-raw || true
242
- working-directory : ${{ inputs.workingDirectory }}
243
- if : needs.supported-versions-matrix.outputs.upcoming == matrix.php
244
- env :
245
- COVERALLS_REPO_TOKEN : ${{ secrets.COVERALLS_REPO_TOKEN }}
246
- COVERALLS_RUN_LOCALLY : ${{ secrets.COVERALLS_RUN_LOCALLY }}
247
- - run : make unit-testing-raw
387
+ - run : make ${{ matrix.check }}
248
388
working-directory : ${{ inputs.workingDirectory }}
249
- if : needs.supported-versions-matrix.outputs.upcoming != matrix.php
250
389
env :
251
390
COVERALLS_REPO_TOKEN : ${{ secrets.COVERALLS_REPO_TOKEN }}
252
391
COVERALLS_RUN_LOCALLY : ${{ secrets.COVERALLS_RUN_LOCALLY }}
@@ -255,7 +394,7 @@ jobs:
255
394
needs :
256
395
- can-require
257
396
- qa
258
- - tests- directly-on-os
397
+ - directly-on-os
259
398
runs-on : ${{ inputs.runsOnChaos }}
260
399
steps :
261
400
- run : echo "✔️"
0 commit comments