Skip to content

Commit

Permalink
Merge pull request #3 from rudSarkar/dev
Browse files Browse the repository at this point in the history
Added a test case for not merging into main
  • Loading branch information
rudSarkar authored Jan 22, 2025
2 parents c7b2e99 + a567ccc commit 389c0bb
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 14 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/checkout_code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Installing Node.js Packages

on:
workflow_call:

jobs:
build:
name: Installing Node.js Packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
27 changes: 14 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: nodejs-ci
name: Node.js CI

on:
# Trigger when a new commit is pushed in main branch
# Trigger when a new pull request in main branch
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
# checkout the code
- uses: actions/checkout@v2
# setup the nodejs environment
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: npm run test
checkout_code:
name: Checkout Code
uses: ./github/workflows/checkout_code.yml
setup_node:
name: Installing Node.js
uses: ./github/workflows/setup_node.yml
install_packages:
name: Installing Node.js Packages
uses: ./github/workflows/install_packages.yml
run_test:
name: Run Test Case in Node.js Application
uses: ./github/workflows/run_test.yml
11 changes: 11 additions & 0 deletions .github/workflows/install_packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Installing Node.js Packages

on:
workflow_call:

jobs:
build:
name: Installing Node.js Packages
runs-on: ubuntu-latest
steps:
- run: npm install
11 changes: 11 additions & 0 deletions .github/workflows/run_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Run Node.js Project Test Cases

on:
workflow_call:

jobs:
build:
name: Run Node.js Project Test Cases
runs-on: ubuntu-latest
steps:
- run: npm test
13 changes: 13 additions & 0 deletions .github/workflows/setup_node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Setup Node.js

on:
workflow_call:

jobs:
build:
name: Installing Node
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v2
with:
node-version: 16
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("/GET /dev", () => {
.get("/dev")
.end((err, res) => {
res.should.have.status(200);
res.text.should.be.eql("Hello 2");
res.text.should.be.eql("dev");
done();
});
});
Expand Down

0 comments on commit 389c0bb

Please sign in to comment.