Skip to content
Closed
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
74 changes: 74 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: CI / Validation

on:
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

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

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

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

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
contracts/target
key: ${{ runner.os }}-cargo-${{ hashFiles('contracts/**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install backend dependencies
run: npm install
working-directory: ./backend

- name: Install frontend dependencies
run: npm install
working-directory: ./frontend

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

- name: Run linting (backend)
run: npm run lint --if-present
working-directory: ./backend
continue-on-error: false

- name: Run linting (frontend)
run: npm run lint --if-present
working-directory: ./frontend
continue-on-error: false

- name: Run Rust tests
run: cargo test
working-directory: ./contracts
continue-on-error: false

- name: Run backend tests
run: npm test
working-directory: ./backend
continue-on-error: false
env:
DATABASE_URL: file:./dev.db

- name: Run frontend tests
run: npm test
working-directory: ./frontend
continue-on-error: false
5 changes: 4 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"dev": "nodemon",
"build": "tsc",
"start": "node dist/index.js",
"lint": "eslint . --ext .ts,.js",
"prisma:generate": "prisma generate",
"prisma:migrate": "prisma migrate dev",
"prisma:deploy": "prisma migrate deploy",
Expand Down Expand Up @@ -45,6 +46,8 @@
"prisma": "^7.4.1",
"ts-node": "^10.9.2",
"tsx": "^4.19.2",
"typescript": "^5.9.3"
"typescript": "^5.9.3",
"vitest": "^4.0.18",
"eslint": "^9"
}
}
7 changes: 7 additions & 0 deletions backend/test/sample.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { describe, it, expect } from 'vitest'

describe('Sample Test', () => {
it('should pass', () => {
expect(1 + 1).toBe(2)
})
})
9 changes: 9 additions & 0 deletions backend/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// <reference types="vitest" />
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
environment: 'node',
globals: true,
},
})
16 changes: 11 additions & 5 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint"
"lint": "eslint",
"test": "vitest run"
},
"dependencies": {
"@stellar/freighter-api": "^6.0.0",
"lucide-react": "^0.575.0",
"next": "16.1.6",
"next-themes": "^0.4.6",
"react": "19.2.4",
"react-dom": "19.2.4",
"lucide-react": "^0.575.0"
"react-dom": "19.2.4"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
Expand All @@ -25,6 +25,12 @@
"eslint": "^9",
"eslint-config-next": "16.1.6",
"tailwindcss": "^4",
"typescript": "^5"
"typescript": "^5",
"vitest": "^4.0.18",
"@vitejs/plugin-react": "^4.3.4",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@testing-library/user-event": "^14.6.1",
"jsdom": "^28.1.0"
}
}
}
7 changes: 7 additions & 0 deletions frontend/test/sample.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { describe, it, expect } from 'vitest'

describe('Sample Test', () => {
it('should pass', () => {
expect(1 + 1).toBe(2)
})
})
9 changes: 9 additions & 0 deletions frontend/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// <reference types="vitest" />
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
environment: "jsdom",
globals: true,
},
});
Loading
Loading