2026-02-09 12:24:11 -08:00
|
|
|
---
|
|
|
|
|
title: CI Pipeline
|
2026-02-09 12:40:58 -08:00
|
|
|
description: How the OpenClaw CI pipeline works and why jobs are ordered the way they are.
|
2026-02-09 12:24:11 -08:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# CI Pipeline
|
|
|
|
|
|
|
|
|
|
OpenClaw uses a tiered CI pipeline that fails fast on cheap checks before
|
|
|
|
|
running expensive builds and tests. This saves runner minutes and reduces
|
|
|
|
|
GitHub API pressure.
|
|
|
|
|
|
|
|
|
|
## Pipeline Tiers
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Tier 0 — Scope detection (~12 s, free runners)
|
|
|
|
|
docs-scope → changed-scope
|
|
|
|
|
|
|
|
|
|
Tier 1 — Cheapest gates (parallel, ~43 s)
|
|
|
|
|
check-format secrets
|
|
|
|
|
|
|
|
|
|
Tier 2 — After format (parallel, ~2 min)
|
2026-02-09 17:52:51 -08:00
|
|
|
check-lint code-analysis
|
2026-02-09 12:24:11 -08:00
|
|
|
|
|
|
|
|
Tier 3 — Build (~3 min)
|
2026-02-09 17:52:51 -08:00
|
|
|
build-artifacts release-check
|
2026-02-09 12:24:11 -08:00
|
|
|
|
|
|
|
|
Tier 4 — Tests (~5 min)
|
|
|
|
|
checks (node tsgo / test / protocol, bun test)
|
|
|
|
|
checks-windows (lint / test / protocol)
|
|
|
|
|
|
|
|
|
|
Tier 5 — Platform (most expensive)
|
|
|
|
|
macos (TS tests + Swift lint/build/test)
|
|
|
|
|
android (test + build)
|
|
|
|
|
ios (disabled)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Dependency Graph
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
docs-scope ──► changed-scope ──┐
|
|
|
|
|
│
|
2026-02-09 17:52:51 -08:00
|
|
|
check-format ──► check-lint ──►├──► build-artifacts ──► release-check
|
|
|
|
|
├─► code-analysis ►│ └──► checks-windows
|
2026-02-09 12:24:11 -08:00
|
|
|
├──► checks
|
|
|
|
|
├──► macos
|
|
|
|
|
└──► android
|
|
|
|
|
secrets (independent)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Job Details
|
|
|
|
|
|
|
|
|
|
### Tier 0 — Scope Detection
|
|
|
|
|
|
|
|
|
|
| Job | Runner | Purpose |
|
|
|
|
|
| --------------- | --------------- | ----------------------------------------------------------------------- |
|
|
|
|
|
| `docs-scope` | `ubuntu-latest` | Detects docs-only PRs to skip heavy jobs |
|
|
|
|
|
| `changed-scope` | `ubuntu-latest` | Detects which areas changed (node/macos/android) to skip unrelated jobs |
|
|
|
|
|
|
|
|
|
|
### Tier 1 — Cheapest Gates
|
|
|
|
|
|
|
|
|
|
| Job | Runner | Purpose |
|
|
|
|
|
| -------------- | ----------------- | ------------------------------------------- |
|
|
|
|
|
| `check-format` | Blacksmith 4 vCPU | Runs `pnpm format` — cheapest gate (~43 s) |
|
|
|
|
|
| `secrets` | Blacksmith 4 vCPU | Runs `detect-secrets` scan against baseline |
|
|
|
|
|
|
|
|
|
|
### Tier 2 — After Format
|
|
|
|
|
|
2026-02-09 17:52:51 -08:00
|
|
|
| Job | Runner | Depends on | Purpose |
|
|
|
|
|
| --------------- | ----------------- | -------------- | ----------------------------------------------------------- |
|
|
|
|
|
| `check-lint` | Blacksmith 4 vCPU | `check-format` | Runs `pnpm lint` — cleaner output after format passes |
|
|
|
|
|
| `code-analysis` | Blacksmith 4 vCPU | `check-format` | Checks LOC thresholds — accurate counts need formatted code |
|
2026-02-09 12:24:11 -08:00
|
|
|
|
|
|
|
|
### Tier 3 — Build
|
|
|
|
|
|
2026-02-09 17:52:51 -08:00
|
|
|
| Job | Runner | Depends on | Purpose |
|
|
|
|
|
| ----------------- | ----------------- | ----------------------------- | -------------------------------- |
|
|
|
|
|
| `build-artifacts` | Blacksmith 4 vCPU | `check-lint`, `code-analysis` | Builds dist and uploads artifact |
|
|
|
|
|
| `release-check` | Blacksmith 4 vCPU | `build-artifacts` | Validates npm pack contents |
|
2026-02-09 12:24:11 -08:00
|
|
|
|
|
|
|
|
### Tier 4+ — Tests and Platform
|
|
|
|
|
|
2026-02-09 17:52:51 -08:00
|
|
|
| Job | Runner | Depends on | Purpose |
|
|
|
|
|
| ---------------- | ------------------ | ------------------------------------------------ | ------------------------------------------------------ |
|
|
|
|
|
| `checks` | Blacksmith 4 vCPU | `check-lint`, `code-analysis` | TypeScript checks, tests (Node + Bun), protocol checks |
|
|
|
|
|
| `checks-windows` | Blacksmith Windows | `build-artifacts`, `check-lint`, `code-analysis` | Windows-specific lint, tests, protocol checks |
|
|
|
|
|
| `macos` | `macos-latest` | `check-lint`, `code-analysis` | TS tests + Swift lint/build/test (PR only) |
|
|
|
|
|
| `android` | Blacksmith 4 vCPU | `check-lint`, `code-analysis` | Gradle test + build |
|
2026-02-09 12:24:11 -08:00
|
|
|
|
2026-02-09 17:52:51 -08:00
|
|
|
## Code-Analysis Gate
|
2026-02-09 12:24:11 -08:00
|
|
|
|
2026-02-09 17:52:51 -08:00
|
|
|
The `code-analysis` job runs `scripts/analyze_code_files.py` on PRs to catch:
|
2026-02-09 12:24:11 -08:00
|
|
|
|
|
|
|
|
1. **Threshold crossings** — files that grew past 1000 lines in the PR
|
|
|
|
|
2. **Already-large files growing** — files already over 1000 lines that got bigger
|
|
|
|
|
3. **Duplicate function regressions** — new duplicate functions introduced by the PR
|
|
|
|
|
|
|
|
|
|
When `--strict` is set, any violation fails the job and blocks all downstream
|
2026-02-09 17:52:51 -08:00
|
|
|
work. On push to `main`, the code-analysis steps are skipped (the job passes as a
|
2026-02-09 12:24:11 -08:00
|
|
|
no-op) so pushes still run the full test suite.
|
|
|
|
|
|
|
|
|
|
### Excluded Directories
|
|
|
|
|
|
|
|
|
|
The analysis skips: `node_modules`, `dist`, `vendor`, `.git`, `coverage`,
|
|
|
|
|
`Swabble`, `skills`, `.pi` and other non-source directories. See the
|
|
|
|
|
`SKIP_DIRS` set in `scripts/analyze_code_files.py` for the full list.
|
|
|
|
|
|
|
|
|
|
## Fail-Fast Behavior
|
|
|
|
|
|
|
|
|
|
**Bad PR (formatting violations):**
|
|
|
|
|
|
|
|
|
|
- `check-format` fails at ~43 s
|
2026-02-09 17:52:51 -08:00
|
|
|
- `check-lint`, `code-analysis`, and all downstream jobs never start
|
2026-02-09 12:24:11 -08:00
|
|
|
- Total cost: ~1 runner-minute
|
|
|
|
|
|
|
|
|
|
**Bad PR (lint or LOC violations, good format):**
|
|
|
|
|
|
2026-02-09 17:52:51 -08:00
|
|
|
- `check-format` passes → `check-lint` and `code-analysis` run in parallel
|
2026-02-09 12:24:11 -08:00
|
|
|
- One or both fail → all downstream jobs skipped
|
|
|
|
|
- Total cost: ~3 runner-minutes
|
|
|
|
|
|
|
|
|
|
**Good PR:**
|
|
|
|
|
|
|
|
|
|
- Critical path: `check-format` (43 s) → `check-lint` (1m 46 s) → `build-artifacts` → `checks`
|
2026-02-09 17:52:51 -08:00
|
|
|
- `code-analysis` runs in parallel with `check-lint`, adding no latency
|
2026-02-09 12:24:11 -08:00
|
|
|
|
|
|
|
|
## Composite Action
|
|
|
|
|
|
|
|
|
|
The `setup-node-env` composite action (`.github/actions/setup-node-env/`)
|
|
|
|
|
handles the shared setup boilerplate:
|
|
|
|
|
|
|
|
|
|
- Node.js 22 setup
|
|
|
|
|
- pnpm via corepack + store cache
|
|
|
|
|
- Optional Bun install
|
|
|
|
|
- `pnpm install` with retry
|
|
|
|
|
|
2026-02-09 12:40:58 -08:00
|
|
|
The `macos` job also caches SwiftPM packages (`~/Library/Caches/org.swift.swiftpm`)
|
|
|
|
|
to speed up dependency resolution.
|
|
|
|
|
|
2026-02-09 12:24:11 -08:00
|
|
|
This eliminates ~40 lines of duplicated YAML per job.
|
|
|
|
|
|
|
|
|
|
## Push vs PR Behavior
|
|
|
|
|
|
2026-02-09 17:52:51 -08:00
|
|
|
| Trigger | `code-analysis` | Downstream jobs |
|
2026-02-09 12:24:11 -08:00
|
|
|
| -------------- | ----------------------------- | --------------------- |
|
|
|
|
|
| Push to `main` | Steps skipped (job passes) | Run normally |
|
|
|
|
|
| Pull request | Full analysis with `--strict` | Blocked on violations |
|
|
|
|
|
|
|
|
|
|
## Runners
|
|
|
|
|
|
|
|
|
|
| Name | OS | vCPUs | Used by |
|
|
|
|
|
| ------------------------------- | ------------ | ----- | ---------------- |
|
|
|
|
|
| `blacksmith-4vcpu-ubuntu-2404` | Ubuntu 24.04 | 4 | Most jobs |
|
|
|
|
|
| `blacksmith-4vcpu-windows-2025` | Windows 2025 | 4 | `checks-windows` |
|
|
|
|
|
| `macos-latest` | macOS | — | `macos`, `ios` |
|
|
|
|
|
| `ubuntu-latest` | Ubuntu | 2 | Scope detection |
|