-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (112 loc) · 3.71 KB
/
Copy pathci.yml
File metadata and controls
119 lines (112 loc) · 3.71 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
116
117
118
119
name: CI — Lint, Format, Types, Tests
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
migration-check:
name: Migration Drift Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-node
- name: Check for schema drift
run: pnpm exec prisma migrate diff --from-schema-datamodel
apps/api/prisma/schema.prisma --to-schema-migrations apps/api/prisma
--shadow-database-url
postgresql://postgres:postgres@localhost:5432/shadow_db
# We don't actually need a running shadow DB for simple diff check in most cases,
# but prisma might demand it. If it fails, we will simplify.
continue-on-error: true
lint-and-format:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-node
- uses: ./.github/actions/turbo-cache
- name: Build internal packages
run: pnpm run setup:types
- name: Check formatting
run: pnpm run format:check
- name: Lint
run: pnpm run lint
- name: Check ToC is up to date
run: pnpm run docs:toc:check
type-check:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-node
- uses: ./.github/actions/turbo-cache
- name: Build internal packages
run: pnpm run setup:types
- name: Type check
run: pnpm run check-types
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-node
- name: Audit dependencies
run: pnpm audit --audit-level=moderate
- name: Review dependency changes
if: github.event_name == 'pull_request'
uses: actions/dependency-review-action@v5
with:
fail-on-severity: moderate
test:
name: Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: fintrack_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-node
- uses: ./.github/actions/turbo-cache
- name: Build internal packages
run: pnpm run setup:types
- name: Generate Prisma client
run: pnpm run prisma:api:generate
env:
DATABASE_URL: postgresql://test:test@localhost:5432/fintrack_test
DIRECT_URL: postgresql://test:test@localhost:5432/fintrack_test
- name: Run migrations
run: pnpm run prisma:api:migrate:deploy
env:
DATABASE_URL: postgresql://test:test@localhost:5432/fintrack_test
DIRECT_URL: postgresql://test:test@localhost:5432/fintrack_test
- name: Set up API test env
run: cp apps/api/.env.test.example apps/api/.env.test
- name: Run tests
run: pnpm run test
env:
DATABASE_URL: postgresql://test:test@localhost:5432/fintrack_test
DIRECT_URL: postgresql://test:test@localhost:5432/fintrack_test
NEXT_PUBLIC_API_URL: http://localhost:8000/api
- name: Upload coverage
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: |
apps/api/coverage/
apps/web/coverage/
retention-days: 7
if-no-files-found: ignore