Skip to content

Added queries implementation guide #12

Added queries implementation guide

Added queries implementation guide #12

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: NodeJS CI with PostgreSQL
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: gh
POSTGRES_PASSWORD: gh123
POSTGRES_DB: mango_db
ports:
- 5432: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:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm install
- name: create postgresql tables
run: PGPASSWORD=gh123 psql -h localhost -U gh -d mango_db -a -f ./sql/tables.sql
- name: run tests with postgresql
run:
npm test
env:
DATABASE_URL: postgres://gh:gh123@localhost:5432/mango_db