-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (34 loc) · 1.03 KB
/
nodejs.yml
File metadata and controls
40 lines (34 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
services:
postgres:
image: postgres:12.0
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres_example_unit_testing
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install node modules
run: npm ci
- name: Run database migrations
run: npm run migrate up
env:
DATABASE_URL: postgres://postgres@localhost:5432/postgres_example_unit_testing
POSTGRES_HOST: localhost
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
- name: Run unit tests
run: npm test