Skip to content

Commit 33dec04

Browse files
committed
chore(ci): services in be ci
1 parent 90b9082 commit 33dec04

File tree

2 files changed

+76
-3
lines changed

2 files changed

+76
-3
lines changed

.github/workflows/backend-ci.yaml

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Backend CI
1+
name: Backend
22

33
on: push
44

@@ -47,3 +47,76 @@ jobs:
4747
run: |
4848
cd apps/backend
4949
pnpm types:check
50+
51+
e2e:
52+
runs-on: ubuntu-latest
53+
54+
services:
55+
postgres:
56+
image: postgres
57+
env:
58+
POSTGRES_USER: postgres_user
59+
POSTGRES_PASSWORD: postgres_password
60+
POSTGRES_DB: metro-now
61+
options: >-
62+
--health-cmd pg_isready
63+
--health-interval 10s
64+
--health-timeout 5s
65+
--health-retries 5
66+
ports:
67+
- 5432:5432
68+
69+
redis:
70+
image: redis
71+
options: >-
72+
--health-cmd "redis-cli ping"
73+
--health-interval 10s
74+
--health-timeout 5s
75+
--health-retries 5
76+
ports:
77+
- 6379:6379
78+
79+
steps:
80+
- name: Check out code
81+
uses: actions/checkout@v4
82+
with:
83+
fetch-depth: 2
84+
85+
- uses: pnpm/action-setup@v4
86+
87+
- name: Setup Node.js environment
88+
uses: actions/setup-node@v4
89+
with:
90+
node-version: 20
91+
cache: "pnpm"
92+
93+
- name: Install dependencies
94+
run: |
95+
pnpm install
96+
97+
98+
- name: Setup environment
99+
run: |
100+
cd apps/backend
101+
tail -n +2 ".env.local.example" > ".env.local"
102+
echo "GOLEMIO_API_KEY=${{ secrets.GOLEMIO_API_KEY }}" >> ".env.local"
103+
104+
- name: Prisma generate
105+
run: |
106+
cd apps/backend
107+
pnpm prisma:generate
108+
109+
- name: Run migrations
110+
run: |
111+
cd apps/backend
112+
pnpm prisma:migrate:deploy
113+
114+
- name: Run seeds
115+
run: |
116+
cd apps/backend
117+
pnpm prisma:seed
118+
119+
- name: Test e2e
120+
run: |
121+
cd apps/backend
122+
pnpm test:e2e

apps/backend/.env.local.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
GOLEMIO_API_KEY=
33

44
# postgres
5-
POSTGRES_USER=pg_user
6-
POSTGRES_PASSWORD=pg_password
5+
POSTGRES_USER=postgres_user
6+
POSTGRES_PASSWORD=postgres_password
77
POSTGRES_DB=metro-now
88

99

0 commit comments

Comments
 (0)