Skip to content

Commit ef77a54

Browse files
committed
ci: Add schema compatibility workflow to check API compat against paradedb
1 parent 9779c9a commit ef77a54

4 files changed

Lines changed: 596 additions & 0 deletions

File tree

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# workflows/schema-compat.yml
2+
#
3+
# Schema Compatibility Check
4+
# Validates that the sqlalchemy-paradedb API wrapper stays in sync with the
5+
# ParadeDB SQL schema and that integration tests pass against the new version.
6+
# Triggered automatically on each paradedb release (via repository_dispatch)
7+
# or manually via workflow_dispatch.
8+
9+
name: Schema Compatibility Check
10+
11+
on:
12+
repository_dispatch:
13+
types: [paradedb-release]
14+
workflow_dispatch:
15+
inputs:
16+
version:
17+
description: "ParadeDB version to check against"
18+
required: true
19+
20+
concurrency:
21+
group: schema-compat-${{ github.head_ref || github.ref }}
22+
cancel-in-progress: true
23+
24+
env:
25+
PARADEDB_VERSION: ${{ inputs.version || github.event.client_payload.version }}
26+
27+
jobs:
28+
schema-compat:
29+
name: Check Schema Compatibility
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v6
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v6
37+
with:
38+
python-version: "3.13"
39+
40+
- name: Download pg_search.schema.sql
41+
env:
42+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
run: |
44+
gh release download "v${{ env.PARADEDB_VERSION }}" \
45+
--repo paradedb/paradedb \
46+
--pattern pg_search.schema.sql
47+
48+
- name: Run Schema Compatibility Check
49+
run: python scripts/check_schema_compat.py pg_search.schema.sql api.json
50+
51+
integration-tests:
52+
name: Integration Tests
53+
runs-on: ubuntu-latest
54+
55+
services:
56+
paradedb:
57+
image: paradedb/paradedb:${{ inputs.version || github.event.client_payload.version }}-pg18
58+
env:
59+
POSTGRES_USER: postgres
60+
POSTGRES_PASSWORD: postgres
61+
POSTGRES_DB: postgres
62+
ports:
63+
- 5432:5432
64+
options: >-
65+
--health-cmd "pg_isready -U postgres -d postgres"
66+
--health-interval 10s
67+
--health-timeout 5s
68+
--health-retries 12
69+
70+
env:
71+
PARADEDB_TEST_DSN: postgresql+psycopg://postgres:postgres@localhost:5432/postgres
72+
DATABASE_URL: postgresql+psycopg://postgres:postgres@localhost:5432/postgres
73+
PGPASSWORD: postgres
74+
75+
steps:
76+
- name: Checkout
77+
uses: actions/checkout@v6
78+
79+
- name: Set up Python
80+
uses: actions/setup-python@v6
81+
with:
82+
python-version: "3.13"
83+
84+
- name: Set up uv
85+
uses: astral-sh/setup-uv@v6
86+
with:
87+
enable-cache: true
88+
89+
- name: Install dependencies
90+
run: |
91+
uv venv --python "3.13"
92+
uv sync --extra test
93+
94+
- name: Install pg client
95+
run: sudo apt-get update && sudo apt-get install -y postgresql-client
96+
97+
- name: Wait for ParadeDB
98+
run: |
99+
for i in {1..30}; do
100+
pg_isready -h localhost -p 5432 -U postgres -d postgres && exit 0
101+
sleep 2
102+
done
103+
echo "ParadeDB did not become ready" >&2
104+
exit 1
105+
106+
- name: Run unit tests
107+
run: uv run --no-sync pytest tests/unit
108+
109+
- name: Run integration tests
110+
run: uv run --no-sync pytest -m integration
111+
112+
notify:
113+
name: Notify on Failure
114+
runs-on: ubuntu-latest
115+
needs: [schema-compat, integration-tests]
116+
if: failure()
117+
steps:
118+
- name: Create GitHub Issue
119+
env:
120+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
run: |
122+
gh issue create \
123+
--repo ${{ github.repository }} \
124+
--title "Schema compat failure for ParadeDB v${{ env.PARADEDB_VERSION }}" \
125+
--body "$(cat <<EOF
126+
The schema compatibility check or integration tests failed against ParadeDB **v${{ env.PARADEDB_VERSION }}**.
127+
128+
**Workflow run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
129+
130+
Please investigate and update sqlalchemy-paradedb as needed.
131+
EOF
132+
)" \
133+
--label bug
134+
135+
- name: Notify Slack on Failure
136+
run: |
137+
GITHUB_RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
138+
MESSAGE="<!here> \`schema-compat\` workflow failed for ParadeDB v${{ env.PARADEDB_VERSION }} in \`${{ github.repository }}\` -- investigate immediately! GitHub Action Logs: ${GITHUB_RUN_URL}"
139+
curl -X POST -H 'Content-type: application/json' -d "{\"text\": \"${MESSAGE}\"}" ${{ secrets.SLACK_GITHUB_CHANNEL_WEBHOOK_URL }}

