-
Notifications
You must be signed in to change notification settings - Fork 1
230 lines (197 loc) · 6.84 KB
/
master-tests.yml
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
name: tests for latest PHP
on:
# push:
# pull_request:
workflow_dispatch:
schedule:
# upstream shivammathur/php-builder* run at 23:30+0000 per day
- cron: '42 3 * * *'
env:
SWOW_HAVE_SSL: 1
SWOW_HAVE_CURL: 1
jobs:
linux-tests:
name: PHP latest Test on ubuntu-latest
runs-on: "ubuntu-latest"
services:
postgres:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup extension dependencies
run: |
sudo apt-get update
sudo apt-get install -yqq libcurl4-openssl-dev
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: '8.4'
tools: phpize
# ini-values: pcov.directory=lib
# coverage: pcov
coverage: none
extensions: curl,openssl,sockets,ffi,pdo,pdo_pgsql
- name: Setup composer dependencies
run: composer update -o --ignore-platform-reqs
- name: Build Swow extension
run: |
cd ext
printf "\033[1mRun phpize\033[0m\n"
phpize
printf "\033[1mStart configure\033[0m\n"
./configure --enable-swow\
--enable-swow-debug \
--enable-swow-ssl \
--enable-swow-curl \
--enable-swow-pdo-pgsql
printf "\033[1mStart build Swow\033[0m\n"
make -j`nproc`
printf "\033[1mDone build Swow\033[0m\n"
php -d extension=.libs/swow.so --ri swow
printf "\033[1mInstall Swow\033[0m\n"
sudo make install-modules
- name: Run extension tests
id: test-extension
continue-on-error: true
run: |
TEST_SWOW_POSTGRESQL=1 composer test-extension
- name: Run library tests
id: test-library
continue-on-error: true
run: composer test-library
- name: Fail if test-extension failed
if: steps.test-extension.outcome != 'success'
run: exit 1
- name: Fail if test-library failed
if: steps.test-library.outcome != 'success'
run: exit 1
macos-tests:
name: PHP latest Test on macos-latest
runs-on: "macos-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup extension dependencies
run: |
brew install pkg-config
brew install openssl@3
brew install curl
brew install libpq postgresql
initdb --locale=C -E UTF-8 -U postgres "$HOME/pgsqldata"
pg_ctl -D "$HOME/pgsqldata" start
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: '8.4'
tools: phpize
# ini-values: pcov.directory=lib
# coverage: pcov
coverage: none
extensions: curl,openssl,sockets,ffi,pdo,pdo_pgsql
- name: Setup composer dependencies
run: composer update -o --ignore-platform-reqs
- name: Detect dependencies path from php-config
run: |
echo "OPENSSL_ROOT_DIR=$(php .github/workflows/detect-deps.php openssl)" >> $GITHUB_ENV
echo "CURL_ROOT_DIR=$(php .github/workflows/detect-deps.php curl)" >> $GITHUB_ENV
echo "PGSQL_ROOT_DIR=$(php .github/workflows/detect-deps.php libpq)" >> $GITHUB_ENV
- name: Build Swow extension
env:
CFLAGS: -I${{ env.OPENSSL_ROOT_DIR }}/include ${{ env.CFLAGS }}
CPPFLAGS: -I${{ env.OPENSSL_ROOT_DIR }}/include ${{ env.CPPFLAGS }}
LDFLAGS: -L${{ env.OPENSSL_ROOT_DIR }}/lib ${{ env.LDFLAGS }}
PKG_CONFIG_PATH: ${{ env.OPENSSL_ROOT_DIR }}/lib/pkgconfig:${{ env.PKG_CONFIG_PATH }}
run: |
cd ext
printf "\033[1mRun phpize\033[0m\n"
phpize
printf "\033[1mStart configure\033[0m\n"
./configure --enable-swow\
--enable-swow-debug \
--enable-swow-ssl=${{ env.OPENSSL_ROOT_DIR }} \
--enable-swow-curl=${{ env.CURL_ROOT_DIR }} \
--enable-swow-pdo-pgsql=${{ env.PGSQL_ROOT_DIR }}
printf "\033[1mStart build Swow\033[0m\n"
make -j`sysctl -n hw.logicalcpu`
printf "\033[1mDone build Swow\033[0m\n"
php -d extension=.libs/swow.so --ri swow
printf "\033[1mInstall Swow\033[0m\n"
make install-modules
- name: Run extension tests
id: test-extension
continue-on-error: true
run: |
TEST_SWOW_POSTGRESQL=1 composer test-extension
- name: Run library tests
id: test-library
continue-on-error: true
run: composer test-library
- name: Fail if test-extension failed
if: steps.test-extension.outcome != 'success'
run: exit 1
- name: Fail if test-library failed
if: steps.test-library.outcome != 'success'
run: exit 1
windows-tests:
name: PHP latest ${{ matrix.ts }} Test on Windows
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os: ['windows-2019']
ts: [ 'nts', 'ts' ]
max-parallel: 2
steps:
- name: Checkout
uses: actions/checkout@v4
# TODO: windows varient of setup-php seems to be so slow
# shell we add caches?
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: '8.4'
# ini-values: pcov.directory=lib
# coverage: pcov
coverage: none
extensions: curl,openssl,pdo,pdo_pgsql
env:
phpts: ${{ matrix.ts }}
- name: Build Swow extension
uses: ./.github/workflows/winext
with:
phpver: '8.4'
phpts: ${{ matrix.ts == 'ts' && '1' || '0' }}
ext-path: ./ext
tools-path: C:\tools\phpdev
conf-args: --enable-swow-debug --enable-swow-ssl --enable-swow-curl --enable-swow-pdo-pgsql
ext-name: swow
staging-deps: '1'
deps: openssl,libcurl,libssh2,zlib,nghttp2,libpq
- name: Setup composer dependencies
run: composer update -o --ignore-platform-reqs
- name: Run extension tests
shell: pwsh
id: test-extension
continue-on-error: true
run: |
& "${env:PGBIN}\initdb.exe" --locale=C -E UTF-8 -U postgres "C:\pgsqldata"
& "${env:PGBIN}\pg_ctl.exe" -D "C:\pgsqldata" start
${env:TEST_SWOW_POSTGRESQL} = "1"
composer test-extension
- name: Run library tests
shell: cmd
id: test-library
continue-on-error: true
run: composer test-library
- name: Fail if test-extension failed
if: steps.test-extension.outcome != 'success'
run: exit 1
- name: Fail if test-library failed
if: steps.test-library.outcome != 'success'
run: exit 1