Skip to content

Conversation

@jumski
Copy link
Contributor

@jumski jumski commented Nov 25, 2025

Optimize CI by Pre-starting Supabase for Affected Packages

This PR improves CI performance by intelligently pre-starting Supabase instances for affected packages. The implementation:

  1. Adds a new CI step that pre-starts Supabase for packages that need it

  2. Creates a new script ci-prestart-supabase.sh that:

    • Identifies affected packages requiring Supabase
    • Starts the first instance sequentially (to pull Docker images)
    • Starts remaining instances in parallel (saving ~1 minute per CI run)
  3. Adds supabase:ci-marker targets to packages that require Supabase:

    • core
    • client
    • edge-worker

This optimization reduces CI time by avoiding redundant Docker image pulls and parallelizing container startup, which typically takes ~28 seconds even with cached images.

@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2025

⚠️ No Changeset found

Latest commit: 76aeb5a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor Author

jumski commented Nov 25, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge:queue - adds this PR to the back of the merge queue
  • hotfix:queue - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@nx-cloud
Copy link

nx-cloud bot commented Nov 25, 2025

View your CI Pipeline Execution ↗ for commit 76aeb5a

Command Status Duration Result
nx affected -t verify-exports --base=origin/mai... ✅ Succeeded 2s View ↗
nx affected -t build --configuration=production... ✅ Succeeded 29s View ↗
nx affected -t lint typecheck test --parallel -... ✅ Succeeded 3m 44s View ↗
nx affected -t test:e2e --parallel --base=origi... ✅ Succeeded 4m 7s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-25 09:50:13 UTC

@jumski jumski force-pushed the 11-25-pre-start_supabase_in_ci branch 2 times, most recently from 10d531a to 2ffb78b Compare November 25, 2025 08:25
@jumski jumski force-pushed the 11-25-pre-start_supabase_in_ci branch from 2ffb78b to 76aeb5a Compare November 25, 2025 08:33
echo "Preparing Supabase for client..."
mkdir -p "$PKG_DIR/supabase/migrations/"
rm -f "$PKG_DIR/supabase/migrations/"*.sql
cp "$PKG_DIR/../core/supabase/migrations/"*.sql "$PKG_DIR/supabase/migrations/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wildcard *.sql will cause the script to fail if no SQL migration files exist in the core package. Since the script uses set -e, the cp command will exit with an error when the wildcard doesn't match any files, breaking the CI pipeline.

Fix: Add a check before copying or use a glob pattern that won't fail:

if ls "$PKG_DIR/../core/supabase/migrations/"*.sql 1> /dev/null 2>&1; then
  cp "$PKG_DIR/../core/supabase/migrations/"*.sql "$PKG_DIR/supabase/migrations/"
fi

Or use shopt -s nullglob to make unmatched globs expand to nothing.

Suggested change
cp "$PKG_DIR/../core/supabase/migrations/"*.sql "$PKG_DIR/supabase/migrations/"
if ls "$PKG_DIR/../core/supabase/migrations/"*.sql 1> /dev/null 2>&1; then
cp "$PKG_DIR/../core/supabase/migrations/"*.sql "$PKG_DIR/supabase/migrations/"
fi

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 25, 2025

Merge activity

  • Nov 25, 9:49 AM UTC: jumski added this pull request to the Graphite merge queue.
  • Nov 25, 9:50 AM UTC: CI is running for this pull request on a draft pull request (#425) due to your merge queue CI optimization settings.
  • Nov 25, 9:51 AM UTC: Merged by the Graphite merge queue via draft PR: #425.

graphite-app bot pushed a commit that referenced this pull request Nov 25, 2025
# Optimize CI by Pre-starting Supabase for Affected Packages

This PR improves CI performance by intelligently pre-starting Supabase instances for affected packages. The implementation:

1. Adds a new CI step that pre-starts Supabase for packages that need it
2. Creates a new script `ci-prestart-supabase.sh` that:
   - Identifies affected packages requiring Supabase
   - Starts the first instance sequentially (to pull Docker images)
   - Starts remaining instances in parallel (saving ~1 minute per CI run)

3. Adds `supabase:ci-marker` targets to packages that require Supabase:
   - core
   - client
   - edge-worker

This optimization reduces CI time by avoiding redundant Docker image pulls and parallelizing container startup, which typically takes ~28 seconds even with cached images.
@github-actions
Copy link
Contributor

🔍 Preview Deployment: Website

Deployment successful!

🔗 Preview URL: https://pr-423.pgflow.pages.dev

📝 Details:

  • Branch: 11-25-pre-start_supabase_in_ci
  • Commit: bc5476a1e28d1c1b05b4866c7285037e2e5c50dd
  • View Logs

_Last updated: _

@graphite-app graphite-app bot closed this Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants