-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (77 loc) · 2.7 KB
/
node.js.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# 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: Node.js Postgres (Mocha automation test cases) CI
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
database-name:
- demodb
database-password:
- abc123
database-user:
- postgres
database-host:
- 127.0.0.1
database-port:
- 5432
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: ${{ matrix.database-name }}
POSTGRES_USER: ${{ matrix.database-user }}
POSTGRES_PASSWORD: ${{ matrix.database-password }}
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
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
name: Login and Employees mocha automation test cases
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: run Postgresql database restore
uses: tj-actions/pg-restore@v4.5
with:
database_url: "postgres://postgres:abc123@localhost:5432/demodb"
backup_file: "./app/utils/dbDump/dump-demodb-202207190259.sql"
options: "-O"
- name: install dependencies
run: npm install
- name: update ORM to DB
run: npm run applychangesDB
- name: Eval login module mocha test cases
run: npm run LoginEval
- name: Eval Employees mocha test cases
run: npm run ModuleEval
# Workaround to avoid "Post Run actions/setup-node" failures.
# See: https://github.com/actions/setup-node/issues/317
- name: github action bug- Workaround to avoid "Post Run actions/setup-node" failures
run: mkdir -p /home/runner/.npm
continue-on-error: true