Skip to content

Commit 4fd6499

Browse files
committed
more work on package stuff. update docs to show current status
1 parent bd9d5ba commit 4fd6499

File tree

31 files changed

+356
-681
lines changed

31 files changed

+356
-681
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ circleci_config_reference
44
PROJECT_PLAN.md
55

66
examples/**/build/
7+
examples/**/.circleci/
78

89
# Nx
910
.nx/

.prettierignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Exclude YAML template files with intentional formatting issues
22
src/providers/circleci/templates/patch_approval_jobs_status.yml
33

4+
# symlinks
5+
AGENTS.md
6+
47
# Standard ignores
58
node_modules/
69
target/
710
dist/
811
build/
9-
.git/
12+
.git/

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CLAUDE.md

README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
# CIGen
22

3-
CIGen makes your CI configuration files more maintainable and has many built-in power features to make them more efficient. Especially beneficial for monorepos.
3+
CIGen generates CI configuration from a small set of reusable, provider-agnostic files. It currently targets CircleCI and focuses on correctness, validation, and convention-over-configuration.
44

5-
This tool can be used to build both static config and [dynamic config for CircleCI](https://circleci.com/docs/dynamic-config/). The CLI includes a file hashing feature that can be used during the initial setup workflow to skip jobs when no files have changed.r
5+
The tool can generate both static CircleCI configs and setup/dynamic configs. The CLI includes utilities for validation, graph visualization, and template-based multi-output generation.
66

7-
## Features
7+
## Features (Current)
88

9-
- Supports CircleCI and GitHub Actions (soon)
10-
- Written in Rust for performance and reliability
11-
- Caching and intelligent job skipping as a core feature with configurable cache backends
12-
- Built-in defaults for many languages and package managers (completely configurable)
13-
- First-class support for running jobs on multiple architectures and self-hosted runners
14-
- Automatic git checkout with extra caching support for self-hosted runners
15-
- Automatic job dependencies with cache restoration
16-
- Powerful templating engine ([MiniJinja](https://github.com/mitsuhiko/minijinja))
17-
- Beautiful and descriptive error messages ([miette](https://docs.rs/miette/latest/miette/))
9+
- CircleCI provider support (config generation and validation)
10+
- Rust implementation for reliability and performance
11+
- Template-based multi-output generation (Jinja-like via MiniJinja)
12+
- Built-in defaults for package/version detection (extensible via YAML)
13+
- Package installation step generation and job deduplication
14+
- Basic automatic cache step injection when `job.cache` is declared
15+
- Architecture variants per job (e.g., `build_amd64`, `build_arm64`)
16+
- Descriptive error messages and schema/data validation ([miette], JSON Schema)
17+
18+
## Not Yet Implemented / In Progress
19+
20+
- GitHub Actions and other providers
21+
- Persistent job-status cache for skipping jobs across runs
22+
- OR-dependencies and approval-status patching via APIs
23+
- Self-hosted runner-specific optimizations and resource-class mapping
1824

1925
## Why did we build this?
2026

@@ -29,9 +35,8 @@ We had built our own internal CI config generation system in Ruby, but it had st
2935
`cigen` simplifies CI/CD configuration management by:
3036

3137
- Generating CI pipeline configurations from reusable templates
32-
- Integrating with Nx monorepo tooling to understand project dependencies
33-
- Supporting multiple CI providers (starting with CircleCI)
34-
- Providing plugin-based architecture for cache backends and CI providers
38+
- Validating configuration (schema + data-level) with helpful spans
39+
- Emitting native CircleCI 2.1 YAML, including workflows, jobs, and commands
3540

3641
## Philosophy
3742

@@ -41,9 +46,9 @@ We had built our own internal CI config generation system in Ruby, but it had st
4146

4247
We automatically add a highly-optimized git checkout step to the beginning of each job, which includes caching for remote runners. The git checkout step can be skipped for jobs that don't need it.
4348

44-
#### Jobs should be skipped if nothing has changed
49+
#### Job skipping
4550

46-
Most CI providers only support caching as a second-class feature - something you add as a "step" during your job. `cigen` makes caching an integral part of your CI config. Every job MUST provide a list of file patterns. If none of those files have changed, the job is skipped and the existing cache is used. We inject all of the caching steps automatically.
51+
The codebase contains an initial scaffold for job skipping using a source-file hash and a local marker file. This is experimental and not yet wired to a persistent cache backend, so it does not skip across separate runs. A robust, persistent job-status cache is planned.
4752

4853
#### Cross-platform CI config
4954

@@ -53,7 +58,7 @@ CI providers often solve the same problem in different ways. e.g. to avoid dupli
5358

5459
#### You can still use native CI provider features
5560

56-
You can still write a step that uses GitHub's "Actions" or CircleCI's "orbs". (We'll just raise a validation error if you try to use an "orb" on GitHub actions.)
61+
You can still use native CircleCI features (e.g., orbs). Other providers will come later; unsupported features are validated with clear errors.
5762

5863
---
5964

@@ -68,7 +73,7 @@ cd cigen
6873

6974
Prerequisites:
7075

71-
- Rust (will automatically use 1.88.0 via `rust-toolchain.toml`)
76+
- Rust (uses the version pinned in `rust-toolchain.toml`)
7277
- Git
7378

7479
1. **Run the setup script** (installs git hooks and checks your environment):
@@ -175,12 +180,7 @@ curl -sSL https://github.com/evilmartians/lefthook/releases/latest/download/left
175180
chmod +x /usr/local/bin/lefthook
176181
```
177182

178-
The git hooks will:
179-
180-
- **pre-commit**: Run `cargo fmt --check`, `cargo clippy`, and `cargo test`
181-
- **pre-push**: Run full checks including `cargo check`
182-
183-
To skip hooks temporarily: `git commit --no-verify`
183+
The git hooks will run format, lint, and tests before commit/push. Do not bypass hooks; fix issues they report.
184184

185185
### Project Structure
186186

@@ -193,7 +193,7 @@ cigen/
193193
│ └── integration_test.rs # Integration tests
194194
├── scripts/
195195
│ └── setup.sh # Developer setup script
196-
├── .cigen/ # Templates and configuration (future)
196+
├── .cigen/ # Templates and configuration
197197
├── Cargo.toml # Project dependencies
198198
├── rust-toolchain.toml # Rust version specification
199199
├── .rustfmt.toml # Code formatting rules

docs/src/content/docs/advanced/job-skipping.mdx

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,19 @@ import {
1111
Card,
1212
} from '@astrojs/starlight/components';
1313

14-
Cigen's job skipping system automatically skips jobs when their source files haven't changed since the last successful run. This is the core efficiency feature that eliminates unnecessary work in CI pipelines while maintaining correctness.
14+
Cigen contains an initial scaffold for job skipping based on a hash of source files. This is experimental: the current implementation writes a local marker file and is not yet backed by a persistent cache, so it does not skip across separate CI runs.
1515

1616
## How It Works
1717

1818
<Steps>
19-
20-
1. **Pre-execution**: Calculate SHA-256 hash of all source files
21-
2. **Skip check**: If cache marker exists for this hash, skip the job entirely
22-
3. **Post-execution**: On successful completion, record the hash in skip cache
23-
19+
1. Calculate SHA-256 hash of configured source files
20+
2. Check for a local skip marker file for that hash
21+
3. If present, halt remaining steps (CircleCI)
22+
4. Otherwise, run the job and write the marker file at the end
2423
</Steps>
2524

2625
<Aside type="tip">
27-
Job skipping only occurs after successful completion - failed jobs never
28-
create skip markers, ensuring reliability.
26+
This is non-persistent. Markers live under `/tmp` in the job container and are not restored across runs yet.
2927
</Aside>
3028

3129
## Source File Configuration
@@ -110,13 +108,11 @@ Job skipping is architecture-aware:
110108
title="Architecture-aware skipping"
111109
/>
112110

113-
Generates separate skip cache entries:
111+
Writes separate marker files per architecture under `/tmp/cigen_skip_cache/`, for example:
114112

115113
- `/tmp/cigen_skip_cache/job_{hash}_amd64`
116114
- `/tmp/cigen_skip_cache/job_{hash}_arm64`
117115

118-
Each architecture can skip independently based on completion status.
119-
120116
## Generated Implementation
121117

122118
### Hash Calculation
@@ -171,37 +167,14 @@ Each architecture can skip independently based on completion status.
171167
title="Success recording"
172168
/>
173169

174-
## Platform Implementations
175-
176-
<CardGrid>
177-
<Card title="CircleCI" icon="seti:config">
178-
Uses `circleci step halt` to skip remaining steps in job
179-
</Card>
180-
<Card title="GitHub Actions" icon="github">
181-
Uses early `exit 0` with conditional step execution
182-
</Card>
183-
<Card title="GitLab CI" icon="seti:gitlab">
184-
Uses `exit 0` with job result caching
185-
</Card>
186-
</CardGrid>
187-
188-
## Benefits
189-
190-
<CardGrid>
191-
<Card title="Time Savings" icon="rocket">
192-
Skip jobs when source files haven't changed - often 50-80% reduction in CI
193-
time
194-
</Card>
195-
<Card title="Cost Efficiency" icon="approve-check">
196-
Reduce CI resource usage and costs significantly
197-
</Card>
198-
<Card title="Faster Feedback" icon="forward">
199-
Get results faster for unchanged components and dependencies
200-
</Card>
201-
<Card title="Reliability" icon="star">
202-
Only skips after successful completion - failed jobs always re-run
203-
</Card>
204-
</CardGrid>
170+
## Platform Notes
171+
172+
- CircleCI: uses `circleci step halt` to skip remaining steps in a job
173+
- Other providers: not yet implemented
174+
175+
## Status and Roadmap
176+
177+
This feature is incomplete without a persistent backend. A job-status cache (to restore skip markers across runs) is planned.
205178

206179
## Real-World Examples
207180

0 commit comments

Comments
 (0)