Skip to content

Commit 82ba4c2

Browse files
committed
WIP
1 parent fc1582d commit 82ba4c2

File tree

3 files changed

+150
-1100
lines changed

3 files changed

+150
-1100
lines changed

.github/nightly_matrix.php

Lines changed: 5 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
<?php
22

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

115
function get_branch_commit_cache_file_path(): string {
126
return dirname(__DIR__) . '/branch-commit-cache.json';
@@ -21,137 +15,21 @@ function get_branches() {
2115

2216
$changed_branches = [];
2317
foreach (BRANCHES as $branch) {
24-
$previous_commit_hash = $branch_commit_map[$branch['ref']] ?? null;
25-
$current_commit_hash = trim(shell_exec('git rev-parse origin/' . $branch['ref']));
18+
$previous_commit_hash = $branch_commit_map[$branch] ?? null;
19+
$current_commit_hash = trim(shell_exec('git rev-parse origin/' . $branch));
2620

2721
if ($previous_commit_hash !== $current_commit_hash) {
2822
$changed_branches[] = $branch;
2923
}
3024

31-
$branch_commit_map[$branch['ref']] = $current_commit_hash;
25+
$branch_commit_map[$branch] = $current_commit_hash;
3226
}
3327

3428
file_put_contents($branch_commit_cache_file, json_encode($branch_commit_map));
3529

3630
return $changed_branches;
3731
}
3832

39-
function get_matrix_include(array $branches) {
40-
$jobs = [];
41-
foreach ($branches as $branch) {
42-
$jobs[] = [
43-
'name' => '_ASAN_UBSAN',
44-
'branch' => $branch,
45-
'debug' => true,
46-
'zts' => true,
47-
'configuration_parameters' => "CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' LDFLAGS='-fsanitize=undefined,address'",
48-
'run_tests_parameters' => '--asan',
49-
'test_function_jit' => false,
50-
'asan' => true,
51-
];
52-
$jobs[] = [
53-
'name' => '_REPEAT',
54-
'branch' => $branch,
55-
'debug' => true,
56-
'zts' => false,
57-
'run_tests_parameters' => '--repeat 2',
58-
'timeout_minutes' => 360,
59-
'test_function_jit' => true,
60-
'asan' => false,
61-
];
62-
$jobs[] = [
63-
'name' => '_VARIATION',
64-
'branch' => $branch,
65-
'debug' => true,
66-
'zts' => true,
67-
'configuration_parameters' => "CFLAGS='-DZEND_RC_DEBUG=1 -DPROFITABILITY_CHECKS=0 -DZEND_VERIFY_FUNC_INFO=1 -DZEND_VERIFY_TYPE_INFERENCE'",
68-
'run_tests_parameters' => '-d zend_test.observer.enabled=1 -d zend_test.observer.show_output=0',
69-
'timeout_minutes' => 360,
70-
'test_function_jit' => true,
71-
'asan' => false,
72-
];
73-
}
74-
return $jobs;
75-
}
76-
77-
function get_windows_matrix_include(array $branches) {
78-
$jobs = [];
79-
foreach ($branches as $branch) {
80-
$jobs[] = [
81-
'branch' => $branch,
82-
'x64' => true,
83-
'zts' => true,
84-
'opcache' => true,
85-
];
86-
$jobs[] = [
87-
'branch' => $branch,
88-
'x64' => false,
89-
'zts' => false,
90-
'opcache' => false,
91-
];
92-
}
93-
return $jobs;
94-
}
95-
96-
function get_macos_matrix_include(array $branches) {
97-
$jobs = [];
98-
foreach ($branches as $branch) {
99-
foreach([true, false] as $debug) {
100-
foreach([true, false] as $zts) {
101-
$jobs[] = [
102-
'branch' => $branch,
103-
'debug' => $debug,
104-
'zts' => $zts,
105-
'os' => '13',
106-
'arch' => 'X64',
107-
'test_jit' => true,
108-
];
109-
if ($branch['version']['minor'] >= 4 || $branch['version']['major'] >= 9) {
110-
$jobs[] = [
111-
'branch' => $branch,
112-
'debug' => $debug,
113-
'zts' => $zts,
114-
'os' => '14',
115-
'arch' => 'ARM64',
116-
'test_jit' => !$zts,
117-
];
118-
}
119-
}
120-
}
121-
}
122-
return $jobs;
123-
}
124-
125-
function get_alpine_matrix_include(array $branches) {
126-
$jobs = [];
127-
foreach ($branches as $branch) {
128-
if ([$branch['version']['major'], $branch['version']['minor']] < [8, 4]) {
129-
continue;
130-
}
131-
$jobs[] = [
132-
'name' => '_ASAN_UBSAN',
133-
'branch' => $branch,
134-
'debug' => true,
135-
'zts' => true,
136-
'asan' => true,
137-
'test_jit' => true,
138-
'configuration_parameters' => "CFLAGS='-fsanitize=undefined,address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC' LDFLAGS='-fsanitize=undefined,address -fno-sanitize=function' CC=clang-17 CXX=clang++-17",
139-
'run_tests_parameters' => '--asan -x',
140-
];
141-
}
142-
return $jobs;
143-
}
144-
145-
function get_current_version(): array {
146-
$file = dirname(__DIR__) . '/main/php_version.h';
147-
$content = file_get_contents($file);
148-
preg_match('(^#define PHP_MAJOR_VERSION (?<num>\d+)$)m', $content, $matches);
149-
$major = $matches['num'];
150-
preg_match('(^#define PHP_MINOR_VERSION (?<num>\d+)$)m', $content, $matches);
151-
$minor = $matches['num'];
152-
return ['major' => $major, 'minor' => $minor];
153-
}
154-
15533
$trigger = $argv[1] ?? 'schedule';
15634
$attempt = (int) ($argv[2] ?? 1);
15735
$discard_cache = ($trigger === 'schedule' && $attempt !== 1) || $trigger === 'workflow_dispatch';
@@ -162,16 +40,8 @@ function get_current_version(): array {
16240

16341
$branches = $branch === 'master'
16442
? get_branches()
165-
: [['name' => strtoupper($branch), 'ref' => $branch, 'version' => get_current_version()]];
166-
$matrix_include = get_matrix_include($branches);
167-
$windows_matrix_include = get_windows_matrix_include($branches);
168-
$macos_matrix_include = get_macos_matrix_include($branches);
169-
$alpine_matrix_include = get_alpine_matrix_include($branches);
43+
: [strtoupper($branch)];
17044

17145
$f = fopen(getenv('GITHUB_OUTPUT'), 'a');
17246
fwrite($f, 'branches=' . json_encode($branches, JSON_UNESCAPED_SLASHES) . "\n");
173-
fwrite($f, 'matrix-include=' . json_encode($matrix_include, JSON_UNESCAPED_SLASHES) . "\n");
174-
fwrite($f, 'windows-matrix-include=' . json_encode($windows_matrix_include, JSON_UNESCAPED_SLASHES) . "\n");
175-
fwrite($f, 'macos-matrix-include=' . json_encode($macos_matrix_include, JSON_UNESCAPED_SLASHES) . "\n");
176-
fwrite($f, 'alpine-matrix-include=' . json_encode($alpine_matrix_include, JSON_UNESCAPED_SLASHES) . "\n");
17747
fclose($f);

.github/workflows/all.yml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Nightly
2+
on:
3+
workflow_call: ~
4+
permissions:
5+
contents: read
6+
jobs:
7+
LINUX_X64:
8+
services:
9+
mysql:
10+
image: mysql:8.3
11+
ports:
12+
- 3306:3306
13+
env:
14+
MYSQL_DATABASE: test
15+
MYSQL_ROOT_PASSWORD: root
16+
postgres:
17+
image: postgres
18+
env:
19+
POSTGRES_USER: postgres
20+
POSTGRES_PASSWORD: postgres
21+
POSTGRES_DB: test
22+
firebird:
23+
image: jacobalberty/firebird
24+
ports:
25+
- 3050:3050
26+
env:
27+
ISC_PASSWORD: test
28+
FIREBIRD_DATABASE: test.fdb
29+
FIREBIRD_USER: test
30+
FIREBIRD_PASSWORD: test
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
configuration_parameters: ['']
35+
debug: [true, false]
36+
name: ['']
37+
run_tests_parameters: ['']
38+
test_function_jit: [true]
39+
zts: [true, false]
40+
include:
41+
- name: '_ASAN_UBSAN'
42+
debug: true
43+
zts: true
44+
configuration_parameters: "CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' LDFLAGS='-fsanitize=undefined,address'"
45+
run_tests_parameters: '--asan'
46+
test_function_jit: false
47+
asan: true
48+
- name: '_REPEAT'
49+
debug: true
50+
zts: false
51+
run_tests_parameters: '--repeat 2'
52+
timeout_minutes: 360
53+
test_function_jit: true
54+
asan: false
55+
- name: '_VARIATION'
56+
debug: true
57+
zts: true
58+
configuration_parameters: "CFLAGS='-DZEND_RC_DEBUG=1 -DPROFITABILITY_CHECKS=0 -DZEND_VERIFY_FUNC_INFO=1 -DZEND_VERIFY_TYPE_INFERENCE'"
59+
run_tests_parameters: '-d zend_test.observer.enabled=1 -d zend_test.observer.show_output=0'
60+
timeout_minutes: 360
61+
test_function_jit: true
62+
asan: false
63+
name: "LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}"
64+
runs-on: ubuntu-22.04
65+
steps:
66+
- name: git checkout
67+
uses: actions/checkout@v4
68+
- name: Create MSSQL container
69+
uses: ./.github/actions/setup-mssql
70+
- name: apt
71+
uses: ./.github/actions/apt-x64
72+
with:
73+
asan: ${{ matrix.asan && 'true' || 'false' }}
74+
- name: System info
75+
run: |
76+
echo "::group::Show host CPU info"
77+
lscpu
78+
echo "::endgroup::"
79+
echo "::group::Show installed package versions"
80+
dpkg -l
81+
echo "::endgroup::"
82+
- name: ./configure
83+
uses: ./.github/actions/configure-x64
84+
with:
85+
configurationParameters: >-
86+
${{ matrix.configuration_parameters }}
87+
--${{ matrix.debug && 'enable' || 'disable' }}-debug
88+
--${{ matrix.zts && 'enable' || 'disable' }}-zts
89+
asan: ${{ matrix.asan && 'true' || 'false' }}
90+
- name: make
91+
run: make -j$(/usr/bin/nproc) >/dev/null
92+
- name: make install
93+
uses: ./.github/actions/install-linux
94+
- name: Setup
95+
uses: ./.github/actions/setup-x64
96+
- name: Test
97+
uses: ./.github/actions/test-linux
98+
with:
99+
runTestsParameters: >-
100+
${{ matrix.run_tests_parameters }}
101+
idleCpu: ${{ matrix.asan && 'true' || 'false' }}
102+
- name: Test Tracing JIT
103+
uses: ./.github/actions/test-linux
104+
with:
105+
jitType: tracing
106+
runTestsParameters: >-
107+
${{ matrix.run_tests_parameters }}
108+
-d zend_extension=opcache.so
109+
-d opcache.enable_cli=1
110+
- name: Test OpCache
111+
uses: ./.github/actions/test-linux
112+
with:
113+
runTestsParameters: >-
114+
${{ matrix.run_tests_parameters }}
115+
-d zend_extension=opcache.so
116+
-d opcache.enable_cli=1
117+
- name: Test Function JIT
118+
# ASAN frequently timeouts. Each test run takes ~90 minutes, we can
119+
# avoid running into the 6 hour timeout by skipping the function JIT.
120+
if: matrix.test_function_jit
121+
uses: ./.github/actions/test-linux
122+
with:
123+
jitType: function
124+
runTestsParameters: >-
125+
${{ matrix.run_tests_parameters }}
126+
-d zend_extension=opcache.so
127+
-d opcache.enable_cli=1
128+
- name: Verify generated files are up to date
129+
uses: ./.github/actions/verify-generated-files
130+
- name: Notify Slack
131+
if: failure()
132+
uses: ./.github/actions/notify-slack
133+
with:
134+
token: ${{ secrets.ACTION_MONITORING_SLACK }}

0 commit comments

Comments
 (0)