Skip to content

Tutorial: CI Pipeline for a Node.js App

In this tutorial you will build a complete CI pipeline for a Node.js application: lint, test, and build, triggered on every push to main and on pull requests.

Time: ~15 minutes Export target: GitHub Actions


What you'll build

Trigger: push to main / pull_request to main


[Quality Stage] ─────────────────────────────────┐
  ├── lint (ubuntu-latest)                         │
  │     1. Checkout                                │
  │     2. Setup Node.js 20                        │
  │     3. npm ci                                  │
  │     4. npm run lint                            │
  │                                                │
  └── test (ubuntu-latest)           run in parallel
        1. Checkout                                │
        2. Setup Node.js 20                        │
        3. npm ci                                  │
        4. npm test -- --coverage                  │

    ▼ (only if Quality succeeds) ──────────────────┘
[Build Stage]
  └── build (ubuntu-latest)
        1. Checkout
        2. Setup Node.js 20
        3. npm ci
        4. npm run build
        5. Upload artifact

Step 1 — Create the project and pipeline

  1. On the dashboard, click New Project
  2. Name it my-node-app, set provider to github
  3. Inside the project, click New Pipeline, name it ci

Step 2 — Set the trigger

Click Trigger in the toolbar. Configure:

  • Push → branches: main

We'll add the pull request trigger after. For now, save and come back.

TIP

You can configure multiple trigger types by saving the pipeline and updating the trigger again. Or simply add pull_request branches in the YAML after exporting.

Step 3 — Add the Quality stage

Click the canvas → Add Stage → name it Quality.

Double-click the Quality card to enter the stage view.

Add the lint job

Click Add Job:

  • Name: lint
  • Runs on: ubuntu-latest

Double-click the lint job to enter job view. Add these steps:

Step 1 — Checkout

  • Type: git / Operation: checkout

Step 2 — Install dependencies

  • Type: shell_command
  • Shell: bash
  • Script: npm ci

Step 3 — Lint

  • Type: shell_command
  • Shell: bash
  • Script: npm run lint

Use the breadcrumb to go back to the Stage view.

Add the test job

Click Add Job:

  • Name: test
  • Runs on: ubuntu-latest

Double-click test and add these steps:

Step 1 — Checkout

  • Type: git / Operation: checkout

Step 2 — Install dependencies

  • Type: shell_command / Script: npm ci

Step 3 — Run tests with coverage

  • Type: test
  • Framework: jest (or vitest)
  • Command: npm test -- --coverage

The lint and test jobs are not connected by an edge — they run in parallel. ✓

Step 4 — Add the Build stage

Go back to the Pipeline view via the breadcrumb.

Click the canvas → Add Stage → name it Build.

Connect the stages: hover over Quality, grab the right-edge handle, drag to Build. An arrow appears.

Double-click Build to enter it. Add a job:

  • Name: build
  • Runs on: ubuntu-latest

Add these steps:

Step 1 — Checkout

  • Type: git / Operation: checkout

Step 2 — Install dependencies

  • Type: shell_command / Script: npm ci

Step 3 — Build

  • Type: build
  • Tool: npm
  • Command: npm run build

Step 4 — Upload artifact (optional)

  • Type: shell_command
  • Script:
    bash
    # This step is platform-specific — add manually in the YAML if needed
    echo "Build artifact ready in ./dist"

Step 5 — Save and export

  1. Click Save (Ctrl+S)
  2. Click Export → select GitHub ActionsDownload

You'll get a file named ci.yml.

Step 6 — Add to your repository

Create the workflows directory and commit:

bash
mkdir -p .github/workflows
cp ~/Downloads/ci.yml .github/workflows/ci.yml
git add .github/workflows/ci.yml
git commit -m "ci: add CI pipeline"
git push origin main

GitHub will pick up the workflow automatically and run it on the next push.

Step 7 — Add secrets (if needed)

If any of your steps require secrets (e.g. a private registry), add them to your repository:

GitHub: Settings → Secrets and variables → Actions → New repository secret


Result: generated GitHub Actions YAML

yaml
name: ci
on:
  push:
    branches:
      - main

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm run lint

  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm test -- --coverage

  build:
    runs-on: ubuntu-latest
    needs: [lint, test]
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm run build

Released under the MIT License.