-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (46 loc) · 1.39 KB
/
ci.yml
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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-test:
runs-on: ubuntu-latest
env:
DATABASE_URL: "postgresql://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@localhost:5432/fact?schema=public"
URL_DEV: "http://127.0.0.1"
PORT: 3000
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install dependencies
run: pnpm install
- name: Start PostgreSQL container
run: |
docker run -d --name postgres \
-e POSTGRES_USER=${{ secrets.POSTGRES_USER }} \
-e POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} \
-p 5432:5432 \
postgres:10.3
# Wait for PostgreSQL to be ready
while ! docker exec postgres pg_isready -U ${{ secrets.POSTGRES_USER }}; do sleep 1; done
- name: Generate Prisma client
run: pnpm prisma generate
- name: Apply Prisma migrations
run: pnpm prisma migrate deploy
- name: Run tests
run: pnpm test
- name: Stop PostgreSQL container
run: docker stop postgres && docker rm postgres