Skip to content

Commit

Permalink
Merge pull request #5 from MaBlaGit/add-ci
Browse files Browse the repository at this point in the history
Add ci
  • Loading branch information
MaBlaGit authored Aug 5, 2024
2 parents ed254e4 + 2a6e172 commit 5e2a885
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: fats-backend-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

- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- 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

0 comments on commit 5e2a885

Please sign in to comment.