CI/CD
Statly Code includes built-in continuous integration powered by AWS Lambda. Run tests, lint code, and build projects automatically on every push and pull request.
Overview
The CI system provides:
- Automatic triggering on push and PR events
- Multiple language support (Node.js, Go, Python, Rust)
- Dependency caching for faster builds
- Test result parsing with detailed reports
- Branch protection integration for merge blocking
- AI auto-merge when tests pass
Architecture
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Git Push β -> β SQS Queue β -> β Lambda Runner β
β PR Created β β (CI Jobs) β β (Container) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βββββββββ΄ββββββββ
β β
βββββββ΄ββββββ βββββββ΄ββββββ
β S3 Cache β β S3 Artifactsβ
βββββββββββββ βββββββββββββConfiguring CI
Enable CI
- Go to Repository Settings β CI/CD
- Toggle Enable CI
- Configure triggers and commands
Pipeline Configuration
| Setting | Description | Default |
|---|---|---|
projectType | Auto-detect or specify: nodejs, go, python, rust | auto |
installCommand | Dependency installation command | Auto-detected |
testCommand | Test execution command | Auto-detected |
lintCommand | Lint command (optional) | None |
buildCommand | Build command (optional) | None |
timeout | Max run time in seconds | 600 (10 min) |
cacheEnabled | Enable dependency caching | true |
Trigger Configuration
| Trigger | Description | Default |
|---|---|---|
triggerOnPush | Run on every push | true |
triggerOnPR | Run on PR creation/update | true |
Auto-Detection
When projectType is auto, the runner detects your project type:
| Files Detected | Project Type | Install | Test |
|---|---|---|---|
package.json + pnpm-lock.yaml | Node.js (pnpm) | pnpm install | pnpm test |
package.json + yarn.lock | Node.js (yarn) | yarn install | yarn test |
package.json | Node.js (npm) | npm ci | npm test |
go.mod | Go | go mod download | go test ./... |
requirements.txt | Python | pip install -r requirements.txt | pytest |
pyproject.toml | Python (Poetry) | pip install . | pytest |
Cargo.toml | Rust | cargo build | cargo test |
Runtime Environment
The CI runner includes:
| Runtime | Version |
|---|---|
| Node.js | 20.x |
| npm | Latest |
| pnpm | Latest |
| yarn | Latest |
| Go | 1.22 |
| Python | 3.12 |
| Rust | Latest stable |
| Git | Latest |
Environment Variables
Default environment variables available:
CI=true
STATLY_CI=true
STATLY_RUN_ID=run_xxx
STATLY_REPO=org/repo
STATLY_BRANCH=feature/branch
STATLY_COMMIT=abc123
STATLY_PR_NUMBER=42 # Only on PR buildsCustom Environment Variables
Add custom variables in Repository Settings β CI/CD β Environment Variables:
Secret variables are encrypted at rest and never exposed in logs.
Dependency Caching
Caching speeds up subsequent builds by preserving dependencies:
| Project Type | Cached Directories |
|---|---|
| Node.js | node_modules, .pnpm-store |
| Go | ~/go/pkg/mod |
| Python | ~/.cache/pip, .venv |
| Rust | ~/.cargo, target |
Cache entries expire after 7 days of inactivity.
Test Results
The runner parses test output for detailed reporting:
Supported Frameworks
| Framework | Project Type | Output Format |
|---|---|---|
| Jest | Node.js | JSON reporter |
| Vitest | Node.js | JSON reporter |
| Mocha | Node.js | JSON reporter |
| go test | Go | Standard output |
| pytest | Python | JUnit XML |
Test Summary
Tests: 42 passed, 2 failed, 3 skipped
Coverage: 87.3%
Failed Tests:
β UserService.createUser should validate email
Expected: valid email
Received: undefined
at src/services/user.test.ts:42CI Runs
Run States
| State | Description |
|---|---|
queued | Waiting for runner |
running | Currently executing |
completed | Finished (check conclusion) |
Run Conclusions
| Conclusion | Description |
|---|---|
success | All checks passed |
failure | Tests failed |
error | Infrastructure error |
cancelled | Manually cancelled |
Viewing Logs
- Go to the PR or Repository β CI Runs
- Click on the run number
- View logs for each job
Branch Protection Integration
CI integrates with branch protection:
- Go to Repository Settings β Branches
- Select a branch protection rule
- Enable Require status checks
- Select CI checks to require
When required, PRs cannot be merged until CI passes.
AI Auto-Merge
When configured, PRs can auto-merge after:
- CI checks pass
- AI review approves (if enabled)
- Required human approvals obtained
See AI Code Review β Auto-Merge for configuration.
Limits
| Plan | CI Minutes/Month | Concurrent Jobs | Timeout |
|---|---|---|---|
| Free | 100 | 1 | 5 min |
| Pro | 1,000 | 5 | 15 min |
| Enterprise | Unlimited | 10 | 15 min |
CI runs on AWS Lambda, which has generous free tier limits (1M requests, 400K GB-seconds).
API Reference
Trigger CI Run
POST /api/v1/code/repos/{org}/{repo}/ci/runs
Content-Type: application/json
{
"branch": "main",
"commitSha": "abc123"
}List CI Runs
GET /api/v1/code/repos/{org}/{repo}/ci/runs?status=completed&limit=20Get CI Run
GET /api/v1/code/repos/{org}/{repo}/ci/runs/{number}
# Response
{
"run": {
"id": "run_xxx",
"number": 42,
"status": "completed",
"conclusion": "success",
"branch": "main",
"commitSha": "abc123",
"duration": 45,
"startedAt": "2024-01-01T00:00:00Z",
"completedAt": "2024-01-01T00:00:45Z"
},
"jobs": [...],
"testSummary": {
"total": 42,
"passed": 40,
"failed": 2,
"skipped": 0
}
}Cancel CI Run
POST /api/v1/code/repos/{org}/{repo}/ci/runs/{number}/cancelRe-run CI
POST /api/v1/code/repos/{org}/{repo}/ci/runs/{number}/rerunTroubleshooting
Common Issues
Tests pass locally but fail in CI:
- Check Node.js/Go/Python version differences
- Ensure all dependencies are in package.json/go.mod/requirements.txt
- Check for hardcoded paths or environment-specific code
Timeout errors:
- Increase timeout in pipeline settings
- Optimize slow tests
- Use caching effectively
Cache not working:
- Verify lock files are committed
- Check cache key generation
Missing dependencies:
- Ensure install command runs first
- Check for native dependencies that need system packages