|
| 1 | +name: Integration — Supabase (EQL v3) |
| 2 | + |
| 3 | +# Real ZeroKMS ciphertext, a real PostgREST, and `supabase/postgres` — the only |
| 4 | +# job that proves the Supabase v3 adapter's queries return the right rows. The |
| 5 | +# unit suites drive a mock that records strings; they cannot. |
| 6 | +# |
| 7 | +# Separate from `tests.yml` on purpose: these suites need CipherStash credentials |
| 8 | +# and a database, and they THROW rather than skip when unconfigured. Keeping them |
| 9 | +# out of the unit job is what lets `pnpm test` stay runnable with neither. |
| 10 | + |
| 11 | +on: |
| 12 | + push: |
| 13 | + branches: [main] |
| 14 | + paths: |
| 15 | + - 'packages/stack/src/supabase/**' |
| 16 | + - 'packages/stack/src/eql/v3/**' |
| 17 | + - 'packages/stack/integration/**' |
| 18 | + - 'packages/test-kit/**' |
| 19 | + - 'packages/cli/src/installer/**' |
| 20 | + - 'local/docker-compose.supabase.yml' |
| 21 | + - 'local/supabase-init.sql' |
| 22 | + - '.github/workflows/integration-supabase.yml' |
| 23 | + - '.github/actions/integration-setup/**' |
| 24 | + pull_request: |
| 25 | + branches: ['**'] |
| 26 | + paths: |
| 27 | + - 'packages/stack/src/supabase/**' |
| 28 | + - 'packages/stack/src/eql/v3/**' |
| 29 | + - 'packages/stack/integration/**' |
| 30 | + - 'packages/test-kit/**' |
| 31 | + - 'packages/cli/src/installer/**' |
| 32 | + - 'local/docker-compose.supabase.yml' |
| 33 | + - 'local/supabase-init.sql' |
| 34 | + - '.github/workflows/integration-supabase.yml' |
| 35 | + - '.github/actions/integration-setup/**' |
| 36 | + |
| 37 | +jobs: |
| 38 | + integration: |
| 39 | + name: Supabase v3 integration (db=${{ matrix.db }}) |
| 40 | + runs-on: blacksmith-4vcpu-ubuntu-2404 |
| 41 | + # Fork PRs have no secrets. Skip cleanly rather than fail loudly on something |
| 42 | + # the contributor cannot fix — `tests.yml` still gives them a green signal. |
| 43 | + if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} |
| 44 | + |
| 45 | + strategy: |
| 46 | + # A one-element matrix, not a cross-product: the Supabase adapter only ever |
| 47 | + # runs against the Supabase variant. Kept as a matrix so adding a second |
| 48 | + # database is a one-line change. |
| 49 | + matrix: |
| 50 | + db: [supabase] |
| 51 | + |
| 52 | + env: |
| 53 | + CS_WORKSPACE_CRN: ${{ secrets.CS_WORKSPACE_CRN }} |
| 54 | + CS_CLIENT_ID: ${{ secrets.CS_CLIENT_ID }} |
| 55 | + CS_CLIENT_KEY: ${{ secrets.CS_CLIENT_KEY }} |
| 56 | + CS_CLIENT_ACCESS_KEY: ${{ secrets.CS_CLIENT_ACCESS_KEY }} |
| 57 | + # Job-level env, not a `.env` file: `dotenv/config` does not override an |
| 58 | + # already-set `process.env`, so these win and no secret is written to disk. |
| 59 | + # |
| 60 | + # `postgres` here is deliberately NOT a superuser on this image — that is |
| 61 | + # what makes the EQL install, the grants, and the ORE opclass skip behave |
| 62 | + # as they do on a real Supabase project. |
| 63 | + DATABASE_URL: postgres://postgres:password@localhost:55433/postgres |
| 64 | + PGRST_URL: http://localhost:55430 |
| 65 | + # Scoped to the suites this database serves. The Drizzle suites talk to |
| 66 | + # plain Postgres and get their own job; the harness and bloom suites are |
| 67 | + # adapter-agnostic and run here because a database is already up. |
| 68 | + CS_IT_SUITE: >- |
| 69 | + integration/supabase/**/*.integration.test.ts, |
| 70 | + integration/harness.integration.test.ts, |
| 71 | + integration/match-bloom.integration.test.ts |
| 72 | +
|
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v6 |
| 75 | + - uses: ./.github/actions/integration-setup |
| 76 | + |
| 77 | + # Fast pre-flight: fail in seconds if a secret was rotated or cleared, |
| 78 | + # before paying for the ~2 GB supabase/postgres pull. The in-test |
| 79 | + # `requireIntegrationEnv` is the correctness guarantee; this is the cheap one. |
| 80 | + - name: Require CipherStash secrets |
| 81 | + uses: ./.github/actions/require-cs-secrets |
| 82 | + with: |
| 83 | + workspace-crn: ${{ secrets.CS_WORKSPACE_CRN }} |
| 84 | + client-id: ${{ secrets.CS_CLIENT_ID }} |
| 85 | + client-key: ${{ secrets.CS_CLIENT_KEY }} |
| 86 | + client-access-key: ${{ secrets.CS_CLIENT_ACCESS_KEY }} |
| 87 | + |
| 88 | + - name: Start ${{ matrix.db }} |
| 89 | + run: docker compose -f local/docker-compose.${{ matrix.db }}.yml up -d --wait |
| 90 | + |
| 91 | + # `globalSetup` installs EQL v3 by shelling out to the real |
| 92 | + # `stash eql install --eql-version 3 --supabase --direct`, so an installer |
| 93 | + # regression fails here rather than hiding behind a test-only SQL apply. |
| 94 | + - name: Supabase v3 integration suites |
| 95 | + run: pnpm --filter @cipherstash/stack run test:integration |
| 96 | + |
| 97 | + - name: Stop ${{ matrix.db }} |
| 98 | + if: always() |
| 99 | + run: docker compose -f local/docker-compose.${{ matrix.db }}.yml down -v |
0 commit comments