Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/e2e-supabase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: E2E Supabase

on:
pull_request:
push:
branches: [main, v2]
workflow_dispatch:

permissions:
contents: read

env:
STRIPE_NPM_REGISTRY: https://npm.pkg.github.com

jobs:
e2e_supabase:
name: Supabase install + sync
runs-on: ubuntu-24.04-arm
timeout-minutes: 20

steps:
- name: Check required secrets
id: check
run: |
if [ -z "${{ secrets.E2E_SUPABASE_TOKEN }}" ] || [ -z "${{ secrets.E2E_SUPABASE_ORG }}" ] || [ -z "${{ secrets.STRIPE_SANDBOX_KEY }}" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "::warning::Skipped — E2E_SUPABASE_TOKEN, E2E_SUPABASE_ORG, or STRIPE_SANDBOX_KEY not set"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi

- uses: actions/checkout@v5
if: steps.check.outputs.skip == 'false'

- name: Install pnpm
if: steps.check.outputs.skip == 'false'
uses: pnpm/action-setup@v5

- name: Set up Node
if: steps.check.outputs.skip == 'false'
uses: actions/setup-node@v6
with:
node-version-file: ./.nvmrc
cache: pnpm

- name: Install dependencies & build
if: steps.check.outputs.skip == 'false'
run: pnpm install --frozen-lockfile && pnpm build

- name: Supabase install + sync e2e
if: steps.check.outputs.skip == 'false'
run: bash e2e/supabase.test.sh
env:
STRIPE_SANDBOX_KEY: ${{ secrets.STRIPE_SANDBOX_KEY }}
E2E_SUPABASE_TOKEN: ${{ secrets.E2E_SUPABASE_TOKEN }}
E2E_SUPABASE_ORG: ${{ secrets.E2E_SUPABASE_ORG }}
7 changes: 7 additions & 0 deletions apps/engine/src/cli/supabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const installCmd = defineCommand({
default: false,
description: 'Skip triggering the first sync immediately after install',
},
backfillConcurrency: {
type: 'string',
description: 'Number of time-range segments for parallel backfill (default: 200)',
},
},
async run({ args }) {
const token = args.token || process.env.SUPABASE_ACCESS_TOKEN
Expand Down Expand Up @@ -80,6 +84,9 @@ const installCmd = defineCommand({
syncIntervalSeconds: parseInt(args.syncInterval),
skipInitialSync: args.skipInitialSync,
supabaseManagementUrl: managementUrl,
backfillConcurrency: args.backfillConcurrency
? parseInt(args.backfillConcurrency)
: undefined,
})

console.log('Installation complete.')
Expand Down
6 changes: 5 additions & 1 deletion apps/supabase/src/edge-functions/stripe-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ Deno.serve(async (req) => {
state = undefined
}

const sourceConfig: SourceConfig = { api_key: stripeKey }
const backfillConcurrency = Number(Deno.env.get('BACKFILL_CONCURRENCY')) || undefined
const sourceConfig: SourceConfig = {
api_key: stripeKey,
backfill_concurrency: backfillConcurrency,
}
const destConfig: DestConfig = {
connection_string: dbUrl,
schema: schemaName,
Expand Down
11 changes: 9 additions & 2 deletions apps/supabase/src/supabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ export class SupabaseSetupClient {
rateLimit?: number,
syncIntervalSeconds?: number,
startTime?: number,
skipInitialSync?: boolean
skipInitialSync?: boolean,
backfillConcurrency?: number
): Promise<void> {
const trimmedStripeKey = stripeKey.trim()
if (!trimmedStripeKey.startsWith('sk_') && !trimmedStripeKey.startsWith('rk_')) {
Expand Down Expand Up @@ -450,6 +451,9 @@ export class SupabaseSetupClient {
if (syncIntervalSeconds != null) {
secrets.push({ name: 'SYNC_INTERVAL', value: String(syncIntervalSeconds) })
}
if (backfillConcurrency != null) {
secrets.push({ name: 'BACKFILL_CONCURRENCY', value: String(backfillConcurrency) })
}
await this.setSecrets(secrets)

// Deploy edge functions
Expand Down Expand Up @@ -511,6 +515,7 @@ export async function install(params: {
syncIntervalSeconds?: number
startTime?: number
skipInitialSync?: boolean
backfillConcurrency?: number
}): Promise<void> {
const {
supabaseAccessToken,
Expand All @@ -522,6 +527,7 @@ export async function install(params: {
syncIntervalSeconds,
startTime,
skipInitialSync,
backfillConcurrency,
} = params

const client = new SupabaseSetupClient({
Expand All @@ -538,7 +544,8 @@ export async function install(params: {
rateLimit,
syncIntervalSeconds,
startTime,
skipInitialSync
skipInitialSync,
backfillConcurrency
)
}

Expand Down
Loading