Skip to content

Add Node.js CI workflow for testing and building#9

Closed
AKarode wants to merge 1 commit into
mainfrom
AKarode-patch-1
Closed

Add Node.js CI workflow for testing and building#9
AKarode wants to merge 1 commit into
mainfrom
AKarode-patch-1

Conversation

@AKarode
Copy link
Copy Markdown
Collaborator

@AKarode AKarode commented Sep 18, 2025

Adding nodejs frontend with basic npm installation and npm test rules on ubuntu to make sure can run

Summary by CodeRabbit

  • Chores
    • Introduced automated CI for the repository, running on pushes and pull requests to the main branch.
    • Tests execute across Node.js 18.x, 20.x, and 22.x on Ubuntu, with dependency caching for faster runs.
    • Pipeline installs dependencies, conditionally builds the project, and runs the test suite to ensure stability.
    • No user-facing changes in this release.

Copilot AI review requested due to automatic review settings September 18, 2025 23:45
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Sep 18, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a GitHub Actions workflow for Node.js CI that runs on pushes and pull requests to main, using a version matrix (18.x, 20.x, 22.x). It checks out code, sets up Node with npm caching, installs dependencies via npm ci, conditionally builds, and runs tests.

Changes

Cohort / File(s) Summary of Changes
CI Workflow: Node.js matrix
.github/workflows/node.js.yml
Introduces a GitHub Actions workflow named “Node.js CI” triggered on push/PR to main; runs on ubuntu-latest with Node 18.x/20.x/22.x matrix; steps: checkout, setup-node with cache, npm ci, conditional npm run build, npm test.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer
  participant GH as GitHub
  participant WF as Node.js CI Workflow
  participant R1 as Runner (ubuntu-latest)
  participant NPM as npm

  Dev->>GH: Push / PR to main
  GH->>WF: Trigger workflow
  WF->>R1: Start job (matrix: Node 18.x/20.x/22.x)
  R1->>R1: actions/checkout
  R1->>R1: setup-node (with cache)
  R1->>NPM: npm ci
  alt build script exists
    R1->>NPM: npm run build
  else
    R1->>R1: Skip build
  end
  R1->>NPM: npm test
  R1-->>GH: Report status per Node version
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paws at pipelines new,
Three burrows of Node we tunnel through—
Eighteen, twenty, twenty-two!
Cache the carrots, test the stew,
Build if needed, hop on cue—
Green lights glow, and off we zoom! 🥕✨

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch AKarode-patch-1

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9296729 and 70b90b3.

📒 Files selected for processing (1)
  • .github/workflows/node.js.yml (1 hunks)

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a GitHub Actions workflow to run Node.js CI on Ubuntu, installing dependencies, building (if present), and running tests across multiple Node versions.

  • Introduces a Node.js CI workflow triggered on pushes and pull requests to main.
  • Sets up a matrix for Node 18.x, 20.x, and 22.x; runs npm ci, optional build, and tests.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +23 to +31
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test
Copy link

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list items under steps are indented at the same level as the steps key, which is invalid YAML for GitHub Actions. Indent each list item two spaces under steps and shift the nested fields accordingly so the workflow parses (e.g., steps: followed by two-space-indented - uses..., and within a step, properties like uses/with indented two more spaces).

Suggested change
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test

Copilot uses AI. Check for mistakes.
branches: [ "main" ]
pull_request:
branches: [ "main" ]

Copy link

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a least-privilege permissions block to restrict the GITHUB_TOKEN for this workflow. For example, add at the top level: permissions: contents: read (place it between the on: block and jobs:).

Suggested change
permissions:
contents: read

Copilot uses AI. Check for mistakes.
@rishidil rishidil closed this Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants