-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (110 loc) · 3.47 KB
/
backend-ci.yaml
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Backend
on: push
jobs:
ci:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: pnpm/action-setup@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: |
pnpm install
- name: Prisma generate
run: |
cd apps/backend
pnpm prisma:generate
- name: Build dependencies
run: |
pnpm prebuild
- name: Build
run: |
cd apps/backend
pnpm build
- name: Test
run: |
cd apps/backend
pnpm test
- name: Lint
run: |
cd apps/backend
pnpm lint
- name: Types check
run: |
cd apps/backend
pnpm types:check
e2e:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres_user
POSTGRES_PASSWORD: postgres_password
POSTGRES_DB: metro-now
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: pnpm/action-setup@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: |
pnpm install
- name: Setup environment
run: |
cd apps/backend
tail -n +3 ".env.local.example" > ".env.local"
echo "\n" >> ".env.local"
echo "GOLEMIO_API_KEY=${{ secrets.GOLEMIO_API_KEY }}" >> ".env.local"
echo "----- .env.local -----"
cat ".env.local"
echo "----------------------"
- name: Prisma generate
run: |
cd apps/backend
pnpm prisma:generate
- name: Run migrations
run: |
cd apps/backend
pnpm prisma:migrate:deploy
- name: Run seeds
run: |
cd apps/backend
pnpm prisma:seed
- name: Test e2e
run: |
cd apps/backend
pnpm test:e2e --runInBand