|
| 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 }} |
0 commit comments