gh-actions: fix ci
[m6w6/ext-http] / scripts / gen_github_workflow_ci.php
1 #!/usr/bin/env php
2 <?php echo "# generated file; do not edit!\n"; ?>
3
4 name: ci
5 on:
6 workflow_dispatch:
7 push:
8 pull_request:
9
10 jobs:
11 <?php
12
13 $gen = include __DIR__ . "/ci/gen-matrix.php";
14 $cur = "7.4";
15 $job = $gen->github([
16 "old-matrix" => [
17 // most useful for all additional versions except current
18 "PHP" => ["7.0", "7.1", "7.2", "7.3"],
19 "enable_debug" => "yes",
20 "enable_maintainer_zts" => "yes",
21 "enable_json" => "yes",
22 "enable_hash" => "yes",
23 "enable_iconv" => "yes",
24 ],
25 "cur-none" => [
26 // everything disabled for current
27 "PHP" => $cur,
28 "with_http_libicu_dir" => "no",
29 "with_http_libidn_dir" => "no",
30 "with_http_libidn2_dir" => "no",
31 "with_http_libcurl_dir" => "no",
32 "with_http_libevent_dir" => "no",
33 "with_http_libbrotli_dir" => "no",
34 ],
35 "cur-dbg-zts" => [
36 // everything enabled for current, switching debug/zts
37 "PHP" => $cur,
38 "PECLs" => "event", // for tests/client029.phpt
39 "enable_sockets" => "yes", // needed by pecl/event
40 "enable_debug",
41 "enable_maintainer_zts",
42 "enable_json" => "yes",
43 "enable_hash" => "yes",
44 "enable_iconv" => "yes",
45 ],
46 "cur-cov" => [
47 // once everything enabled for current, with coverage
48 "CFLAGS" => "-O0 -g --coverage",
49 "CXXFLAGS" => "-O0 -g --coverage",
50 "PHP" => $cur,
51 "PECLs" => "event", // for tests/client029.phpt
52 "enable_sockets" => "yes", // needed by pecl/event
53 "enable_json" => "yes",
54 "enable_hash" => "yes",
55 "enable_iconv" => "yes",
56 [
57 "with_http_libicu_dir",
58 "with_http_libidn_dir",
59 "with_http_libidn2_dir",
60 ],
61 ]]);
62
63 foreach ($job as $id => $env) {
64 printf(" %s:\n", $id);
65 printf(" name: %s\n", $id);
66 if ($env["PHP"] == "master") {
67 printf(" continue-on-error: true\n");
68 }
69 printf(" env:\n");
70 foreach ($env as $key => $val) {
71 printf(" %s: \"%s\"\n", $key, $val);
72 }
73 ?>
74 runs-on: ubuntu-20.04
75 steps:
76 - uses: actions/checkout@v2
77 with:
78 submodules: true
79 - name: Install
80 run: |
81 sudo apt-get install -y \
82 php-cli \
83 php-pear \
84 libcurl4-openssl-dev \
85 libevent-dev \
86 libidn11-dev \
87 libidn2-0-dev \
88 libicu-dev \
89 libevent-dev \
90 libbrotli-dev \
91 re2c
92 - name: Prepare
93 run: |
94 make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php
95 make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master
96 make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master
97 if test -n "$PECLs"; then
98 IFS=$','
99 for pecl in $PECLs; do
100 make -f scripts/ci/Makefile pecl PECL=$pecl
101 done
102 unset IFS
103 fi
104
105 - name: Build
106 run: |
107 make -f scripts/ci/Makefile ext PECL=http
108 - name: Test
109 run: |
110 make -f scripts/ci/Makefile test
111 <?php if (isset($env["CFLAGS"]) && strpos($env["CFLAGS"], "--coverage") != false) : ?>
112 - name: Coverage
113 if: success()
114 run: |
115 cd src/.libs
116 bash <(curl -s https://codecov.io/bash) -X xcode -X coveragepy
117 <?php endif; ?>
118
119 <?php
120 }