Skip to content

Commit 8a887a1

Browse files
committed
Unify push & nightly workflows
Also introduce label-based opt-in and opt-out mechanism for jobs.
1 parent 96be28c commit 8a887a1

File tree

4 files changed

+204
-435
lines changed

4 files changed

+204
-435
lines changed

.github/nightly_matrix.php

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,104 @@ function get_current_version(): array {
4646
return [$major, $minor];
4747
}
4848

49+
function select_jobs($trigger, $labels, $php_version, $ref, $comprehensive) {
50+
$disable_all = in_array('CI: Disable all', $labels, true);
51+
$enable_all = in_array('CI: Enable all', $labels, true);
52+
$test_alpine = in_array('CI: Alpine', $labels, true);
53+
$test_benchmarking = in_array('CI: Benchmarking', $labels, true);
54+
$test_community = in_array('CI: Community', $labels, true);
55+
$test_freebsd = in_array('CI: FreeBSD', $labels, true);
56+
$test_libmysqlclient = in_array('CI: libmysqlclient', $labels, true);
57+
$test_linux_ppc64 = in_array('CI: Linux PPC64', $labels, true);
58+
$test_linux_x32 = in_array('CI: Linux X32', $labels, true);
59+
$test_linux_x64 = in_array('CI: Linux X64', $labels, true);
60+
$test_macos = in_array('CI: macOS', $labels, true);
61+
$test_msan = in_array('CI: MSAN', $labels, true);
62+
$test_opcache_variation = in_array('CI: Opcache Variation', $labels, true);
63+
$test_windows = in_array('CI: Windows', $labels, true);
64+
65+
$jobs = [];
66+
if (version_compare($php_version, '8.4', '>=') && ($enable_all || !$disable_all || $test_alpine)) {
67+
$jobs['ALPINE'] = true;
68+
}
69+
if ($enable_all || $test_community) {
70+
$jobs['COMMUNITY']['matrix'] = version_compare($php_version, '8.4', '>=')
71+
? ['type' => ['asan', 'verify_type_inference']]
72+
: ['type' => ['asan']];
73+
$jobs['COMMUNITY']['config']['symfony_version'] = version_compare($php_version, '8.4', '>=') ? '8.1' : '7.4';
74+
}
75+
if ($trigger === 'schedule' && $ref === 'master') {
76+
$jobs['COVERAGE'] = true;
77+
}
78+
if ($enable_all || $test_libmysqlclient) {
79+
$jobs['LIBMYSQLCLIENT'] = true;
80+
}
81+
if (version_compare($php_version, '8.4', '>=') && ($enable_all || $test_linux_ppc64)) {
82+
$jobs['LINUX_PPC64'] = true;
83+
}
84+
if ($enable_all || !$disable_all || $test_linux_x64) {
85+
$jobs['LINUX_X64']['matrix'] = $comprehensive
86+
? [
87+
'name' => [''],
88+
'asan' => [false],
89+
'debug' => [true, false],
90+
'repeat' => [false],
91+
'variation' => [false],
92+
'zts' => [true, false],
93+
'include' => [
94+
['name' => '_ASAN', 'asan' => true, 'debug' => true, 'repeat' => false, 'variation' => false, 'zts' => true],
95+
['name' => '_REPEAT', 'asan' => false, 'debug' => true, 'repeat' => true, 'variation' => false, 'zts' => false],
96+
['name' => '_VARIATION', 'asan' => false, 'debug' => true, 'repeat' => false, 'variation' => true, 'zts' => true],
97+
],
98+
]
99+
: ['include' => [
100+
['name' => '', 'asan' => false, 'debug' => false, 'repeat' => false, 'variation' => false, 'zts' => false],
101+
['name' => '_ASAN', 'asan' => true, 'debug' => true, 'repeat' => false, 'variation' => false, 'zts' => true],
102+
]];
103+
$jobs['LINUX_X64']['config']['variation_enable_zend_max_execution_timers'] = version_compare($php_version, '8.3', '>=');
104+
}
105+
if ($enable_all || !$disable_all || $test_linux_x32) {
106+
$jobs['LINUX_X32']['matrix'] = $comprehensive
107+
? ['debug' => [true, false], 'zts' => [true, false]]
108+
: ['debug' => [true], 'zts' => [true]];
109+
}
110+
if ($enable_all || !$disable_all || $test_macos) {
111+
$test_arm = version_compare($php_version, '8.4', '>=');
112+
$jobs['MACOS']['matrix'] = $comprehensive
113+
? ['arch' => $test_arm ? ['X64', 'ARM64'] : ['X64'], 'debug' => [true, false], 'zts' => [true, false]]
114+
: ['include' => [['arch' => $test_arm ? 'ARM64' : 'X64', 'debug' => true, 'zts' => false]]];
115+
$jobs['MACOS']['config']['arm64_version'] = version_compare($php_version, '8.4', '>=') ? '15' : '14';
116+
}
117+
if ($enable_all || $test_msan) {
118+
$jobs['MSAN'] = true;
119+
}
120+
if ($enable_all || $test_opcache_variation) {
121+
$jobs['OPCACHE_VARIATION'] = true;
122+
}
123+
if ($trigger === 'schedule' && $ref === 'master') {
124+
$jobs['PECL'] = true;
125+
}
126+
if ($enable_all || !$disable_all || $test_windows) {
127+
$windows_jobs = ['include' => [['asan' => true, 'opcache' => true, 'x64' => true, 'zts' => true]]];
128+
if ($comprehensive) {
129+
$windows_jobs['include'][] = ['asan' => false, 'opcache' => false, 'x64' => false, 'zts' => false];
130+
}
131+
$jobs['WINDOWS']['matrix'] = $windows_jobs;
132+
$jobs['WINDOWS']['config'] = version_compare($php_version, '8.4', '>=')
133+
? ['vs_crt_version' => 'vs17']
134+
: ['vs_crt_version' => 'vs16'];
135+
}
136+
if ($enable_all || !$disable_all || $test_benchmarking) {
137+
$jobs['BENCHMARKING'] = true;
138+
}
139+
if ($enable_all || !$disable_all || $test_freebsd) {
140+
$jobs['FREEBSD']['matrix'] = $comprehensive && version_compare($php_version, '8.3', '>=')
141+
? ['zts' => [true, false]]
142+
: ['zts' => [false]];
143+
}
144+
return $jobs;
145+
}
146+
49147
$trigger = $argv[1] ?? 'schedule';
50148
$attempt = (int) ($argv[2] ?? 1);
51149
$sunday = date('w', time()) === '0';
@@ -60,6 +158,17 @@ function get_current_version(): array {
60158
? get_branches()
61159
: [['ref' => $branch, 'version' => get_current_version()]];
62160

161+
$labels = json_decode($argv[4] ?? '[]', true);
162+
$labels = array_column($labels, 'name');
163+
$comprehensive = $trigger === 'schedule' || $trigger === 'workflow_dispatch' || in_array('CI: Comprehensive', $labels, true);
164+
165+
foreach ($branches as &$branch) {
166+
$php_version = $branch['version'][0] . '.' . $branch['version'][1];
167+
$branch['jobs'] = select_jobs($trigger, $labels, $php_version, $branch['ref'], $comprehensive);
168+
$branch['config']['ubuntu_version'] = version_compare($php_version, '8.5', '>=') ? '24.04' : '22.04';
169+
}
170+
63171
$f = fopen(getenv('GITHUB_OUTPUT'), 'a');
64172
fwrite($f, 'branches=' . json_encode($branches, JSON_UNESCAPED_SLASHES) . "\n");
173+
fwrite($f, 'comprehensive=' . json_encode($comprehensive, JSON_UNESCAPED_SLASHES) . "\n");
65174
fclose($f);

0 commit comments

Comments
 (0)