Skip to content

added npm ci command to install all dependencies in docker workflow #98

added npm ci command to install all dependencies in docker workflow

added npm ci command to install all dependencies in docker workflow #98

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://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
on:
push:
branches:
- main
- issue-*
pull_request:
branches:
- main
- issue-*
jobs:
Build_App_using_node_and_Run_Tests:
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install the dependencies
run: npm ci
- name: Build the app and run the tests
run: npm start && npx wait-on http://localhost:3004 &
- name: Run the tests
run: npm test
- name: Kill all instances of node
run: pkill -f node
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Test Report
path: ${{ github.workspace }}/reports/test-results.json
reporter: 'mocha-json'
Build_App_using_docker_and_Run_Tests:
needs: Build_App_using_node_and_Run_Tests
runs-on: ubuntu-latest
permissions:
checks: write
services:
restful-ecommerce:
image: mfaisalkhatri/restful-ecommerce
ports:
- 3004:3004
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install the dependencies
run: npm ci
- name: Run Unit tests
run: npm test
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Test Report
path: ${{ github.workspace }}/reports/test-results.json
reporter: 'mocha-json'