Static server #202
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |