سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 4, 13:00 UTC
ci(staging): add zero-cost disposable real-stack and harness QA with Production isolation
davoodmehraban89 committed
Oct 22, 2026 at 23:11 UTC
929f7194c762ba7baa9314fce6be32dc70817d48
1 file changed
+125
.github/workflows/stage22-free-ephemeral-staging.yml
new
+125
@@ -0,0 +1,125 @@
1
+name: FINORA free ephemeral Staging (CI-local only)
2
+on:
3
+ push:
4
+ branches: [staging/finora-stage22-free-20261022]
5
+permissions:
6
+ contents: read
7
+concurrency:
8
+ group: finora-free-ephemeral-staging
9
+ cancel-in-progress: true
10
+
11
+# No hosted staging URL. No paid resources, Production secrets, DB or deployment.
12
+# Public-repo standard ubuntu-latest runners are free; no stored CI artifacts.
13
+jobs:
14
+ stage22-real-stack:
15
+ name: stage22-real-stack (NOT harness)
16
+ runs-on: ubuntu-latest
17
+ timeout-minutes: 40
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - name: Preconnection production target canary
21
+ run: node scripts/stage21-target-preflight.mjs green
22
+ - uses: supabase/setup-cli@v1
23
+ with:
24
+ version: 2.121.0
25
+ - name: Start disposable Supabase Auth PostgREST gateway and Stage1 + Stage2.2 SQL
26
+ run: |
27
+ set -euo pipefail
28
+ supabase init --force
29
+ python3 - <<'PY'
30
+ from pathlib import Path
31
+ for p in Path('supabase/migrations').glob('*.sql'):
32
+ b=p.read_bytes()
33
+ if b.endswith(b'\\n'): p.write_bytes(b[:-2]+b'\n')
34
+ PY
35
+ mkdir -p /tmp/stage22-real-migrations
36
+ mv supabase/migrations/2026101610{0000,0500,1000,1500,2000,2500,3000,3100,3500,4000}_*.sql /tmp/stage22-real-migrations/
37
+ supabase start -x inbucket
38
+ for migration in /tmp/stage22-real-migrations/*.sql; do
39
+ PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -U postgres -d postgres -X -v ON_ERROR_STOP=1 -f "$migration" >/dev/null
40
+ done
41
+ - name: Build exact production Pages artifact (no deployment)
42
+ run: |
43
+ node scripts/build-pages.mjs
44
+ test -f _site/index.html
45
+ test -f _site/js/finora-pages-accounting.js
46
+ test -f _site/js/finora-extension-bundle.js
47
+ - name: Install Chromium and Playwright real-stack runner
48
+ run: |
49
+ npm install --no-save @playwright/test@1.55.0
50
+ npx playwright install --with-deps chromium
51
+ - name: REAL STACK GoTrue login, JWT gateway REST attacks, UI journal and audit
52
+ run: |
53
+ set -o pipefail
54
+ node scripts/stage22-real-stack.mjs 2>&1 | tee stage22-real-stack.log
55
+ - name: Annotate REAL STACK job (never confuse with harness)
56
+ if: always()
57
+ run: |
58
+ {
59
+ echo '### Stage 2.2 REAL-STACK (not harness)'
60
+ echo 'Real built Pages index, local GoTrue Auth, JWT, Kong/gateway, PostgREST, real PostgreSQL and Chromium.'
61
+ echo 'Result: see mandatory scenario log and evidence; no result is certified on a failed job.'
62
+ echo 'No remote Supabase URL, Production SQL, deployment or Production credentials.'
63
+ } >> "$GITHUB_STEP_SUMMARY"
64
+ stage22-mode-contract:
65
+ name: client-compat-positive-stage2
66
+ runs-on: ubuntu-latest
67
+ timeout-minutes: 40
68
+ steps:
69
+ - uses: actions/checkout@v4
70
+ - name: Local target preflight (never Production)
71
+ run: node scripts/stage21-target-preflight.mjs green
72
+ - uses: supabase/setup-cli@v1
73
+ with:
74
+ version: 2.121.0
75
+ - name: Isolate local CLI and apply only Stage1 and Stage2.2 mode SQL
76
+ run: |
77
+ supabase init --force
78
+ python3 - <<'PY'
79
+ from pathlib import Path
80
+ for p in Path('supabase/migrations').glob('*.sql'):
81
+ b=p.read_bytes()
82
+ if b.endswith(b'\\n'): p.write_bytes(b[:-2]+b'\n')
83
+ PY
84
+ mkdir -p /tmp/stage22-only
85
+ mv supabase/migrations/2026101610{0000,0500,1000,1500,2000,2500,3000,3100,3500,4000}_*.sql /tmp/stage22-only/
86
+ supabase start -x inbucket
87
+ for migration in /tmp/stage22-only/*.sql; do
88
+ PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -U postgres -d postgres -X -v ON_ERROR_STOP=1 -f "$migration"
89
+ done
90
+ - name: Owner-only mode RPC and guard in real local database
91
+ run: |
92
+ set -o pipefail
93
+ PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -U postgres -d postgres -X -v ON_ERROR_STOP=1 -f supabase/tests/stage22_mode_contract.sql 2>&1 | tee stage22-mode.log
94
+ - name: Legacy client direct posted-status write must remain denied in enforce
95
+ run: |
96
+ set -o pipefail
97
+ PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -U postgres -d postgres -X -v ON_ERROR_STOP=1 -v stage21phase=green -f supabase/tests/stage21_direct_post_canary.sql 2>&1 | tee stage22-legacy-negative.log
98
+ - name: Browser manual journal lifecycle on Ubuntu + local database
99
+ run: |
100
+ set -o pipefail
101
+ npm install --no-save @playwright/test@1.55.0
102
+ npx playwright install --with-deps chromium
103
+ node scripts/stage22-manual-browser.mjs 2>&1 | tee stage22-browser.log
104
+ - name: Strict 3-of-3 positive manual client contract gate
105
+ run: |
106
+ set -o pipefail
107
+ node scripts/stage22-client-compat-gate.mjs stage22-evidence.json 2>&1 | tee stage22-compat.log
108
+ - name: Annotate HARNESS job type explicitly
109
+ if: always()
110
+ run: |
111
+ {
112
+ echo '### Stage 2.2 HARNESS (NOT real-stack)'
113
+ echo 'Runs original journal UI JavaScript in Chromium and tests local PostgreSQL through a restricted psql test bridge.'
114
+ echo 'Does NOT verify GoTrue password login, a real bearer JWT, gateway/PostgREST, or browser-to-backend HTTP.'
115
+ echo 'The separate stage22-real-stack job is mandatory before claiming full integration.'
116
+ } >> "$GITHUB_STEP_SUMMARY"
117
+ - name: Label local PostgreSQL bridge as HARNESS (not real-stack)
118
+ if: always()
119
+ run: |
120
+ {
121
+ echo '### Stage 2.2 HARNESS (not real-stack)'
122
+ echo 'Chromium executes actual journal code/UI via an isolated test-only PostgreSQL bridge and mocked Supabase transport.'
123
+ echo 'This pass does NOT prove real GoTrue auth, browser HTTP PostgREST, or the built Pages entrypoint.'
124
+ echo 'Real-stack is a SEPARATE job and must independently pass.'
125
+ } >> "$GITHUB_STEP_SUMMARY"