-
Notifications
You must be signed in to change notification settings - Fork 150
115 lines (111 loc) · 3.24 KB
/
Copy pathci.yml
File metadata and controls
115 lines (111 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Comprehensive CI Pipeline
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
jobs:
backend:
name: Backend Build & Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
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
working-directory: ./backend
run: npm ci
- name: Build
working-directory: ./backend
run: npm run build
- name: Prisma Generate & Migrate
working-directory: ./backend
env:
DATABASE_URL: postgresql://test:test@localhost:5432/test_db
run: |
npx prisma generate
npx prisma migrate deploy || true
- name: Test Migration Rollbacks
working-directory: ./backend
env:
DATABASE_URL: postgresql://test:test@localhost:5432/test_db
run: npm run test:migrations
- name: Run tests
working-directory: ./backend
env:
NODE_ENV: test
DATABASE_URL: postgresql://test:test@localhost:5432/test_db
REDIS_URL: redis://localhost:6379
JWT_SECRET: test-jwt-secret
GITHUB_CLIENT_ID: test-github-client-id
GITHUB_CLIENT_SECRET: test-github-client-secret
GITHUB_REDIRECT_URI: http://localhost:8080/api/v1/oauth/github/callback
FRONTEND_URL: http://localhost:3000
run: npm run test:coverage || true
frontend:
name: Frontend Build & Test
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
working-directory: ./frontend
run: npm ci
- name: Build
working-directory: ./frontend
run: npm run build
contracts:
name: Contracts Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache cargo registry
uses: Swatinem/rust-cache@v2
- name: Rustfmt Check
working-directory: ./contracts
run: cargo fmt --check
- name: Clippy Check
working-directory: ./contracts
run: cargo clippy
- name: Build
working-directory: ./contracts
run: cargo build