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
19 changes: 19 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: 'Setup pgflow workspace'
description: 'Common setup steps for pgflow CI workflow (run after checkout)'

inputs:
atlas-cloud-token:
description: 'Atlas Cloud token for schema verification'
required: false

runs:
using: 'composite'
steps:
Expand All @@ -16,6 +21,20 @@ runs:
cache-dependency-path: |
**/pnpm-lock.yaml
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: '1.45.2'

- name: Install sqruff
uses: quarylabs/install-sqruff-cli-action@main
Comment on lines +29 to +30
Copy link
Contributor

Choose a reason for hiding this comment

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

This step is failing because the 'quarylabs/install-sqruff-cli-action@main' action cannot successfully download and install the sqruff-linux-x86_64-musl.tar.gz file. Either pin this action to a specific stable version (e.g., 'quarylabs/install-sqruff-cli-action@v1.0.0') instead of using the potentially unstable '@main' reference, or temporarily remove this step until the upstream action is fixed.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


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


- name: Setup Atlas
if: inputs.atlas-cloud-token != ''
uses: ariga/setup-atlas@master
with:
cloud-token: ${{ inputs.atlas-cloud-token }}

- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile --prefer-offline
175 changes: 139 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ permissions:
deployments: write # Netlify action needs it

jobs:
# ─────────────────────────────────────── 1. BUILD & TEST ──────────────────────────────────────
build-and-test:
# ─────────────────────────────────────── 1. DB VERIFICATION ──────────────────────────────────────
db-verification:
runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
Expand All @@ -27,35 +27,50 @@ jobs:
fetch-depth: 0

- uses: ./.github/actions/setup

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: '1.45.2'
atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}

- name: Set Nx SHAs for affected commands
uses: nrwl/nx-set-shas@v4

- name: Verify NX_BASE and NX_HEAD are set
run: echo "BASE=$NX_BASE HEAD=$NX_HEAD"

- name: Run database verification
run: pnpm nx run core:db:verify

- name: Install sqruff
uses: quarylabs/install-sqruff-cli-action@main

- name: Setup Atlas
uses: ariga/setup-atlas@master
# ─────────────────────────────────────── 2. FAST TESTS ──────────────────────────────────────
fast-tests:
needs: [db-verification]
runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup
with:
cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}
atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}

- name: Set Nx SHAs for affected commands
uses: nrwl/nx-set-shas@v4

- name: Verify NX_BASE and NX_HEAD are set
run: echo "BASE=$NX_BASE HEAD=$NX_HEAD"

- name: Quality gate (lint + typecheck + test)
- name: Lint, typecheck, build, and fast tests
run: pnpm nx affected -t lint typecheck test --parallel --configuration=production --base="$NX_BASE" --head="$NX_HEAD"

- name: Build all affected projects (except playground)
run: pnpm nx affected -t build --configuration=production --parallel --exclude=playground --base="$NX_BASE" --head="$NX_HEAD"


# ─────────────────────────────────────── 2. EDGE-WORKER E2E ──────────────────────────────────────
edge-worker-e2e:
# ─────────────────────────────────────── 3. CLI LIVE TESTS ──────────────────────────────────────
cli-live-tests:
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider running live tests sequentially instead of in parallel by making cli-live-tests depend on db-verification, core-live-tests depend on cli-live-tests, client-live-tests depend on core-live-tests, and edge-worker-live-tests depend on client-live-tests. This would prevent resource conflicts at the cost of longer CI run times.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


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

needs: [db-verification]
runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
Expand All @@ -65,45 +80,133 @@ jobs:
fetch-depth: 0

- uses: ./.github/actions/setup
with:
atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}

- name: Setup Deno
uses: denoland/setup-deno@v2
- name: Set Nx SHAs for affected commands
uses: nrwl/nx-set-shas@v4

- name: Check if cli is affected
id: check-affected
run: |
if pnpm nx show projects --affected --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^cli$"; then
echo "affected=true" >> $GITHUB_OUTPUT
echo "CLI is affected by changes"
else
echo "affected=false" >> $GITHUB_OUTPUT
echo "CLI is not affected by changes - skipping"
fi
- name: Run cli live tests
if: steps.check-affected.outputs.affected == 'true'
run: pnpm nx run cli:test:live


# ─────────────────────────────────────── 4. CORE LIVE TESTS ──────────────────────────────────────
core-live-tests:
needs: [db-verification]
Comment on lines +106 to +107
Copy link
Contributor

Choose a reason for hiding this comment

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

The core-live-tests job should depend on fast-tests instead of db-verification to ensure it runs after fast-tests completes, creating a sequential chain of jobs.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


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

runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
deno-version: '1.45.2'
fetch-depth: 0

- name: Install sqruff
uses: quarylabs/install-sqruff-cli-action@main
- uses: ./.github/actions/setup
with:
atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}

- name: Setup Atlas
uses: ariga/setup-atlas@master
- name: Set Nx SHAs for affected commands
uses: nrwl/nx-set-shas@v4

- name: Check if core is affected
id: check-affected
run: |
if pnpm nx show projects --affected --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^core$"; then
echo "affected=true" >> $GITHUB_OUTPUT
echo "Core is affected by changes"
else
echo "affected=false" >> $GITHUB_OUTPUT
echo "Core is not affected by changes - skipping"
fi
- name: Run core live tests
if: steps.check-affected.outputs.affected == 'true'
run: pnpm nx run core:test:live


# ─────────────────────────────────────── 5. CLIENT LIVE TESTS ──────────────────────────────────────
client-live-tests:
needs: [db-verification]
runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup
with:
cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}
atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}

- name: Set Nx SHAs for affected commands
uses: nrwl/nx-set-shas@v4

