Not every CI run needs full analysis:
| Context | Need | Priority |
|---|---|---|
| Pre-commit hook | Fast feedback | Speed |
| Before push | Confidence | Thoroughness |
| Nightly build | Full audit | Coverage |
| Quick iteration | Minimal checks | Speed |
Profiles let you choose the right trade-off.
Use case: AI-agent self-check loop, quick iteration, pre-commit hooks
Stages: fmt → lint → line-limits → build → (smoke)tests → launch
Skips: (huge)tests (if 2+ minutes), coverage (if 2+ minutes), security, archive
./run.ps1 -FastTypical duration: 5-30 seconds
Use case: Before push, PR validation
Stages: fmt → lint → line-limits → build → tests → coverage → e2e → maintenance → launch
Skips: archive
./run.ps1Typical duration: 1-5 minutes
Use case: Periodic maintenance run (security + dependencies + housekeeping + etc)
This profile is intentionally “out of band”: run it auto/manualy daily/weekly/pre-release. It can include:
- dependency audit (CVEs, license policy)
- SAST / basic security scanners
- housekeeping (cache/artifact cleanup, policy checks)
./run.ps1 -MaintenanceUse case: Building distributable artifacts
Stages: fmt → line-limits → lint → compile → test → build → archive
Additional: Optimized builds, version stamping
./run.ps1 -ReleaseTypical duration: 2-10 minutes
param(
[switch]$Fast,
[switch]$Release,
[switch]$Security,
[switch]$SkipTests,
[switch]$SkipCoverage,
[switch]$SkipLint
)
# Derive effective flags
$runLint = -not $SkipLint -and -not $Security
$runTests = -not $Fast -and -not $SkipTests -and -not $Security
$runCoverage = -not $Fast -and -not $SkipCoverage -and -not $Security
$runSecurity = $Security -or $Release
$runBuild = $Release
$runArchive = $Release| Stage | Fast | Full | Security | Release |
|---|---|---|---|---|
| fmt | ✓ | ✓ | ✗ | ✓ |
| line-limits | ✓ | ✓ | ✗ | ✓ |
| lint | ✓ | ✓ | ✗ | ✓ |
| build | ✓ | ✓ | ✗ | ✓ |
| test (if fast) | ✓ | ✓ | ✗ | ✓ |
| test | ✗ | ✓ | ✗ | ✓ |
| coverage (fast) | ✓ | ✓ | ✗ | ✓ |
| coverage | ✗ | ✓ | ✗ | ✓ |
| security | ✗ | ✓ | ✓ | ✓ |
| launch | ✓ | ✓ | ✗ | ✗ |
| archive | ✗ | ✗ | ✗ | ✓ |
Fine-grained control over individual stages:
| Flag | Effect |
|---|---|
-SkipLint |
Skip formatting/lint-related stages (e.g., fmt, line-limits, lint) |
-SkipTests |
Skip test stage |
-SkipCoverage |
Skip coverage stage (still runs tests) |
-SkipSecurity |
Skip security stage |
-SkipBuild |
Skip build stage |
-SkipLaunch |
Skip launch stage |
# Run full profile but skip coverage (faster)
./run.ps1 -SkipCoverage
# Run everything except security
./run.ps1 -Release -SkipSecurityProjects typically converge on a small set of flags. A useful superset (based on real-world runners) looks like:
| Flag | Category | Intent |
|---|---|---|
-Fast |
profile | Fast feedback (agent self-check) |
-Release |
profile | Produce distributable artifacts |
-Security |
profile | Security-only audit run |
-SkipLint |
skip | Skip formatter/lint/policy checks |
-SkipTests |
skip | Skip test stage |
-SkipCoverage |
skip | Skip coverage stage |
-SkipLaunch |
skip | CI only (no interactive run) |
-NoCache |
cache | Ignore cache for this run (still may write new cache on success) |
-ForceAll |
cache | Force all stages to re-run |
-Clean |
cache | Delete caches/artifacts before running |
-Verbose |
logging | Increase tool verbosity |
-ArchiveBuild |
artifacts | Create an archive of produced artifacts |
-UpdateSnapshots |
tests | Update snapshot tests during run |
-HeartbeatSec |
heartbeat | Heartbeat interval |
-HeartbeatSameLinePulses |
heartbeat | Hang detection sensitivity (0 disables) |
-HeartbeatSameLineMinSec |
heartbeat | Arm hang detection after this runtime |
-CoverageTimeoutSec |
heartbeat | Hard timeout for coverage stage |
Optional pattern (useful for language-specific tools):
- Forward arguments after
--fromrun.ps1tobuild.<lang>(or a language CI CLI).
Some projects need to run the application after CI:
| Flag | Behavior |
|---|---|
| (default) | Run CI, then launch app interactively |
-SkipLaunch |
Run CI only, no app launch |
-FastLaunch |
Skip CI, launch app immediately |
# CI for AI-Agent automation
./run.ps1 -Fast -SkipLaunch
# Quick testing
./run.ps1 -FastFor complex projects, define profiles in config:
// .ci/config.json
{
"profiles": {
"quick": {
"stages": ["fmt", "line-limits", "lint"],
"timeout_sec": 60
},
"full": {
"stages": ["fmt", "line-limits", "lint", "compile", "test", "coverage"],
"timeout_sec": 600
},
"nightly": {
"stages": ["fmt", "line-limits", "lint", "compile", "test", "coverage", "security"],
"timeout_sec": 1800,
"coverage_threshold": 80
}
}
}Usage:
./run.ps1 -Profile nightly#!/bin/sh
# .git/hooks/pre-commit
pwsh -File ./run.ps1 -Fast -SkipLaunch#!/bin/sh
# .git/hooks/pre-push
pwsh -File ./run.ps1 -SkipLaunchProfiles can be combined with skip flags:
# Release build without security scan
./run.ps1 -Release -SkipSecurity
# Fast check with lint disabled
./run.ps1 -Fast -SkipLint
# Full profile without coverage (faster tests)
./run.ps1 -SkipCoverage# During development: fast feedback
./run.ps1 -Fast
# Before commit: full validation
./run.ps1
# Before PR: ensure CI will pass
./run.ps1 -SkipLaunch# PR validation
./run.ps1 -SkipLaunch
# Nightly build
./run.ps1 -Release -SkipLaunch
# Security audit (weekly)
./run.ps1 -Security -SkipLaunch# Skip everything, just launch
./run.ps1 -FastLaunch
# Run tests only
./run.ps1 -SkipLint -SkipCoverage -SkipLaunch
# Force fresh run (ignore cache)
./run.ps1 -NoCache