Skip to content

Modify approach

Modify approach #19

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: shrujana
POSTGRES_DB: wd-todo-test
ports:
- 5432:5432
options: >
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 14
- name: Install dependencies
run: npm install
- name: Wait for PostgreSQL to be ready
run: until pg_isready -h localhost -p 5432 -U postgres; do echo "Waiting for postgres..."; sleep 1; done
- name: Run Jest tests
env:
NODE_ENV: test
DB_HOST: 127.0.0.1
DB_USERNAME: postgres
DB_PASSWORD: shrujana
DB_DATABASE: wd-todo-test
DB_DIALECT: postgres
run: npm test