- name: Verify NX_BASE and NX_HEAD are set
run: echo "BASE=$NX_BASE HEAD=$NX_HEAD"
- name: Check if client is affected
id: check-affected
run: |
if pnpm nx show projects --affected --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^client$"; then
echo "affected=true" >> $GITHUB_OUTPUT
echo "Client is affected by changes"
else
echo "affected=false" >> $GITHUB_OUTPUT
echo "Client is not affected by changes - skipping"
fi
- name: Run client live tests
if: steps.check-affected.outputs.affected == 'true'
run: pnpm nx run client:test:live


# ─────────────────────────────────────── 6. EDGE-WORKER LIVE TESTS ──────────────────────────────────────
edge-worker-live-tests:
needs: [db-verification]
runs-on: ubuntu-latest
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup
with:
atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}

- name: Check if edge-worker e2e tests are affected
- name: Set Nx SHAs for affected commands
uses: nrwl/nx-set-shas@v4

- name: Check if edge-worker is affected
id: check-affected
run: |
if pnpm nx show projects --affected -t test:e2e --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^edge-worker$"; then
if pnpm nx show projects --affected --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^edge-worker$"; then
echo "affected=true" >> $GITHUB_OUTPUT
echo "Edge-worker e2e tests are affected by changes"
echo "Edge-worker is affected by changes"
else
echo "affected=false" >> $GITHUB_OUTPUT
echo "Edge-worker e2e tests are not affected by changes - skipping"
echo "Edge-worker is not affected by changes - skipping"
fi
- name: Run edge-worker e2e tests
- name: Run edge-worker live tests
if: steps.check-affected.outputs.affected == 'true'
run: pnpm nx affected -t test:e2e --parallel --base="$NX_BASE" --head="$NX_HEAD"
run: pnpm nx run edge-worker:test:live
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a timeout to prevent the edge-worker live tests from being terminated prematurely. Change to: run: pnpm nx run edge-worker:test:live --timeout=10m

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


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



# ────────────────────────────────── 3. DEPLOY PLAYGROUND ───────────────────────────
# ────────────────────────────────── 7. DEPLOY PLAYGROUND ───────────────────────────
deploy-playground:
needs: [build-and-test, edge-worker-e2e]
needs: [fast-tests]
if: false # Disabled
# if: >-
# ${{
Expand Down Expand Up @@ -143,9 +246,10 @@ jobs:
preview-url: https://pr-${{ github.event.pull_request.number }}--pgflow-demo.netlify.app
production-url: https://playground.pgflow.dev

# ────────────────────────────────── 4. DEPLOY WEBSITE ───────────────────────────

# ────────────────────────────────── 8. DEPLOY WEBSITE ───────────────────────────
deploy-website:
needs: [build-and-test, edge-worker-e2e]
needs: [fast-tests, cli-live-tests, core-live-tests, client-live-tests, edge-worker-live-tests]
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'pull_request' && 'preview' || 'production' }}
env:
Expand Down Expand Up @@ -177,7 +281,7 @@ jobs:
echo "affected=false" >> $GITHUB_OUTPUT
echo "Website is not affected by changes - skipping deployment"
fi
- name: Deploy website
id: deploy-website
if: steps.check-affected.outputs.affected == 'true'
Expand All @@ -197,4 +301,3 @@ jobs:
project-name: Website
preview-url: https://pr-${{ github.event.pull_request.number }}.pgflow.pages.dev
production-url: https://pgflow.dev

25 changes: 23 additions & 2 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,23 @@
"preview": {
"dependsOn": ["^build"]
},
"supabase:*": {
"supabase:start": {
"local": true,
"cache": false
},
"supabase:stop": {
"local": true,
"cache": false
},
"supabase:status": {
"local": true,
"cache": false
},
"supabase:reset": {
"local": true,
"cache": false
},
"supabase:restart": {
"local": true,
"cache": false
},
Expand All @@ -94,9 +110,14 @@
"local": true
},
"verify-*": {
"local": true,
"cache": true
},
"db:verify": {
"cache": true
},
"test:live": {
"local": true
},
"dump-realtime-schema": {
"local": true,
"cache": true
Expand Down
1 change: 1 addition & 0 deletions pkgs/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"module": "./dist/index.js",
"devDependencies": {
"@types/node": "^22.14.1",
"supabase": "^2.34.3",
"tsx": "^4.19.3"
},
"dependencies": {
Expand Down
19 changes: 10 additions & 9 deletions pkgs/cli/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,23 @@
}
},
"test": {
"executor": "nx:noop",
"inputs": ["default", "^production"],
"dependsOn": ["test:vitest"]
},
"test:live": {
"executor": "nx:noop",
"inputs": ["default", "^production"],
"dependsOn": [
"test:vitest",
"test:e2e:install",
"test:e2e:compile",
"test:e2e:async-hang-issue-123"
],
"options": {
"parallel": false
},
"metadata": {
"description": "Tests requiring external tools (Supabase CLI)"
}
},
"test:vitest": {
Expand Down Expand Up @@ -75,14 +82,8 @@
"dependsOn": ["test:e2e:install", "build"],
"inputs": ["default", "^production"],
"options": {
"commands": [
"rm -rf supabase/",
"npx -y supabase@latest init --with-vscode-settings --with-intellij-settings",
"node dist/index.js compile examples/analyze_website.ts --deno-json examples/deno.json --supabase-path supabase",
"./scripts/assert-flow-compiled"
],
"cwd": "{projectRoot}",
"parallel": false
"command": "./scripts/test-compile",
"cwd": "{projectRoot}"
}
},
"test:e2e:async-hang-issue-123": {
Expand Down
Loading
Loading