From c71831212488cda0fb4899896786291074daa929 Mon Sep 17 00:00:00 2001 From: bakarezainab Date: Tue, 24 Feb 2026 14:42:11 +0100 Subject: [PATCH 1/2] CI and Soroban test automation --- .github/workflows/ci.yml | 109 +++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 39 +++++++++++--- 2 files changed, 141 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a634bd2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e7fc86e..57ff258 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -257,22 +257,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). --- From b6849778307d2adab32a3dcc23dcdc9f53d93209 Mon Sep 17 00:00:00 2001 From: bakarezainab Date: Wed, 25 Feb 2026 11:32:39 +0100 Subject: [PATCH 2/2] CLI error issue --- .github/workflows/security.yml | 2 +- frontend/package.json | 6 ++--- package-lock.json | 46 +++++++++++++++++----------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 31a8b80..fffc1c7 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -21,7 +21,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '20' cache: 'npm' - name: Install dependencies diff --git a/frontend/package.json b/frontend/package.json index 95568cb..466a2da 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -11,8 +11,8 @@ "dependencies": { "next": "16.1.6", "next-themes": "^0.4.6", - "react": "19.2.3", - "react-dom": "19.2.3", + "react": "19.2.4", + "react-dom": "19.2.4", "lucide-react": "^0.575.0" }, "devDependencies": { @@ -25,4 +25,4 @@ "tailwindcss": "^4", "typescript": "^5" } -} +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 22c3c41..dfbbbf6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62,8 +62,8 @@ "lucide-react": "^0.575.0", "next": "16.1.6", "next-themes": "^0.4.6", - "react": "19.2.3", - "react-dom": "19.2.3" + "react": "19.2.4", + "react-dom": "19.2.4" }, "devDependencies": { "@tailwindcss/postcss": "^4", @@ -76,27 +76,6 @@ "typescript": "^5" } }, - "frontend/node_modules/react": { - "version": "19.2.3", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", - "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "frontend/node_modules/react-dom": { - "version": "19.2.3", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz", - "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==", - "license": "MIT", - "dependencies": { - "scheduler": "^0.27.0" - }, - "peerDependencies": { - "react": "^19.2.3" - } - }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", @@ -8259,6 +8238,27 @@ "destr": "^2.0.3" } }, + "node_modules/react": { + "version": "19.2.4", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", + "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.4", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz", + "integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.4" + } + }, "node_modules/react-hot-toast": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/react-hot-toast/-/react-hot-toast-2.6.0.tgz",