Skip to content

Commit a2e1ff4

Browse files
authored
Merge branch 'main' into feat/playwright-e2e-ci-343-rebase
2 parents 5bb00ba + f50d60b commit a2e1ff4

157 files changed

Lines changed: 7928 additions & 9718 deletions

File tree

Some content is hidden

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

.github/CODEOWNERS

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Code Owners for FlowFi
2+
# This file controls who is automatically assigned for review
3+
# based on the files changed in a pull request.
4+
5+
# Default owners for the entire repository
6+
* @LabsCrypt
7+
8+
# Backend
9+
backend/ @LabsCrypt
10+
11+
# Frontend
12+
frontend/ @LabsCrypt
13+
14+
# Smart contracts
15+
contracts/ @LabsCrypt
16+
17+
# Documentation
18+
docs/ @LabsCrypt
19+
20+
# GitHub workflows and CI/CD
21+
.github/ @LabsCrypt
22+
23+
# Deployment scripts
24+
scripts/ @LabsCrypt

.github/codecov.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ coverage:
99
target: 70%
1010
flags:
1111
- contracts
12+
frontend:
13+
target: auto
14+
flags:
15+
- frontend
1216
patch:
1317
default:
1418
target: 60%

.github/dependabot.yml

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ version: 2
22

33
updates:
44
# ── npm: root workspace ────────────────────────────────────────────────────
5+
# flowfi is a single npm workspace (frontend + backend hoisted into one root
6+
# package-lock.json). Dependabot must update from the workspace root so the
7+
# root lockfile CI runs `npm ci` against stays in sync. Per-directory entries
8+
# for /frontend and /backend only touched their package.json without updating
9+
# the root lockfile, so every PR they opened failed `npm ci` with
10+
# "lock file's X does not satisfy Y". One root entry covers all workspaces.
511
- package-ecosystem: "npm"
612
directory: "/"
713
schedule:
@@ -14,54 +20,43 @@ updates:
1420
- "minor"
1521
- "patch"
1622

17-
# ── npm: frontend ──────────────────────────────────────────────────────────
18-
- package-ecosystem: "npm"
19-
directory: "/frontend"
23+
# ── Cargo: contracts ───────────────────────────────────────────────────────
24+
- package-ecosystem: "cargo"
25+
directory: "/contracts"
2026
schedule:
2127
interval: "weekly"
2228
day: "monday"
23-
open-pull-requests-limit: 10
29+
open-pull-requests-limit: 5
2430
groups:
2531
minor-and-patch:
2632
update-types:
2733
- "minor"
2834
- "patch"
2935

30-
# ── npm: backend ───────────────────────────────────────────────────────────
31-
- package-ecosystem: "npm"
32-
directory: "/backend"
36+
# ── GitHub Actions ─────────────────────────────────────────────────────────
37+
- package-ecosystem: "github-actions"
38+
directory: "/"
3339
schedule:
3440
interval: "weekly"
3541
day: "monday"
36-
open-pull-requests-limit: 10
42+
open-pull-requests-limit: 5
3743
groups:
38-
minor-and-patch:
44+
actions-minor-and-patch:
3945
update-types:
4046
- "minor"
4147
- "patch"
4248

43-
# ── Cargo: contracts ───────────────────────────────────────────────────────
44-
- package-ecosystem: "cargo"
45-
directory: "/contracts"
49+
# ── Docker ─────────────────────────────────────────────────────────────────
50+
- package-ecosystem: "docker"
51+
directory: "/backend"
4652
schedule:
4753
interval: "weekly"
4854
day: "monday"
4955
open-pull-requests-limit: 5
50-
groups:
51-
minor-and-patch:
52-
update-types:
53-
- "minor"
54-
- "patch"
5556

56-
# ── GitHub Actions ─────────────────────────────────────────────────────────
57-
- package-ecosystem: "github-actions"
57+
- package-ecosystem: "docker"
5858
directory: "/"
5959
schedule:
6060
interval: "weekly"
6161
day: "monday"
6262
open-pull-requests-limit: 5
63-
groups:
64-
actions-minor-and-patch:
65-
update-types:
66-
- "minor"
67-
- "patch"

.github/workflows/ci.yml

Lines changed: 83 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
# Covers frontend linting/build, backend build/test, and Soroban contract build/test.
33
name: CI
44

5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
59
on:
610
push:
7-
branches: [ main, develop ]
11+
branches: [main, develop]
812
pull_request:
9-
branches: [ main, develop ]
13+
branches: [main, develop]
1014

1115
jobs:
1216
frontend:
@@ -19,14 +23,13 @@ jobs:
1923
- name: Setup Node.js
2024
uses: actions/setup-node@v4
2125
with:
22-
node-version: '20'
23-
cache: 'npm'
26+
node-version: "20"
27+
cache: "npm"
2428
cache-dependency-path: package-lock.json
2529

2630
- name: Install dependencies
2731
run: npm ci
2832

29-
3033
- name: Lint
3134
run: npm run lint
3235
working-directory: frontend
@@ -36,7 +39,7 @@ jobs:
3639
working-directory: frontend
3740

3841
- name: Run Frontend Tests
39-
run: npm test
42+
run: npm run test:coverage
4043
working-directory: frontend
4144

