-
Notifications
You must be signed in to change notification settings - Fork 8
206 lines (183 loc) · 9.44 KB
/
Copy pathci.yml
File metadata and controls
206 lines (183 loc) · 9.44 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
name: CI
on:
push:
branches: [master]
pull_request:
jobs:
test:
name: PG ${{ matrix.pg }} / PHP ${{ matrix.php }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
# Every supported PostgreSQL against the distro PHP...
pg: [11, 12, 13, 14, 15, 16, 17, 18]
php: ["8.3"]
# ...plus the other supported PHP versions against the newest PG.
include:
- { pg: 18, php: "8.1" }
- { pg: 18, php: "8.2" }
- { pg: 18, php: "8.4" }
steps:
- uses: actions/checkout@v4
- name: Add the PGDG apt repository
run: |
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
-o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc
echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
| sudo tee /etc/apt/sources.list.d/pgdg.list
- name: Add the ondrej/php PPA (non-distro PHP versions)
if: matrix.php != '8.3'
run: sudo add-apt-repository -y ppa:ondrej/php
- name: Install PostgreSQL ${{ matrix.pg }} and PHP ${{ matrix.php }}
run: |
sudo apt-get update
sudo apt-get install -y \
postgresql-${{ matrix.pg }} postgresql-server-dev-${{ matrix.pg }} \
php${{ matrix.php }}-dev libphp${{ matrix.php }}-embed php${{ matrix.php }}-xml
php-config${{ matrix.php }} --php-sapis | grep -q embed
- name: Build and install PL/php
run: |
make PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg }}/bin/pg_config \
PHP_CONFIG=php-config${{ matrix.php }}
sudo make PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg }}/bin/pg_config \
PHP_CONFIG=php-config${{ matrix.php }} install
- name: Build and install jsonb_plphp
run: |
make -C jsonb_plphp \
PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg }}/bin/pg_config \
PHP_CONFIG=php-config${{ matrix.php }}
sudo make -C jsonb_plphp \
PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg }}/bin/pg_config \
PHP_CONFIG=php-config${{ matrix.php }} install
- name: Build and install hstore_plphp
run: |
make -C hstore_plphp \
PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg }}/bin/pg_config \
PHP_CONFIG=php-config${{ matrix.php }}
sudo make -C hstore_plphp \
PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg }}/bin/pg_config \
PHP_CONFIG=php-config${{ matrix.php }} install
- name: Build and install bytea_plphp
run: |
make -C bytea_plphp \
PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg }}/bin/pg_config \
PHP_CONFIG=php-config${{ matrix.php }}
sudo make -C bytea_plphp \
PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg }}/bin/pg_config \
PHP_CONFIG=php-config${{ matrix.php }} install
- name: Start the cluster
run: |
# the runner image disables automatic cluster creation
sudo pg_createcluster ${{ matrix.pg }} main 2>/dev/null || true
sudo pg_ctlcluster ${{ matrix.pg }} main start
pg_lsclusters
- name: Run the regression tests
run: |
port=$(pg_lsclusters | awk '$1 == "${{ matrix.pg }}" && $2 == "main" { print $3 }')
# let the postgres user reach and write the workspace
sudo chmod a+x /home/runner /home/runner/work /home/runner/work/PL-php
chmod -R a+rwX .
sudo -u postgres env PGPORT=$port \
make PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg }}/bin/pg_config installcheck
- name: Run the jsonb_plphp regression tests
run: |
port=$(pg_lsclusters | awk '$1 == "${{ matrix.pg }}" && $2 == "main" { print $3 }')
sudo -u postgres env PGPORT=$port \
make -C jsonb_plphp \
PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg }}/bin/pg_config installcheck
- name: Run the hstore_plphp regression tests
run: |
port=$(pg_lsclusters | awk '$1 == "${{ matrix.pg }}" && $2 == "main" { print $3 }')
sudo -u postgres env PGPORT=$port \
make -C hstore_plphp \
PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg }}/bin/pg_config installcheck
- name: Run the bytea_plphp regression tests
run: |
port=$(pg_lsclusters | awk '$1 == "${{ matrix.pg }}" && $2 == "main" { print $3 }')
sudo -u postgres env PGPORT=$port \
make -C bytea_plphp \
PG_CONFIG=/usr/lib/postgresql/${{ matrix.pg }}/bin/pg_config installcheck
- name: Show regression diffs on failure
if: failure()
run: |
cat regression.diffs 2>/dev/null || true
cat jsonb_plphp/regression.diffs 2>/dev/null || true
cat hstore_plphp/regression.diffs 2>/dev/null || true
cat bytea_plphp/regression.diffs 2>/dev/null || true
asan:
name: ASAN (PG 18 / PHP 8.3)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Add the PGDG apt repository
run: |
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
-o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc
echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
| sudo tee /etc/apt/sources.list.d/pgdg.list
- name: Install PostgreSQL 18 and PHP 8.3
run: |
sudo apt-get update
sudo apt-get install -y postgresql-18 postgresql-server-dev-18 \
php8.3-dev libphp8.3-embed
- name: Build and install with AddressSanitizer
run: |
make PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config PHP_CONFIG=php-config8.3 \
ASAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
sudo make PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config PHP_CONFIG=php-config8.3 \
ASAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer" install
make -C jsonb_plphp PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config PHP_CONFIG=php-config8.3 \
ASAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
sudo make -C jsonb_plphp PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config PHP_CONFIG=php-config8.3 \
ASAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer" install
make -C hstore_plphp PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config PHP_CONFIG=php-config8.3 \
ASAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
sudo make -C hstore_plphp PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config PHP_CONFIG=php-config8.3 \
ASAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer" install
make -C bytea_plphp PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config PHP_CONFIG=php-config8.3 \
ASAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
sudo make -C bytea_plphp PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config PHP_CONFIG=php-config8.3 \
ASAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer" install
- name: Start the cluster with libasan preloaded
run: |
sudo pg_createcluster 18 main 2>/dev/null || true
libasan=$(gcc -print-file-name=libasan.so)
# PHP_INI_SCAN_DIR= : PHP dlopens shared extensions with
# RTLD_DEEPBIND, which the sanitizer runtime rejects
sudo -u postgres env LD_PRELOAD=$libasan PHP_INI_SCAN_DIR= \
ASAN_OPTIONS=detect_leaks=0:abort_on_error=1:log_path=/tmp/asan \
/usr/lib/postgresql/18/bin/pg_ctl -w -t 120 \
-D /var/lib/postgresql/18/main \
-o "-c config_file=/etc/postgresql/18/main/postgresql.conf" \
-l /tmp/pg-asan.log start
- name: Run the regression tests under ASAN
run: |
port=$(pg_lsclusters | awk '$1 == 18 && $2 == "main" { print $3 }')
sudo chmod a+x /home/runner /home/runner/work /home/runner/work/PL-php
chmod -R a+rwX .
# the cookbook test needs SimpleXML, unavailable with extensions off
tests=$(grep '^REGRESS' Makefile | sed 's/REGRESS = //; s/ cookbook//')
sudo -u postgres env PGPORT=$port \
make PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config \
REGRESS="$tests" installcheck
sudo -u postgres env PGPORT=$port \
make -C jsonb_plphp \
PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config installcheck
sudo -u postgres env PGPORT=$port \
make -C hstore_plphp \
PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config installcheck
sudo -u postgres env PGPORT=$port \
make -C bytea_plphp \
PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config installcheck
- name: Show ASAN reports and diffs on failure
if: failure()
run: |
sudo cat /tmp/asan.* 2>/dev/null || true
sudo tail -50 /tmp/pg-asan.log 2>/dev/null || true
cat regression.diffs 2>/dev/null || true
cat jsonb_plphp/regression.diffs 2>/dev/null || true
cat hstore_plphp/regression.diffs 2>/dev/null || true
cat bytea_plphp/regression.diffs 2>/dev/null || true