Basic CI Pipeline
A basic CI pipeline example that performs lint, test, and build
A basic CI pipeline that performs lint, test, and build for a Node.js project.
Full Code
# Workflow name — displayed on the dashboard
name: basic-ci
# Trigger: runs on push to the main branch
triggers:
push:
branches: [main]
jobs:
# ─────────────────────────────────────────
# Step 1: Source code checkout
# ─────────────────────────────────────────
checkout:
phase: source
steps:
- name: checkout
uses: "collabops/checkout@v2"
with:
repo-url: "https://<collabops-host>/<workspace>/<repository>.git"
# ─────────────────────────────────────────
# Step 2: Lint (runs after checkout completes)
# ─────────────────────────────────────────
lint:
phase: test
needs: [checkout] # Runs after checkout completes
steps:
- name: eslint
run: npm run lint # Run ESLint
image: node:18 # Uses Node.js 18 image
# ─────────────────────────────────────────
# Step 3: Test (runs after checkout, parallel with lint)
# ─────────────────────────────────────────
test:
phase: test
needs: [checkout] # Runs in parallel with lint
steps:
- name: unit-test
run: npm test # Run unit tests (Jest/Vitest, etc.)
image: node:18
env:
CI: "true" # Indicate CI environment (referenced by test frameworks)
# ─────────────────────────────────────────
# Step 4: Build (runs after both lint + test complete)
# ─────────────────────────────────────────
build:
phase: build
needs: [lint, test] # Runs only after both lint and test succeed
steps:
- name: compile
run: npm run build # Production build
image: node:18Execution Flow
checkout
├── lint (parallel)
└── test (parallel)
└── build (after lint + test complete)Key Points
checkout is separated into its own Job to prepare the source code first.
lint and test only have needs: [checkout], so they run in parallel.
build has needs: [lint, test], so it only runs after both Jobs succeed.
The phase metadata visually distinguishes stages on the dashboard.