Skip to content

Commit 8f64c9e

Browse files
committed
Cleanup
1 parent 5c12927 commit 8f64c9e

File tree

3 files changed

+124
-167
lines changed

3 files changed

+124
-167
lines changed

.github/jit_check.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/nightly_matrix.php

Lines changed: 47 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
<?php
22

3-
const BRANCHES = ['master', 'PHP-8.3', 'PHP-8.2', 'PHP-8.1', 'PHP-8.0'];
3+
const BRANCHES = [
4+
['name' => 'master', 'ref' => 'master', 'version' => ['major' => 8, 'minor' => 4]],
5+
['name' => 'PHP-8.3', 'ref' => 'PHP-8.3', 'version' => ['major' => 8, 'minor' => 3]],
6+
['name' => 'PHP-8.2', 'ref' => 'PHP-8.2', 'version' => ['major' => 8, 'minor' => 2]],
7+
['name' => 'PHP-8.1', 'ref' => 'PHP-8.1', 'version' => ['major' => 8, 'minor' => 1]],
8+
];
49

510
function get_branch_commit_cache_file_path(): string {
611
return dirname(__DIR__) . '/branch-commit-cache.json';
712
}
813

9-
function get_branch_matrix(array $branches) {
10-
$result = array_map(function ($branch) {
11-
$branch_key = strtoupper(str_replace('.', '', $branch));
12-
return [
13-
'name' => $branch_key,
14-
'ref' => $branch,
15-
];
16-
}, $branches);
17-
18-
return $result;
19-
}
20-
2114
function get_branches() {
2215
$branch_commit_cache_file = get_branch_commit_cache_file_path();
2316
$branch_commit_map = [];
@@ -27,47 +20,54 @@ function get_branches() {
2720

2821
$changed_branches = [];
2922
foreach (BRANCHES as $branch) {
30-
$previous_commit_hash = $branch_commit_map[$branch] ?? null;
31-
$current_commit_hash = trim(shell_exec('git rev-parse origin/' . $branch));
23+
$previous_commit_hash = $branch_commit_map[$branch['ref']] ?? null;
24+
$current_commit_hash = trim(shell_exec('git rev-parse origin/' . $branch['ref']));
3225

3326
if ($previous_commit_hash !== $current_commit_hash) {
3427
$changed_branches[] = $branch;
3528
}
3629

37-
$branch_commit_map[$branch] = $current_commit_hash;
30+
$branch_commit_map[$branch['ref']] = $current_commit_hash;
3831
}
3932

4033
file_put_contents($branch_commit_cache_file, json_encode($branch_commit_map));
4134

42-
return get_branch_matrix($changed_branches);
35+
return $changed_branches;
4336
}
4437

4538
function get_matrix_include(array $branches) {
4639
$jobs = [];
4740
foreach ($branches as $branch) {
4841
$jobs[] = [
49-
'name' => '_ASAN_UBSAN_REPEAT',
42+
'name' => '_ASAN_UBSAN',
5043
'branch' => $branch,
5144
'debug' => true,
5245
'zts' => true,
5346
'configuration_parameters' => "CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' LDFLAGS='-fsanitize=undefined,address'",
54-
'run_tests_parameters' => '--asan',
55-
'timeout_minutes' => 3600,
56-
'test_function_jit' => true,
47+
'run_tests_parameters' => '--asan --repeat 2',
48+
'test_function_jit' => false,
5749
'asan' => true,
5850
];
59-
if ($branch['ref'] !== 'PHP-8.0') {
60-
$jobs[] = [
61-
'name' => '_VARIATION',
62-
'branch' => $branch,
63-
'debug' => true,
64-
'zts' => true,
65-
'configuration_parameters' => "CFLAGS='-DZEND_RC_DEBUG=1 -DPROFITABILITY_CHECKS=0 -DZEND_VERIFY_FUNC_INFO=1'",
66-
'timeout_minutes' => 360,
67-
'test_function_jit' => true,
68-
'asan' => false,
69-
];
70-
}
51+
$jobs[] = [
52+
'name' => '_REPEAT',
53+
'branch' => $branch,
54+
'debug' => true,
55+
'zts' => false,
56+
'run_tests_parameters' => '--repeat 2',
57+
'timeout_minutes' => 360,
58+
'test_function_jit' => true,
59+
'asan' => false,
60+
];
61+
$jobs[] = [
62+
'name' => '_VARIATION',
63+
'branch' => $branch,
64+
'debug' => true,
65+
'zts' => true,
66+
'configuration_parameters' => "CFLAGS='-DZEND_RC_DEBUG=1 -DPROFITABILITY_CHECKS=0 -DZEND_VERIFY_FUNC_INFO=1 -DZEND_VERIFY_TYPE_INFERENCE'",
67+
'timeout_minutes' => 360,
68+
'test_function_jit' => true,
69+
'asan' => false,
70+
];
7171
}
7272
return $jobs;
7373
}
@@ -91,14 +91,27 @@ function get_windows_matrix_include(array $branches) {
9191
return $jobs;
9292
}
9393

94+
function get_current_version(): array {
95+
$file = dirname(__DIR__) . '/main/php_version.h';
96+
$content = file_get_contents($file);
97+
preg_match('(^#define PHP_MAJOR_VERSION (?<num>\d+)$)m', $content, $matches);
98+
$major = $matches['num'];
99+
preg_match('(^#define PHP_MINOR_VERSION (?<num>\d+)$)m', $content, $matches);
100+
$minor = $matches['num'];
101+
return ['major' => $major, 'minor' => $minor];
102+
}
103+
94104
$trigger = $argv[1] ?? 'schedule';
95105
$attempt = (int) ($argv[2] ?? 1);
96106
$discard_cache = ($trigger === 'schedule' && $attempt !== 1) || $trigger === 'workflow_dispatch';
97107
if ($discard_cache) {
98108
@unlink(get_branch_commit_cache_file_path());
99109
}
110+
$branch = $argv[3] ?? 'master';
100111

101-
$branches = get_branches();
112+
$branches = $branch === 'master'
113+
? get_branches()
114+
: [['name' => strtoupper($branch), 'ref' => $branch, 'version' => get_current_version()]];
102115
$matrix_include = get_matrix_include($branches);
103116
$windows_matrix_include = get_windows_matrix_include($branches);
104117

0 commit comments

Comments
 (0)