-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathgen_github_workflow_ci.php
More file actions
executable file
·100 lines (97 loc) · 2.49 KB
/
gen_github_workflow_ci.php
File metadata and controls
executable file
·100 lines (97 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env php
<?php echo "# generated file; do not edit!\n"; ?>
name: ci
on:
workflow_dispatch:
push:
pull_request:
jobs:
<?php
function yesno(array $env, string $key) : string {
if (version_compare($env["PHP"], "8.0", "<") && $key === "zts") {
$check = "maintainer_zts";
} else {
$check = $key;
}
if (($env["enable_$check"] ?? null) === "yes") {
return $key;
}
return "no$key";
}
function jobname(string $id, array $env) : string {
return sprintf("php-%s-%s-%s", $env["PHP"], yesno($env, "debug"), yesno($env, "zts"));
}
$gen = include __DIR__ . "/ci/gen-matrix.php";
$cur = "8.4";
$job = $gen->github([
"old-matrix" => [
// most useful for all additional versions except current
"PHP" => ["7.4", "8.0", "8.1", "8.2", "8.3"],
"enable_debug" => "yes",
"enable_maintainer_zts" => "yes",
"enable_session" => "yes",
],
"master" => [
// master
"PHP" => ["master"],
"enable_debug" => "yes",
"enable_zts" => "yes",
"enable_session" => "yes",
],
"cur-none" => [
// everything disabled for current
"PHP" => $cur,
"enable_session" => "no",
],
"cur-dbg-zts" => [
// everything enabled for current, switching debug/zts
"PHP" => $cur,
"enable_debug",
"enable_zts",
"enable_session" => "yes",
],
"cur-cov" => [
// once everything enabled for current, with coverage
"CFLAGS" => "-O0 -g --coverage",
"CXXFLAGS" => "-O0 -g --coverage",
"PHP" => $cur,
"enable_session" => "yes",
]]);
foreach ($job as $id => $env) {
printf(" %s:\n", $id);
printf(" name: %s\n", jobname($id, $env));
if ($env["PHP"] == "master") {
printf(" continue-on-error: true\n");
}
printf(" env:\n");
foreach ($env as $key => $val) {
printf(" %s: \"%s\"\n", $key, $val);
}
?>
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install
run: |
sudo apt-get install -y \
php-cli \
php-pear \
re2c
- name: Prepare
run: |
make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php
- name: Build
run: |
make -f scripts/ci/Makefile ext PECL=msgpack
- name: Test
run: |
make -f scripts/ci/Makefile test
<?php if (isset($env["CFLAGS"]) && strpos($env["CFLAGS"], "--coverage") != false) : ?>
- name: Coverage
if: success()
uses: codecov/codecov-action@v5
<?php endif; ?>
<?php
}