forked from paradedb/paradedb
-
Notifications
You must be signed in to change notification settings - Fork 0
461 lines (417 loc) · 20.8 KB
/
Copy pathtest-pg_search-antithesis.yml
File metadata and controls
461 lines (417 loc) · 20.8 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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# workflows/test-pg_search-antithesis.yml
#
# Test pg_search (Antithesis)
# Build the current commits of pg_search and the selected driver image(s) as
# Docker images, push them to Antithesis, and trigger one Antithesis test run
# per selected workload (stressgres and/or proptests).
name: Test pg_search (Antithesis)
on:
# Scheduled runs are only executed on paradedb-enterprise; on paradedb/paradedb
# (community) the job-level `if` below short-circuits the schedule trigger. The cron
# entry stays here so the same workflow file can be synced between the two repos.
schedule:
- cron: "0 2 * * 1,4" # At 02:00 UTC on Monday and Thursday (Sunday night and Wednesday night)
pull_request:
types: [labeled]
workflow_dispatch:
inputs:
workload:
type: choice
required: false
default: all
description: Which workload(s) to run on Antithesis
options:
- all
- stressgres
- proptests
duration:
type: string
required: false
description: Test duration (minutes, default 360, i.e., 6 hours)
notebook:
type: string
required: false
description: Antithesis notebook name (default 'paradedb')
emails:
type: string
required: false
description: Email recipients (default notifies developers@paradedb.com)
# No concurrency group since we want to allow multiple test runs to run simultaneously
env:
PG_VERSION: "18"
jobs:
# Resolve which workload(s) to run based on the trigger:
# - schedule: all
# - workflow_dispatch: from `inputs.workload` (default all)
# - pull_request labeled: `antithesis` => all, `antithesis-stressgres` => stressgres,
# `antithesis-proptests` => proptests, anything else => skip
#
# For pull_request triggers, also removes the triggering label up front so it
# can be re-applied to re-run.
setup:
name: Resolve Workloads
runs-on: ubuntu-latest
if: |
(github.event_name == 'schedule' && github.repository == 'paradedb/paradedb-enterprise')
|| github.event_name == 'workflow_dispatch'
|| (github.event_name == 'pull_request' && contains(fromJSON('["antithesis","antithesis-stressgres","antithesis-proptests"]'), github.event.label.name))
permissions:
pull-requests: write
outputs:
workloads: ${{ steps.compute.outputs.workloads }}
steps:
- name: Remove Trigger Label
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ github.event.pull_request.number }} \
--repo ${{ github.repository }} \
--remove-label "${{ github.event.label.name }}"
- id: compute
env:
EVENT: ${{ github.event_name }}
INPUT_WORKLOAD: ${{ github.event.inputs.workload }}
LABEL: ${{ github.event.label.name }}
run: |
set -euo pipefail
WORKLOADS='[]'
case "$EVENT" in
schedule)
WORKLOADS='["stressgres","proptests"]'
;;
workflow_dispatch)
case "${INPUT_WORKLOAD:-all}" in
stressgres) WORKLOADS='["stressgres"]' ;;
proptests) WORKLOADS='["proptests"]' ;;
all|"") WORKLOADS='["stressgres","proptests"]' ;;
esac
;;
pull_request)
case "$LABEL" in
antithesis) WORKLOADS='["stressgres","proptests"]' ;;
antithesis-stressgres) WORKLOADS='["stressgres"]' ;;
antithesis-proptests) WORKLOADS='["proptests"]' ;;
esac
;;
esac
echo "workloads=$WORKLOADS" >> "$GITHUB_OUTPUT"
echo "Resolved workloads: $WORKLOADS"
build-antithesis-pg_search-deb:
name: Build Antithesis pg_search .deb
runs-on:
- runs-on=${{ github.run_id }}
- family=m7a+m7i
- cpu=16
- ram=64
- image=ubuntu24-full-x64
- extras=s3-cache
- volume=80gb # default runner ships with 30GB — see https://runs-on.com/runners/linux/
container:
image: debian:13-slim
if: |
(github.event_name == 'schedule' && github.repository == 'paradedb/paradedb-enterprise')
|| github.event_name == 'workflow_dispatch'
|| (github.event_name == 'pull_request' && contains(fromJSON('["antithesis","antithesis-stressgres","antithesis-proptests"]'), github.event.label.name))
env:
COMMIT_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
steps:
- name: Install Dependencies
run: DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y sudo wget git ca-certificates curl gnupg gpg lsb-release pkg-config libssl-dev
- name: Checkout Git Repository
uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false # Disable cache on publish workflows
rustflags: "" # Use .cargo/config.toml target-cpu flags
- name: Retrieve OS Version
id: version
run: |
OS_VERSION="$(lsb_release -cs)"
echo "OS Version: $OS_VERSION"
echo "os_version=$OS_VERSION" >> $GITHUB_OUTPUT
- name: Install & Configure Supported PostgreSQL Version
run: |
# Create keyrings dir (works on Debian/Ubuntu)
sudo install -d -m 0755 /usr/share/keyrings
# Download PostgreSQL signing key & add PostgreSQL APT repository with signed-by
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /usr/share/keyrings/postgresql.asc > /dev/null
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/postgresql.asc] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Install PostgreSQL + build tooling
DEBIAN_FRONTEND=noninteractive sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y postgresql-${{ env.PG_VERSION }} postgresql-server-dev-${{ env.PG_VERSION }} debhelper devscripts dput gnupg binutils
# Add Postgres bin dir to PATH for subsequent steps
echo "/usr/lib/postgresql/${{ env.PG_VERSION }}/bin" >> "$GITHUB_PATH"
- name: Extract pgrx Version
id: pgrx
run: echo version=$(sed -nE 's/^pgrx = "=?([^"]+)"$/\1/p' Cargo.toml) >> $GITHUB_OUTPUT
- name: Cache pgrx binary
id: cache-pgrx
uses: actions/cache@v6
with:
path: ~/.cargo/bin/cargo-pgrx
key: cargo-pgrx-${{ steps.pgrx.outputs.version }}-${{ runner.os }}-${{ runner.arch }}
- name: Install pgrx
if: steps.cache-pgrx.outputs.cache-hit != 'true'
run: cargo install --locked cargo-pgrx --version ${{ steps.pgrx.outputs.version }} --debug
- name: Initialize pgrx environment
working-directory: pg_search/
run: |
PG_CONFIG_PATH="/usr/lib/postgresql/${{ env.PG_VERSION }}/bin/pg_config"
cargo pgrx init --pg${{ env.PG_VERSION }}=$PG_CONFIG_PATH
# The Antithesis build adds a sancov pass (-Cpasses=sancov-module) for coverage instrumentation.
# ThinLTO drops Rust symbols under that pass, producing a pg_search.so that fails to dlopen, so disable LTO here.
- name: Package pg_search Extension with pgrx
working-directory: pg_search/
run: |
sudo curl -fsSL -o /usr/lib/libvoidstar.so https://antithesis.com/assets/instrumentation/libvoidstar.so
PG_CONFIG_PATH="/usr/lib/postgresql/${{ env.PG_VERSION }}/bin/pg_config"
RUSTFLAGS="-Ccodegen-units=1 -Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=3 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Clink-args=-Wl,--build-id -lvoidstar" \
CARGO_PROFILE_RELEASE_WITH_DEBUG_LTO=off \
cargo pgrx package --profile=release-with-debug --pg-config "$PG_CONFIG_PATH"
# Catch the broken-symbol case above before shipping to Antithesis.
# Undefined Rust symbols (_ZN/_R) mean a broken .so; Postgres C symbols stay undefined and are fine.
- name: Verify pg_search Has No Unresolved Rust Symbols
run: |
LIB_PATH="target/release-with-debug/pg_search-pg${{ env.PG_VERSION }}/usr/lib/postgresql/${{ env.PG_VERSION }}/lib/pg_search.so"
undefined_rust="$(nm -D -u "$LIB_PATH" | awk '{print $NF}' | grep -E '^_(ZN|R)' || true)"
if [ -n "$undefined_rust" ]; then
echo "::error::pg_search.so has unresolved Rust symbols — the build is broken and would fail to load:"
echo "$undefined_rust"
exit 1
fi
echo "OK: pg_search.so has no unresolved Rust symbols"
- name: Split pg_search Debug Symbols
run: |
LIB_PATH="target/release-with-debug/pg_search-pg${{ env.PG_VERSION }}/usr/lib/postgresql/${{ env.PG_VERSION }}/lib/pg_search.so"
objcopy --only-keep-debug "${LIB_PATH}" "${LIB_PATH}.dbg"
objcopy --strip-debug "${LIB_PATH}"
objcopy --add-gnu-debuglink="${LIB_PATH}.dbg" "${LIB_PATH}"
- name: Create .deb Package
run: |
# Create installable package
mkdir archive
cp `find target/release-with-debug -type f -name "pg_search*"` archive
package_dir=pg_search-antithesis-${{ steps.version.outputs.os_version }}-amd64-pg${{ env.PG_VERSION }}-${{ env.COMMIT_SHA }}
mkdir -p ${package_dir}/usr/lib/postgresql/${{ env.PG_VERSION }}/lib
mkdir -p ${package_dir}/usr/share/postgresql/${{ env.PG_VERSION }}/extension
cp archive/*.so* ${package_dir}/usr/lib/postgresql/${{ env.PG_VERSION }}/lib
cp archive/*.control ${package_dir}/usr/share/postgresql/${{ env.PG_VERSION }}/extension
cp archive/*.sql ${package_dir}/usr/share/postgresql/${{ env.PG_VERSION }}/extension
# Create control file (package name cannot have underscore)
mkdir -p ${package_dir}/DEBIAN
CONTROL_FILE="${package_dir}/DEBIAN/control"
echo 'Package: postgresql-${{ env.PG_VERSION }}-pg-search' >> $CONTROL_FILE
echo 'Version: 0.0.0' >> $CONTROL_FILE
echo 'Section: database' >> $CONTROL_FILE
echo 'Priority: optional' >> $CONTROL_FILE
echo 'Architecture: amd64' >> $CONTROL_FILE
echo 'Depends: postgresql-${{ env.PG_VERSION }}' >> $CONTROL_FILE
echo 'Maintainer: ParadeDB <support@paradedb.com>' >> $CONTROL_FILE
echo 'Description: Postgres for Search and Analytics' >> $CONTROL_FILE
# Create .deb package
sudo chown -R root:root ${package_dir}
sudo chmod -R 755 ${package_dir}
sudo dpkg-deb -Zxz --build --root-owner-group ${package_dir}
- name: Upload pg_search .deb
env:
ACTIONS_RESULTS_URL: https://results-receiver.actions.githubusercontent.com/
ACTIONS_CACHE_SERVICE_V2: ""
uses: actions/upload-artifact@v7
with:
name: pg-search-antithesis-deb-${{ env.COMMIT_SHA }}
path: pg_search-antithesis-${{ steps.version.outputs.os_version }}-amd64-pg${{ env.PG_VERSION }}-${{ env.COMMIT_SHA }}.deb
retention-days: 1
antithesis-trigger-test-run:
name: Test pg_search via Antithesis (${{ matrix.workload }})
needs:
- setup
- build-antithesis-pg_search-deb
if: needs.setup.outputs.workloads != '[]'
# For pull_request events, github.sha is the synthetic refs/pull/<n>/merge SHA
# rather than the PR head — use the head SHA so image tags and the run
# description match commits visible in the PR's git history.
env:
COMMIT_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
runs-on:
# General-purpose m-family — Docker buildx is RAM-heavy.
# See https://runs-on.com/configuration/job-labels/ — runs in us-east-1.
- runs-on=${{ github.run_id }}
- family=m7a+m7i
- cpu=16
- ram=64
- image=ubuntu24-full-x64
- volume=80gb # default runner ships with 30GB — see https://runs-on.com/runners/linux/
- extras=s3-cache
strategy:
fail-fast: false
matrix:
workload: ${{ fromJSON(needs.setup.outputs.workloads) }}
steps:
- name: Checkout Git Repository
uses: actions/checkout@v7
with:
ref: ${{ env.COMMIT_SHA }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Download Antithesis pg_search .deb
env:
ACTIONS_RESULTS_URL: https://results-receiver.actions.githubusercontent.com/
ACTIONS_CACHE_SERVICE_V2: ""
uses: actions/download-artifact@v8
with:
name: pg-search-antithesis-deb-${{ env.COMMIT_SHA }}
path: docker
- name: Log Into Antithesis Registry
uses: docker/login-action@v4
with:
registry: us-central1-docker.pkg.dev
username: _json_key
password: ${{ secrets.ANTITHESIS_REGISTRY_KEY }}
# The pg_version-tag Docker tag syntax is necessary for our CloudNativePG Helm chart
- name: Extract Workload Metadata
id: extract-workload-metadata
uses: docker/metadata-action@v6
with:
images: us-central1-docker.pkg.dev/molten-verve-216720/paradedb-repository/paradedb
tags: |
type=raw,value=${{ env.PG_VERSION }}-${{ env.COMMIT_SHA }}
type=raw,value=antithesis-latest
# Antithesis only supports x86_64 instruction set
# https://antithesis.com/docs/getting_started/setup/?sid=6534.37&sterm=x86&marks=x86#containerize-your-software
- name: Build and Push Workload Docker Image to Antithesis Registry
uses: docker/build-push-action@v7
with:
context: docker
platforms: linux/amd64
file: docker/Dockerfile.antithesis-${{ env.PG_VERSION }}
push: true
tags: ${{ steps.extract-workload-metadata.outputs.tags }}
labels: ${{ steps.extract-workload-metadata.outputs.labels }}
build-args: |
COMMIT_SHA=${{ env.COMMIT_SHA }}
- name: Patch ParadeDB K8s Manifest With Workload Image Tagged With Git SHA
working-directory: docker/manifests/
run: |
sed -i "s|imageName: .*|imageName: us-central1-docker.pkg.dev/molten-verve-216720/paradedb-repository/paradedb:${{ env.PG_VERSION }}-${{ env.COMMIT_SHA }}|" antithesis-paradedb.yaml
cat antithesis-paradedb.yaml
- name: Patch Driver K8s Manifest With Driver Image Tagged With Git SHA
working-directory: docker/manifests/
run: |
sed -i "s|image: .*|image: us-central1-docker.pkg.dev/molten-verve-216720/paradedb-repository/${{ matrix.workload }}:${{ env.COMMIT_SHA }}|" antithesis-${{ matrix.workload }}.yaml
cat antithesis-${{ matrix.workload }}.yaml
- name: Extract Config Metadata
id: extract-config-metadata
uses: docker/metadata-action@v6
with:
images: us-central1-docker.pkg.dev/molten-verve-216720/paradedb-repository/paradedb-config-${{ matrix.workload }}
tags: |
type=raw,value=${{ env.COMMIT_SHA }}
type=raw,value=antithesis-latest
- name: Build and Push Config Docker Image to Antithesis Registry
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64
file: docker/Dockerfile.config.${{ matrix.workload }}
push: true
tags: ${{ steps.extract-config-metadata.outputs.tags }}
labels: ${{ steps.extract-config-metadata.outputs.labels }}
- name: Extract Driver Metadata
id: extract-driver-metadata
uses: docker/metadata-action@v6
with:
images: us-central1-docker.pkg.dev/molten-verve-216720/paradedb-repository/${{ matrix.workload }}
tags: |
type=raw,value=${{ env.COMMIT_SHA }}
type=raw,value=antithesis-latest
# Antithesis only supports x86_64 instruction set
# https://antithesis.com/docs/getting_started/setup/?sid=6534.37&sterm=x86&marks=x86#containerize-your-software
- name: Build and Push Driver Docker Image to Antithesis Registry
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64
file: docker/Dockerfile.${{ matrix.workload }}
push: true
tags: ${{ steps.extract-driver-metadata.outputs.tags }}
labels: ${{ steps.extract-driver-metadata.outputs.labels }}
# antithesis.duration is in minutes, 360 minutes = 6 hours
# antithesis.is_ephemeral ensures runs triggered from PRs don't impact the history
# antithesis.source ensures Community and Enteprise have separate histories
- name: Trigger Antithesis Test
uses: antithesishq/antithesis-trigger-action@v0.12
with:
notebook_name: ${{ github.event.inputs.notebook || 'paradedb' }}
tenant: paradedb
username: ${{ vars.ANTITHESIS_USERNAME }}
password: ${{ secrets.ANTITHESIS_PASSWORD }}
github_token: ${{ secrets.ANTITHESIS_GITHUB_TOKEN }}
config_image: us-central1-docker.pkg.dev/molten-verve-216720/paradedb-repository/paradedb-config-${{ matrix.workload }}:${{ env.COMMIT_SHA }}
images: us-central1-docker.pkg.dev/molten-verve-216720/paradedb-repository/paradedb:${{ env.PG_VERSION }}-${{ env.COMMIT_SHA }}
description: "[${{ github.repository }}] ${{ matrix.workload }} CI for ${{ github.ref_name }} (commit ${{ env.COMMIT_SHA }})"
email_recipients: ${{ github.event.inputs.emails || 'developers@paradedb.com' }}
additional_parameters: |-
antithesis.duration=${{ github.event.inputs.duration || (github.event_name == 'pull_request' && '60') || '360' }}
antithesis.is_ephemeral=${{ github.event_name == 'pull_request' }}
antithesis.source=paradedb
custom.network_fault_exclusion_patterns=coredns,${{ matrix.workload }}
custom.container_faults_stop_exclusion_patterns=coredns,${{ matrix.workload }},paradedb,cloudnative-pg,logical-replication-publisher
custom.container_faults_kill_exclusion_patterns=coredns,${{ matrix.workload }},paradedb,cloudnative-pg,logical-replication-publisher
# Ping Slack if any of the nightly (scheduled) jobs failed. Scheduled runs only execute on
# paradedb-enterprise (see the `if` on `setup`), so this notification only fires there.
notify-slack-on-failure:
name: Notify Slack on Failure
needs: [setup, build-antithesis-pg_search-deb, antithesis-trigger-test-run]
if: |
always()
&& github.event_name == 'schedule'
&& (needs.setup.result == 'failure'
|| needs.build-antithesis-pg_search-deb.result == 'failure'
|| needs.antithesis-trigger-test-run.result == 'failure')
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GITHUB_CHANNEL_WEBHOOK_URL }}
steps:
- name: Determine failed jobs
id: failed-jobs
run: |
FAILED_JOBS=""
if [ "${{ needs.setup.result }}" == "failure" ]; then
FAILED_JOBS="Resolve Workloads, $FAILED_JOBS"
fi
if [ "${{ needs.build-antithesis-pg_search-deb.result }}" == "failure" ]; then
FAILED_JOBS="Build Antithesis pg_search .deb, $FAILED_JOBS"
fi
if [ "${{ needs.antithesis-trigger-test-run.result }}" == "failure" ]; then
FAILED_JOBS="Test pg_search via Antithesis, $FAILED_JOBS"
fi
FAILED_JOBS="${FAILED_JOBS%, }"
echo "failed_jobs=$FAILED_JOBS" >> "$GITHUB_OUTPUT"
- name: Send Slack notification
run: |
if [ -n "$SLACK_WEBHOOK_URL" ]; then
JSON_DATA="{
\"text\": \"🚨 Nightly Antithesis Run Failed - <!here>\",
\"attachments\": [
{
\"color\": \"danger\",
\"fields\": [
{\"title\": \"Repository\", \"value\": \"${{ github.repository }}\", \"short\": true},
{\"title\": \"Workflow\", \"value\": \"${{ github.workflow }}\", \"short\": true},
{\"title\": \"Run ID\", \"value\": \"${{ github.run_id }}\", \"short\": true},
{\"title\": \"View Logs\", \"value\": \"<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here>\", \"short\": true},
{\"title\": \"Failed Jobs\", \"value\": \"${{ steps.failed-jobs.outputs.failed_jobs }}\", \"short\": false}
]
}
]
}"
curl -X POST -H 'Content-type: application/json' \
--data "$JSON_DATA" \
"$SLACK_WEBHOOK_URL"
else
echo "Slack webhook not configured, skipping notification"
fi