Skip to content

Remove usage of next(...) in restify routes #70

Remove usage of next(...) in restify routes

Remove usage of next(...) in restify routes #70

name: Test API against Postgres Service Container
on:
push:
branches:
- '*'
schedule:
- cron: '30 5 * * 2,4'
jobs:
install-test:
name: Node application tests
strategy:
matrix:
node: ['16', '18']
runs-on: 'ubuntu-20.04'
# These run alongside the job.
# See:
# - https://docs.github.com/en/actions/using-containerized-services/about-service-containers
# - https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers
services:
# label for service - since this job doesn't run in a container, this service is accessible at localhost
database:
image: postgres:14.2-alpine
ports:
- 5432:5432
env:
POSTGRES_USER: acronymapi
POSTGRES_PASSWORD: password
POSTGRES_DB: defaultdb
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# https://github.com/actions/checkout
- name: Checkout the commit triggering this job
uses: actions/checkout@v4
#
- name: Install Postgres Client
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends postgresql-client
#
- name: Initialize database with initdb
run: |
PGPASSWORD=password psql -h localhost -U acronymapi --dbname=defaultdb --file=initdb.sql
# https://github.com/actions/setup-node
# https://github.com/actions/cache is no longer needed with setup-node v2
- name: Setup Node with npm cache
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
#
- name: Install dependencies from package.json
run: npm install
- name: Run tests with mocks
run: npm run test
- name: Run tests against live Postgres server
if: matrix.node == '16'
run: npm --test_live_server=true run test
env:
PGUSER: acronymapi
PGPASSWORD: password
PGDATABASE: defaultdb
PGHOST: localhost
PGPORT: 5432