-
Notifications
You must be signed in to change notification settings - Fork 2
244 lines (218 loc) · 8.85 KB
/
Copy pathctrl-c.yml
File metadata and controls
244 lines (218 loc) · 8.85 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
name: Ctrl+C signal delivery (macOS + Linux)
# Reproduction CI for YanGusik/laravel-spawn#8: first Ctrl+C did not stop
# the dev server on macOS. Builds php-src (true-async) + ext/async +
# http_server with ccache, then runs tests/ctrl-c/run.sh — SIGINT/SIGTERM
# delivered to the process group (terminal-style) and to the PID directly,
# with pcntl-interaction and open-connection cases.
#
# Bugs found by this harness (03-pcntl-after hang, 04-pcntl-before SEGV,
# identical on macOS and Linux) are fixed by the #109 pair: php-src
# 109-zend-sigaction-hook (zend_sigaction delegates to the reactor) +
# php-async fix-signal-pcntl-clobber — all scenarios are expected green.
on:
workflow_dispatch:
pull_request:
paths:
- 'tests/ctrl-c/**'
- '.github/workflows/ctrl-c.yml'
env:
# TODO: back to `true-async` / `main` after the #109 sigaction-hook pair merges
# (php-src 109-zend-sigaction-hook + php-async fix-signal-pcntl-clobber).
PHP_SRC_BRANCH: 109-zend-sigaction-hook
PHP_ASYNC_BRANCH: fix-signal-pcntl-clobber
CCACHE_DIR: /tmp/ccache
jobs:
# --------------------------------------------------------------------
# macOS — the platform the issue was reported on.
# --------------------------------------------------------------------
ctrl-c-macos:
name: "CTRLC_MACOS_ARM64"
runs-on: macos-14
timeout-minutes: 60
steps:
- name: Checkout http_server
uses: actions/checkout@v5
with:
path: http-server
- name: Clone php-src (true-async) + ext/async
run: |
git clone --depth=1 --branch="$PHP_SRC_BRANCH" \
https://github.com/true-async/php-src php-src
git clone --depth=1 --branch="$PHP_ASYNC_BRANCH" \
https://github.com/true-async/php-async php-src/ext/async
- name: Resolve source SHAs for ccache key
id: shas
run: |
echo "php_src=$(git -C php-src rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
echo "php_async=$(git -C php-src/ext/async rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Restore ccache
uses: actions/cache@v5
with:
path: /tmp/ccache
key: ctrlc-ccache-macos14-${{ steps.shas.outputs.php_src }}-${{ steps.shas.outputs.php_async }}
restore-keys: |
ctrlc-ccache-macos14-
- name: Install build dependencies (Homebrew)
run: |
set -x
brew update >/dev/null
formula_installer="$(brew --repo)"/Library/Homebrew/formula_installer.rb
code=" keg.link\(verbose: verbose\?"
sudo sed -Ei '' "s/$code.*/$code, overwrite: true\)/" "$formula_installer"
brew reinstall autoconf libsodium icu4c curl openssl@3
brew install bison re2c nghttp2 libuv libxml2 libiconv ccache
- name: Configure PHP base
working-directory: php-src
run: |
set -x
BREW_OPT="$(brew --prefix)/opt"
export PATH="$BREW_OPT/bison/bin:$PATH"
export PKG_CONFIG_PATH="$BREW_OPT/openssl@3/lib/pkgconfig:$BREW_OPT/curl/lib/pkgconfig:$BREW_OPT/libxml2/lib/pkgconfig:$BREW_OPT/icu4c/lib/pkgconfig:$BREW_OPT/libuv/lib/pkgconfig:$BREW_OPT/nghttp2/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
sed -i -e 's/Requires.private:.*//g' "$BREW_OPT/curl/lib/pkgconfig/libcurl.pc"
./buildconf --force
./configure \
CC="ccache clang" \
--prefix=/usr/local \
--disable-all \
--without-pear \
--enable-async \
--enable-pdo \
--with-pdo-mysql=mysqlnd \
--with-pdo-sqlite \
--enable-sockets \
--enable-posix \
--enable-pcntl \
--enable-opcache \
--with-openssl \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--disable-debug \
--enable-zts
- name: Build & install PHP base
working-directory: php-src
run: |
export PATH="$(brew --prefix)/opt/bison/bin:$PATH"
make -j"$(sysctl -n hw.logicalcpu)" >/dev/null
sudo make install
sudo mkdir -p /etc/php.d
echo "opcache.enable_cli=1" | sudo tee /etc/php.d/opcache.ini
ccache -s || true
- name: phpize + build http_server
working-directory: http-server
run: |
set -x
BREW_OPT="$(brew --prefix)/opt"
export PKG_CONFIG_PATH="$BREW_OPT/openssl@3/lib/pkgconfig:$BREW_OPT/nghttp2/lib/pkgconfig:$BREW_OPT/libuv/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
/usr/local/bin/phpize
./configure \
CC="ccache clang" \
--with-php-config=/usr/local/bin/php-config \
--enable-http-server \
--enable-http2 \
--disable-http3 \
--with-openssl \
--with-nghttp2="$BREW_OPT/nghttp2"
make -j"$(sysctl -n hw.logicalcpu)"
sudo make install
echo "extension=true_async_server.so" | sudo tee /etc/php.d/true_async_server.ini
ccache -s || true
- name: Show PHP info
run: |
/usr/local/bin/php -v
/usr/local/bin/php -m | grep -iE 'async|pcntl|sockets|server' || true
/usr/local/bin/php -i | grep -i 'zend signal' || true
- name: Run Ctrl+C harness
working-directory: http-server
run: bash tests/ctrl-c/run.sh /usr/local/bin/php
# --------------------------------------------------------------------
# Linux baseline — same harness on the platform where the issue was
# reported as "not reproducible". Uses distro packages (libuv 1.48
# satisfies the >= 1.45 floor) instead of the source-built stack.
# --------------------------------------------------------------------
ctrl-c-linux:
name: "CTRLC_LINUX_X64"
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Checkout http_server
uses: actions/checkout@v5
with:
path: http-server
- name: Clone php-src (true-async) + ext/async
run: |
git clone --depth=1 --branch="$PHP_SRC_BRANCH" \
https://github.com/true-async/php-src php-src
git clone --depth=1 --branch="$PHP_ASYNC_BRANCH" \
https://github.com/true-async/php-async php-src/ext/async
- name: Resolve source SHAs for ccache key
id: shas
run: |
echo "php_src=$(git -C php-src rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
echo "php_async=$(git -C php-src/ext/async rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Restore ccache
uses: actions/cache@v5
with:
path: /tmp/ccache
key: ctrlc-ccache-ubuntu24-${{ steps.shas.outputs.php_src }}-${{ steps.shas.outputs.php_async }}
restore-keys: |
ctrlc-ccache-ubuntu24-
- name: Install build dependencies (apt)
run: |
set -eux
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends \
autoconf bison build-essential re2c pkg-config ccache \
libxml2-dev libssl-dev libsqlite3-dev \
libuv1-dev libnghttp2-dev
- name: Configure & build PHP base
working-directory: php-src
run: |
set -eux
./buildconf --force
./configure \
CC="ccache gcc" \
--prefix=/usr/local \
--disable-all \
--without-pear \
--enable-async \
--enable-pdo \
--with-pdo-sqlite \
--enable-sockets \
--enable-posix \
--enable-pcntl \
--enable-opcache \
--with-openssl \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--disable-debug \
--enable-zts
make -j"$(nproc)" >/dev/null
sudo make install
sudo mkdir -p /etc/php.d
echo "opcache.enable_cli=1" | sudo tee /etc/php.d/opcache.ini
ccache -s || true
- name: phpize + build http_server
working-directory: http-server
run: |
set -eux
/usr/local/bin/phpize
./configure \
CC="ccache gcc" \
--with-php-config=/usr/local/bin/php-config \
--enable-http-server \
--enable-http2 \
--disable-http3 \
--with-openssl \
--with-nghttp2=/usr
make -j"$(nproc)"
sudo make install
echo "extension=true_async_server.so" | sudo tee /etc/php.d/true_async_server.ini
ccache -s || true
- name: Show PHP info
run: |
/usr/local/bin/php -v
/usr/local/bin/php -m | grep -iE 'async|pcntl|sockets|server' || true
/usr/local/bin/php -i | grep -i 'zend signal' || true
- name: Run Ctrl+C harness
working-directory: http-server
run: bash tests/ctrl-c/run.sh /usr/local/bin/php