@@ -16,8 +16,8 @@ permissions:
1616 deployments : write # Netlify action needs it
1717
1818jobs :
19- # ─────────────────────────────────────── 1. BUILD & TEST ──────────────────────────────────────
20- build-and-test :
19+ # ─────────────────────────────────────── 1. DB VERIFICATION ──────────────────────────────────────
20+ db-verification :
2121 runs-on : ubuntu-latest
2222 env :
2323 NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
@@ -47,14 +47,126 @@ jobs:
4747 - name : Verify NX_BASE and NX_HEAD are set
4848 run : echo "BASE=$NX_BASE HEAD=$NX_HEAD"
4949
50- - name : Quality gate (lint + typecheck + test)
50+ - name : Run database verification
51+ run : pnpm nx run core:db:verify
52+
53+
54+ # ─────────────────────────────────────── 2. FAST TESTS ──────────────────────────────────────
55+ fast-tests :
56+ needs : [db-verification]
57+ runs-on : ubuntu-latest
58+ env :
59+ NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
60+ steps :
61+ - uses : actions/checkout@v4
62+ with :
63+ fetch-depth : 0
64+
65+ - uses : ./.github/actions/setup
66+
67+ - name : Set Nx SHAs for affected commands
68+ uses : nrwl/nx-set-shas@v4
69+
70+ - name : Verify NX_BASE and NX_HEAD are set
71+ run : echo "BASE=$NX_BASE HEAD=$NX_HEAD"
72+
73+ - name : Lint, typecheck, build, and fast tests
5174 run : pnpm nx affected -t lint typecheck test --parallel --configuration=production --base="$NX_BASE" --head="$NX_HEAD"
5275
5376 - name : Build all affected projects (except playground)
5477 run : pnpm nx affected -t build --configuration=production --parallel --exclude=playground --base="$NX_BASE" --head="$NX_HEAD"
5578
5679
57- # ─────────────────────────────────────── 2. EDGE-WORKER E2E ──────────────────────────────────────
80+ # ─────────────────────────────────────── 3. CORE LIVE TESTS ──────────────────────────────────────
81+ core-live-tests :
82+ needs : [db-verification]
83+ runs-on : ubuntu-latest
84+ env :
85+ NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
86+ steps :
87+ - uses : actions/checkout@v4
88+ with :
89+ fetch-depth : 0
90+
91+ - uses : ./.github/actions/setup
92+
93+ - name : Install sqruff
94+ uses : quarylabs/install-sqruff-cli-action@main
95+
96+ - name : Run core live tests
97+ run : pnpm nx run core:test:live
98+
99+
100+ # ─────────────────────────────────────── 4. CLIENT LIVE TESTS ──────────────────────────────────────
101+ client-live-tests :
102+ needs : [db-verification]
103+ runs-on : ubuntu-latest
104+ env :
105+ NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
106+ steps :
107+ - uses : actions/checkout@v4
108+ with :
109+ fetch-depth : 0
110+
111+ - uses : ./.github/actions/setup
112+
113+ - name : Set Nx SHAs for affected commands
114+ uses : nrwl/nx-set-shas@v4
115+
116+ - name : Check if client is affected
117+ id : check-affected
118+ run : |
119+ if pnpm nx show projects --affected --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^client$"; then
120+ echo "affected=true" >> $GITHUB_OUTPUT
121+ echo "Client is affected by changes"
122+ else
123+ echo "affected=false" >> $GITHUB_OUTPUT
124+ echo "Client is not affected by changes - skipping"
125+ fi
126+
127+ - name : Run client live tests
128+ if : steps.check-affected.outputs.affected == 'true'
129+ run : pnpm nx run client:test:live
130+
131+
132+ # ─────────────────────────────────────── 5. EDGE-WORKER LIVE TESTS ──────────────────────────────────────
133+ edge-worker-live-tests :
134+ needs : [db-verification]
135+ runs-on : ubuntu-latest
136+ env :
137+ NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
138+ steps :
139+ - uses : actions/checkout@v4
140+ with :
141+ fetch-depth : 0
142+
143+ - uses : ./.github/actions/setup
144+
145+ - name : Setup Deno
146+ uses : denoland/setup-deno@v2
147+ with :
148+ deno-version : ' 1.45.2'
149+
150+ - name : Set Nx SHAs for affected commands
151+ uses : nrwl/nx-set-shas@v4
152+
153+ - name : Check if edge-worker is affected
154+ id : check-affected
155+ run : |
156+ if pnpm nx show projects --affected --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^edge-worker$"; then
157+ echo "affected=true" >> $GITHUB_OUTPUT
158+ echo "Edge-worker is affected by changes"
159+ else
160+ echo "affected=false" >> $GITHUB_OUTPUT
161+ echo "Edge-worker is not affected by changes - skipping"
162+ fi
163+
164+ - name : Run edge-worker live tests
165+ if : steps.check-affected.outputs.affected == 'true'
166+ run : pnpm nx run edge-worker:test:live
167+
168+
169+ # ─────────────────────────────────────── 6. EDGE-WORKER E2E ──────────────────────────────────────
58170 edge-worker-e2e :
59171 runs-on : ubuntu-latest
60172 env :
@@ -101,51 +213,9 @@ jobs:
101213 run : pnpm nx affected -t test:e2e --parallel --base="$NX_BASE" --head="$NX_HEAD"
102214
103215
104- # ────────────────────────────────── 3. DEPLOY PLAYGROUND ───────────────────────────
105- deploy-playground :
106- needs : [build-and-test, edge-worker-e2e]
107- if : false # Disabled
108- # if: >-
109- # ${{
110- # (github.event_name == 'pull_request') ||
111- # (github.ref == 'refs/heads/main' && github.event_name == 'push')
112- # }}
113- runs-on : ubuntu-latest
114- environment : ${{ github.event_name == 'pull_request' && 'preview' || 'production' }}
115- env :
116- NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
117- NETLIFY_AUTH_TOKEN : ${{ secrets.NETLIFY_AUTH_TOKEN }}
118- NETLIFY_SITE_ID : ${{ secrets.NETLIFY_PLAYGROUND_SITE_ID }}
119- NEXT_PUBLIC_SUPABASE_URL : ${{ github.event_name == 'pull_request' && secrets.DEMO_PREVIEW_SUPABASE_URL || secrets.DEMO_PRODUCTION_SUPABASE_URL }}
120- NEXT_PUBLIC_SUPABASE_ANON_KEY : ${{ github.event_name == 'pull_request' && secrets.DEMO_PREVIEW_SUPABASE_ANON_KEY || secrets.DEMO_PRODUCTION_SUPABASE_ANON_KEY }}
121- steps :
122- - uses : actions/checkout@v4
123- with :
124- fetch-depth : 0
125-
126- - uses : ./.github/actions/setup
127-
128- # Build the workspace libraries that the app imports
129- - run : pnpm nx run-many -t build --projects client,dsl --configuration=production
130-
131- - name : Build & deploy to Netlify
132- id : deploy
133- run : |
134- pnpm netlify deploy --build --filter=playground \
135- --context ${{ github.event_name == 'pull_request' && 'deploy-preview' || 'production' }} \
136- ${{ github.event_name == 'pull_request' && format('--alias=pr-{0}', github.event.pull_request.number) || '--prod' }}
137-
138- - name : Post deployment comment
139- if : always()
140- uses : ./.github/actions/deployment-comment
141- with :
142- project-name : Playground
143- preview-url : https://pr-${{ github.event.pull_request.number }}--pgflow-demo.netlify.app
144- production-url : https://playground.pgflow.dev
145-
146- # ────────────────────────────────── 4. DEPLOY WEBSITE ───────────────────────────
216+ # ────────────────────────────────── 7. DEPLOY WEBSITE ───────────────────────────
147217 deploy-website :
148- needs : [build-and-test , edge-worker-e2e]
218+ needs : [fast-tests, core-live-tests, client-live-tests, edge-worker-live-tests , edge-worker-e2e]
149219 runs-on : ubuntu-latest
150220 environment : ${{ github.event_name == 'pull_request' && 'preview' || 'production' }}
151221 env :
0 commit comments