api.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"operators": {
3+
"OP_SEARCH": "@@@",
4+
"OP_AND": "&&&",
5+
"OP_OR": "|||",
6+
"OP_PHRASE": "###",
7+
"OP_PROXIMITY": "##",
8+
"OP_PROXIMITY_ORD": "##>",
9+
"OP_TERM": "==="
10+
},
11+
12+
"functions": {
13+
"FN_ALL": "pdb.all",
14+
"FN_PARSE": "pdb.parse",
15+
"FN_PHRASE_PREFIX": "pdb.phrase_prefix",
16+
"FN_REGEX_PHRASE": "pdb.regex_phrase",
17+
"FN_RANGE_TERM": "pdb.range_term",
18+
"FN_REGEX": "pdb.regex",
19+
"FN_PROX_REGEX": "pdb.prox_regex",
20+
"FN_PROX_ARRAY": "pdb.prox_array",
21+
"FN_MORE_LIKE_THIS": "pdb.more_like_this",
22+
"FN_EXISTS": "pdb.exists",
23+
24+
"FN_SCORE": "pdb.score",
25+
"FN_SNIPPET": "pdb.snippet",
26+
"FN_SNIPPETS": "pdb.snippets",
27+
"FN_SNIPPET_POSITIONS": "pdb.snippet_positions",
28+
"FN_AGG": "pdb.agg",
29+
30+
"FN_INDEXES": "pdb.indexes",
31+
"FN_INDEX_SEGMENTS": "pdb.index_segments",
32+
"FN_VERIFY_INDEX": "pdb.verify_index",
33+
"FN_VERIFY_ALL_INDEXES": "pdb.verify_all_indexes"
34+
},
35+
36+
"types": {
37+
"PDB_TYPE_BOOST": "pdb.boost",
38+
"PDB_TYPE_CONST": "pdb.const",
39+
"PDB_TYPE_FUZZY": "pdb.fuzzy",
40+
"PDB_TYPE_SLOP": "pdb.slop",
41+
"PDB_TYPE_QUERY": "pdb.query",
42+
"PDB_TYPE_PROXIMITYCLAUSE": "pdb.proximityclause",
43+
44+
"PDB_TYPE_TOKENIZER_ICU": "pdb.icu",
45+
"PDB_TYPE_TOKENIZER_LINDERA": "pdb.lindera",
46+
"PDB_TYPE_TOKENIZER_LITERAL": "pdb.literal",
47+
"PDB_TYPE_TOKENIZER_LITERAL_NORMALIZED": "pdb.literal_normalized",
48+
"PDB_TYPE_TOKENIZER_NGRAM": "pdb.ngram",
49+
"PDB_TYPE_TOKENIZER_REGEX": "pdb.regex_pattern",
50+
"PDB_TYPE_TOKENIZER_SIMPLE": "pdb.simple",
51+
"PDB_TYPE_TOKENIZER_UNICODE_WORDS": "pdb.unicode_words",
52+
"PDB_TYPE_TOKENIZER_WHITESPACE": "pdb.whitespace"
53+
}
54+
}

0 commit comments

Comments
 (0)