-
Notifications
You must be signed in to change notification settings - Fork 8
217 lines (198 loc) · 7.36 KB
/
Copy pathcoverage.yml
File metadata and controls
217 lines (198 loc) · 7.36 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
name: Coverage
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: coverage-${{ github.ref }}
cancel-in-progress: true
jobs:
coverage:
name: gcov + Codecov
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
MYSQL_TEST_HOST: 127.0.0.1
MYSQL_TEST_PORT: 3306
MYSQL_TEST_USER: root
MYSQL_TEST_PASSWD: root
MYSQL_TEST_DB: test
PDO_MYSQL_TEST_DSN: "mysql:host=127.0.0.1;dbname=test"
PDO_MYSQL_TEST_HOST: 127.0.0.1
PDO_MYSQL_TEST_USER: root
PDO_MYSQL_TEST_PASS: root
PDO_PGSQL_TEST_DSN: "pgsql:host=127.0.0.1 port=5432 dbname=test user=postgres password=postgres"
services:
mysql:
image: mysql:8.3
ports:
- 3306:3306
env:
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: root
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout php-async repo
uses: actions/checkout@v4
with:
path: async
- name: Clone php-src (true-async-stable)
run: git clone --depth=1 --branch=true-async-stable https://github.com/true-async/php-src php-src
- name: Copy php-async extension into php-src
run: |
mkdir -p php-src/ext/async
cp -r async/* php-src/ext/async/
- name: Install build dependencies
# Same dependency set as build-linux.yml so the coverage build uses
# the identical extension matrix (otherwise tests needing an omitted
# ext fail spuriously and coverage is measured on a different build).
run: |
set -x
sudo apt-get update -y
sudo apt-get install -y \
autoconf bison build-essential curl re2c lcov \
libxml2-dev libssl-dev pkg-config libargon2-dev \
libcurl4-openssl-dev libedit-dev libsodium-dev libsqlite3-dev \
libonig-dev libzip-dev libpng-dev libjpeg-dev libwebp-dev \
libfreetype6-dev libgmp-dev libldap2-dev libsasl2-dev libpq-dev \
libmysqlclient-dev libbz2-dev libenchant-2-dev libffi-dev \
libgdbm-dev liblmdb-dev libsnmp-dev libtidy-dev libxslt1-dev \
libicu-dev cmake ninja-build
# libuv >= 1.45 from source (matches the build workflows)
wget --tries=5 --waitretry=10 --retry-connrefused https://github.com/libuv/libuv/archive/v1.48.0.tar.gz
tar -xzf v1.48.0.tar.gz
cd libuv-1.48.0 && mkdir build && cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF
ninja && sudo ninja install && sudo ldconfig
cd ../..
# libcurl >= 7.87 from source (TrueAsync requirement)
wget --tries=5 --waitretry=10 --retry-connrefused https://github.com/curl/curl/releases/download/curl-8_5_0/curl-8.5.0.tar.gz
tar -xzf curl-8.5.0.tar.gz
cd curl-8.5.0
./configure --prefix=/usr/local --with-openssl --enable-shared --disable-static
make -j$(nproc) && sudo make install && sudo ldconfig
cd ..
- name: Configure PHP (gcov)
# Identical extension set to build-linux.yml (debug+zts leg) plus
# --enable-gcov; --enable-werror dropped (orthogonal to coverage,
# avoids a gcov-only warning breaking the build).
working-directory: php-src
run: |
set -x
./buildconf --force
./configure \
--enable-option-checking=fatal \
--prefix=/usr/local \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pgsql \
--with-pdo-pgsql \
--with-pdo-sqlite \
--without-pear \
--enable-gd \
--with-jpeg \
--with-webp \
--with-freetype \
--enable-exif \
--with-zip \
--with-zlib \
--enable-soap \
--enable-xmlreader \
--with-xsl \
--with-tidy \
--with-libxml \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \
--enable-pcntl \
--with-readline \
--enable-mbstring \
--with-curl \
--with-gettext \
--enable-sockets \
--with-bz2 \
--with-openssl \
--with-gmp \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--with-enchant \
--enable-sysvmsg \
--with-ffi \
--enable-zend-test \
--enable-dl-test=shared \
--with-ldap \
--with-ldap-sasl \
--enable-intl \
--with-mhash \
--with-sodium \
--enable-dba \
--with-lmdb \
--with-gdbm \
--with-snmp \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--enable-debug \
--enable-zts \
--enable-async \
--enable-gcov
- name: Build PHP
working-directory: php-src
run: make -j$(nproc) >/dev/null
- name: Install PHP
# Run the installed binary (like build-linux.yml) so tests that spawn
# the CLI web server (curl_cli_server_start / php_cli_server_start)
# find an absolute interpreter. gcda still lands in the build tree
# (compile-time absolute paths), so coverage is unaffected.
working-directory: php-src
run: sudo make install
- name: Generate chaos tests
working-directory: php-src/ext/async
run: PHP_BIN=/usr/local/bin/php bash fuzzy-tests/regen.sh
- name: Run test suite (produces .gcda)
working-directory: php-src/ext/async
continue-on-error: true
run: |
/usr/local/bin/php -v
/usr/local/bin/php ../../run-tests.php \
-q -j$(nproc) \
-g FAIL,BORK \
--no-progress \
--offline \
--set-timeout 120 \
.
- name: Capture coverage (lcov, ext/async only)
working-directory: php-src
run: |
lcov --capture --directory ext/async --base-directory . \
--no-external --gcov-tool gcov \
--ignore-errors gcov,source,graph \
--output-file coverage.info
lcov --extract coverage.info '*/ext/async/*' \
--ignore-errors source,graph \
--output-file coverage.info
lcov --list coverage.info || true
- name: Upload results to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: php-src/coverage.info
# Upload ONLY the ext/async-filtered lcov. Without these, the action
# auto-searches the workspace and runs its gcov plugin over the whole
# php-src build tree, so the % covers all of PHP (~17%) instead of
# ext/async (~77%).
disable_search: true
plugins: noop
flags: ext-async
name: ext-async-gcov
fail_ci_if_error: false