Skip to content
Merged
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
109 changes: 109 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Continuous Integration workflow for FlowFi
# Covers frontend linting/build, backend build/test, and Soroban contract build/test.
name: CI

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
frontend:
name: Frontend CI
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
run: npm ci
working-directory: frontend

- name: Lint
run: npm run lint
working-directory: frontend

- name: Build
run: npm run build
working-directory: frontend

backend:
name: Backend CI
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: flowfi_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: backend/package-lock.json

- name: Install dependencies
run: npm ci
working-directory: backend

- name: Generate Prisma Client
run: npx prisma generate
working-directory: backend

- name: Build
run: npm run build
working-directory: backend

- name: Run Backend Tests
run: npm test
working-directory: backend
env:
DATABASE_URL: postgresql://user:password@localhost:5432/flowfi_test

contracts:
name: Soroban Contracts CI
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-unknown-unknown

- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "contracts -> target"

- name: Build Contracts
run: cargo build --target wasm32-unknown-unknown --release
working-directory: contracts

- name: Run Contract Tests
run: cargo test
working-directory: contracts
48 changes: 24 additions & 24 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run npm audit
run: npm audit --audit-level=moderate || true

- name: Check for known vulnerabilities in frontend
run: |
cd frontend
npm audit --audit-level=moderate || true

- name: Check for known vulnerabilities in backend
run: |
cd backend
npm audit --audit-level=moderate || true
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run npm audit
run: npm audit --audit-level=moderate
- name: Check for known vulnerabilities in frontend
run: |
cd frontend
npm audit --audit-level=moderate
- name: Check for known vulnerabilities in backend
run: |
cd backend
npm audit --audit-level=moderate

codeql-analysis:
name: CodeQL Analysis
Expand Down
39 changes: 32 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,22 +286,47 @@ This repository uses GitHub Actions for continuous integration. Workflows are lo
- CodeQL analysis for JavaScript/TypeScript
- View workflow: [Security Checks](.github/workflows/security.yml)

- **CI** (`.github/workflows/ci.yml`)
- Runs on: push to `main`/`develop` and pull requests
- Performs:
- Frontend: lint and build
- Backend: prisma generation, build, and tests
- Soroban Contracts: build (wasm) and tests
- View workflow: [CI](.github/workflows/ci.yml)

### Running CI Checks Locally

Before pushing, ensure your changes pass:
Before pushing, ensure your changes pass all the same checks that run in GitHub Actions.

#### 1. Frontend Checks
```bash
cd frontend
npm run lint # Runs ESLint
npm run build # Verifies the build
```

#### 2. Backend Checks
```bash
# Frontend linting
cd frontend && npm run lint
cd backend
npm run prisma:generate # Ensure Prisma client is up to date
npm run build # Verifies TypeScript compilation
npm run test # Runs backend vitest suite
```
*Note: Backend tests require a running PostgreSQL instance and `DATABASE_URL` environment variable.*

# Backend tests
cd backend && npm run test
#### 3. Smart Contract Checks
```bash
cd contracts
cargo build --target wasm32-unknown-unknown --release # Verifies contract build
cargo test # Runs contract tests
```

# Security verification
#### 4. Security Verification
```bash
# From the repository root
npm run verify-security
```

For more details, see the [Security Workflow](.github/workflows/security.yml).

---

Expand Down
8 changes: 4 additions & 4 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"lucide-react": "^0.575.0",
"next": "16.1.6",
"next-themes": "^0.4.6",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-hot-toast": "^2.6.0"
"react": "19.2.4",
"react-dom": "19.2.4",
"lucide-react": "^0.575.0"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
Expand All @@ -27,4 +27,4 @@
"tailwindcss": "^4",
"typescript": "^5"
}
}
}
25 changes: 2 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading