Skip to content

feat: implement order module (#259) #39

feat: implement order module (#259)

feat: implement order module (#259) #39

Workflow file for this run

name: Backend Tests
on:
push:
branches: [main, develop]
paths:
- "apps/backend/**"
pull_request:
branches: [main, develop]
paths:
- "apps/backend/**"
jobs:
test:
runs-on: ubuntu-latest
services:
# Set up PostgreSQL service container
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
ports:
# Maps tcp port 5432 on service container to the host
- 5434:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Create .env file
run: |
echo "POSTGRES_URI=postgresql://postgres:postgres@localhost:5434/test_db" > apps/backend/.env
echo "NODE_ENV=development" >> apps/backend/.env
- name: Generate Prisma Client
working-directory: ./apps/backend
run: npx prisma generate
- name: Run database migrations
working-directory: ./apps/backend
run: npx prisma migrate deploy
env:
POSTGRES_URI: postgresql://postgres:postgres@localhost:5434/test_db
- name: Run tests
working-directory: ./apps/backend
run: npm run test
env:
POSTGRES_URI: postgresql://postgres:postgres@localhost:5434/test_db