Skip to content

Commit 251ac47

Browse files
committed
docs: Add comprehensive guide for auto-compilation flow development and deployment strategies
1 parent 1e1477f commit 251ac47

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3436
-572
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'pgflow': minor
3+
'@pgflow/edge-worker': minor
4+
---
5+
6+
Add auto-compilation flow and HTTP control plane server for edge worker

.github/workflows/ci.yml

Lines changed: 63 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ jobs:
4949
echo "NX_BASE=origin/main" >> $GITHUB_ENV
5050
echo "NX_HEAD=HEAD" >> $GITHUB_ENV
5151
52-
- name: Verify NX_BASE and NX_HEAD are set
53-
run: echo "BASE=$NX_BASE HEAD=$NX_HEAD"
54-
5552
- name: Pre-start Supabase for affected packages
5653
run: ./scripts/ci-prestart-supabase.sh core client
5754

@@ -76,50 +73,95 @@ jobs:
7673

7774
- uses: ./.github/actions/setup
7875

76+
- name: Check if edge-worker is affected
77+
id: check
78+
run: |
79+
if pnpm nx show projects --affected --base=origin/main --head=HEAD | grep -q "^edge-worker$"; then
80+
echo "affected=true" >> $GITHUB_OUTPUT
81+
echo "edge-worker is affected, running e2e tests"
82+
else
83+
echo "affected=false" >> $GITHUB_OUTPUT
84+
echo "edge-worker not affected, skipping e2e tests"
85+
fi
86+
7987
- name: Setup Deno
88+
if: steps.check.outputs.affected == 'true'
8089
uses: denoland/setup-deno@v2
8190
with:
8291
deno-version: '2.1.4'
8392

8493
- name: Install sqruff
94+
if: steps.check.outputs.affected == 'true'
8595
uses: ./.github/actions/setup-sqruff
8696
with:
8797
github-token: ${{ secrets.GITHUB_TOKEN }}
8898

8999
- name: Setup Atlas
100+
if: steps.check.outputs.affected == 'true'
90101
uses: ariga/setup-atlas@master
91102
with:
92103
cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}
93104

94-
- name: Set Nx base for affected commands
95-
run: |
96-
echo "NX_BASE=origin/main" >> $GITHUB_ENV
97-
echo "NX_HEAD=HEAD" >> $GITHUB_ENV
105+
- name: Pre-start Supabase
106+
if: steps.check.outputs.affected == 'true'
107+
run: ./scripts/ci-prestart-supabase.sh edge-worker
98108

99-
- name: Verify NX_BASE and NX_HEAD are set
100-
run: echo "BASE=$NX_BASE HEAD=$NX_HEAD"
109+
- name: Run edge-worker e2e tests
110+
if: steps.check.outputs.affected == 'true'
111+
run: pnpm nx run edge-worker:e2e
101112

102-
- name: Pre-start Supabase for affected packages
103-
run: ./scripts/ci-prestart-supabase.sh edge-worker
113+
# ─────────────────────────────────────── 2b. CLI E2E ──────────────────────────────────────
114+
cli-e2e:
115+
runs-on: ubuntu-latest
116+
env:
117+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
118+
steps:
119+
- uses: actions/checkout@v4
120+
with:
121+
fetch-depth: 0
104122

105-
- name: Check if edge-worker e2e tests are affected
106-
id: check-affected
123+
- uses: ./.github/actions/setup
124+
125+
- name: Check if cli is affected
126+
id: check
107127
run: |
108-
if pnpm nx show projects --affected -t test:e2e --base="$NX_BASE" --head="$NX_HEAD" | grep -q "^edge-worker$"; then
128+
if pnpm nx show projects --affected --base=origin/main --head=HEAD | grep -q "^cli$"; then
109129
echo "affected=true" >> $GITHUB_OUTPUT
110-
echo "Edge-worker e2e tests are affected by changes"
130+
echo "cli is affected, running e2e tests"
111131
else
112132
echo "affected=false" >> $GITHUB_OUTPUT
113-
echo "Edge-worker e2e tests are not affected by changes - skipping"
133+
echo "cli not affected, skipping e2e tests"
114134
fi
115135
116-
- name: Run edge-worker e2e tests
117-
if: steps.check-affected.outputs.affected == 'true'
118-
run: pnpm nx affected -t test:e2e --parallel --base="$NX_BASE" --head="$NX_HEAD"
136+
- name: Setup Deno
137+
if: steps.check.outputs.affected == 'true'
138+
uses: denoland/setup-deno@v2
139+
with:
140+
deno-version: '2.1.4'
141+
142+
- name: Install sqruff
143+
if: steps.check.outputs.affected == 'true'
144+
uses: ./.github/actions/setup-sqruff
145+
with:
146+
github-token: ${{ secrets.GITHUB_TOKEN }}
147+
148+
- name: Setup Atlas
149+
if: steps.check.outputs.affected == 'true'
150+
uses: ariga/setup-atlas@master
151+
with:
152+
cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}
153+
154+
- name: Pre-start Supabase
155+
if: steps.check.outputs.affected == 'true'
156+
run: ./scripts/ci-prestart-supabase.sh cli
157+
158+
- name: Run cli e2e tests
159+
if: steps.check.outputs.affected == 'true'
160+
run: pnpm nx run cli:e2e
119161

120162
# ────────────────────────────────── 3. DEPLOY WEBSITE ───────────────────────────
121163
deploy-website:
122-
needs: [build-and-test, edge-worker-e2e]
164+
needs: [build-and-test, edge-worker-e2e, cli-e2e]
123165
runs-on: ubuntu-latest
124166
environment: ${{ github.event_name == 'pull_request' && 'preview' || 'production' }}
125167
env:
@@ -142,9 +184,6 @@ jobs:
142184
echo "NX_BASE=origin/main" >> $GITHUB_ENV
143185
echo "NX_HEAD=HEAD" >> $GITHUB_ENV
144186
145-
- name: Verify NX_BASE and NX_HEAD are set
146-
run: echo "BASE=$NX_BASE HEAD=$NX_HEAD"
147-
148187
- name: Check if website is affected
149188
id: check-affected
150189
run: |
@@ -203,7 +242,7 @@ jobs:
203242
# ────────────────────────────────── 4. DEPLOY DEMO ───────────────────────────
204243
deploy-demo:
205244
if: false # temporarily disabled
206-
needs: [build-and-test, edge-worker-e2e]
245+
needs: [build-and-test, edge-worker-e2e, cli-e2e]
207246
runs-on: ubuntu-latest
208247
environment: ${{ github.event_name == 'pull_request' && 'preview' || 'production' }}
209248
env:
@@ -224,9 +263,6 @@ jobs:
224263
echo "NX_BASE=origin/main" >> $GITHUB_ENV
225264
echo "NX_HEAD=HEAD" >> $GITHUB_ENV
226265
227-
- name: Verify NX_BASE and NX_HEAD are set
228-
run: echo "BASE=$NX_BASE HEAD=$NX_HEAD"
229-
230266
- name: Validate Supabase environment variables
231267
run: |
232268
if [ -z "$VITE_SUPABASE_URL" ]; then

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,4 @@ deno-dist/
7272
.netlify
7373
.cursor/rules/nx-rules.mdc
7474
.github/instructions/nx.instructions.md
75+
config.toml.backup

0 commit comments

Comments
 (0)