4245
- name: Build
@@ -48,7 +51,7 @@ jobs:
4851
runs-on: ubuntu-latest
4952
services:
5053
postgres:
51-
image: postgres:15
54+
image: postgres:16-alpine@sha256:e013e867e712fec275706a6c51c966f0bb0c93cfa8f51000f85a15f9865a28cb
5255
env:
5356
POSTGRES_USER: postgres
5457
POSTGRES_PASSWORD: password
@@ -68,8 +71,8 @@ jobs:
6871
- name: Setup Node.js
6972
uses: actions/setup-node@v4
7073
with:
71-
node-version: '20'
72-
cache: 'npm'
74+
node-version: "20"
75+
cache: "npm"
7376
cache-dependency-path: package-lock.json
7477

7578
- name: Install dependencies
@@ -111,6 +114,40 @@ jobs:
111114
env:
112115
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
113116

117+
backend-docker:
118+
name: Backend Docker Image CI
119+
runs-on: ubuntu-latest
120+
steps:
121+
- name: Checkout code
122+
uses: actions/checkout@v4
123+
124+
- name: Check changed files
125+
id: filter
126+
uses: dorny/paths-filter@v3
127+
with:
128+
filters: |
129+
backend:
130+
- 'backend/**'
131+
- 'docker-compose.yml'
132+
133+
- name: Build Docker Image
134+
if: steps.filter.outputs.backend == 'true' || github.event_name == 'push'
135+
run: docker build -f backend/Dockerfile backend -t flowfi-backend:test
136+
137+
- name: Docker Compose Build
138+
if: steps.filter.outputs.backend == 'true' || github.event_name == 'push'
139+
run: docker compose build
140+
141+
- name: Boot and Check Health
142+
if: steps.filter.outputs.backend == 'true' || github.event_name == 'push'
143+
run: |
144+
docker compose up -d postgres
145+
sleep 10
146+
docker compose run --rm -e DATABASE_URL=postgresql://flowfi:flowfi_dev_password@postgres:5432/flowfi backend npx -y prisma db push --accept-data-loss
147+
docker compose up -d backend
148+
sleep 15
149+
curl --fail http://localhost:3001/health || (docker compose logs backend && exit 1)
150+
114151
contracts:
115152
name: Soroban Contracts CI
116153
runs-on: ubuntu-latest
@@ -128,7 +165,7 @@ jobs:
128165
- name: Rust Cache
129166
uses: Swatinem/rust-cache@v2
130167
with:
131-
workspaces: "contracts -> target"
168+
workspace: "contracts -> target"
132169

133170
- name: Check Formatting
134171
run: cargo fmt --all -- --check
@@ -167,26 +204,56 @@ jobs:
167204
- name: Install Stellar CLI
168205
run: |
169206
curl -fsSL https://github.com/stellar/stellar-cli/raw/main/install.sh | sh -s -- --install-deps
207+
echo "$HOME/.stellar-cli/bin" >> $GITHUB_PATH
170208
shell: bash
171209

172210
- name: Optimize WASM files
173211
run: |
174212
set -euo pipefail
175-
WASMS=$(find contracts/target -type f -name "*.wasm" -print)
213+
214+
# Target the precise release build directory
215+
RELEASE_DIR="contracts/target/wasm32-unknown-unknown/release"
216+
217+
# Use your strict selection logic to target un-optimized raw binaries only
218+
WASMS=$(find "$RELEASE_DIR" -maxdepth 1 -type f -name "*.wasm" ! -name "*.optimized.wasm")
219+
176220
if [ -z "$WASMS" ]; then
177-
echo "No wasm files found"
221+
echo "Error: No raw WASM files found in $RELEASE_DIR"
178222
exit 1
179223
fi
224+
180225
for w in $WASMS; do
181-
out="${w%%.wasm}.optimized.wasm"
182-
echo "Optimizing $w -> $out"
226+
filename=$(basename "$w")
227+
out="$RELEASE_DIR/${filename%.wasm}.optimized.wasm"
228+
echo "Optimizing $filename -> $(basename "$out")"
183229
stellar contract optimize --wasm "$w" --wasm-out "$out"
184230
done
185231
shell: bash
186232

233+
- name: Check WASM size budget
234+
run: |
235+
set -euo pipefail
236+
237+
RELEASE_DIR="contracts/target/wasm32-unknown-unknown/release"
238+
WASM_SIZE_LIMIT=200000 # 200KB budget for optimized WASM
239+
240+
for wasm in "$RELEASE_DIR"/*.optimized.wasm; do
241+
if [ -f "$wasm" ]; then
242+
size=$(stat -c%s "$wasm")
243+
filename=$(basename "$wasm")
244+
echo "Optimized WASM size: $filename = $size bytes"
245+
246+
if [ "$size" -gt "$WASM_SIZE_LIMIT" ]; then
247+
echo "Error: $filename exceeds size budget of $WASM_SIZE_LIMIT bytes"
248+
exit 1
249+
fi
250+
fi
251+
done
252+
shell: bash
253+
187254
- name: Upload optimized WASM artifacts
188255
uses: actions/upload-artifact@v4
189256
with:
190257
name: optimized-wasm
191-
path: |
192-
contracts/target/**/**/*.optimized.wasm
258+
path: contracts/target/wasm32-unknown-unknown/release/*.optimized.wasm
259+
if-no-files-found: error

.github/workflows/security.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Security Checks
22

3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
37
on:
48
push:
59
branches: [ main, develop ]

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ fix.md
1212

1313
# Playwright test execution items
1414
frontend/playwright-report/
15-
frontend/test-results/
15+
frontend/test-results/
16+
.npm-cache/

0 commit comments

Comments
 (0)