Skip to content

Commit 3984211

Browse files
committed
updates
1 parent 3188fe2 commit 3984211

File tree

20 files changed

+298
-1667
lines changed

20 files changed

+298
-1667
lines changed

.cigen/workflows/ci/jobs/test.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ source_files:
44
- "@tests"
55
- "@examples"
66

7-
requires:
8-
- fmt
9-
- clippy
10-
117
steps:
128
- run:
139
name: Run tests

.github/workflows/ci.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
cp target/release/cigen .cigen/bin/cigen
4444
- uses: actions/upload-artifact@v4
4545
with:
46-
path: .cigen/bin/cigen
4746
name: cigen-bin
47+
path: .cigen/bin/cigen
4848
clippy:
4949
runs-on: ubuntu-latest
5050
container:
@@ -64,8 +64,13 @@ jobs:
6464
if: runner.os == 'Linux'
6565
run: |
6666
set -e
67-
sudo apt-get update
68-
sudo apt-get install -y protobuf-compiler
67+
if command -v sudo >/dev/null 2>&1; then
68+
sudo apt-get update
69+
sudo apt-get install -y protobuf-compiler
70+
else
71+
apt-get update
72+
apt-get install -y protobuf-compiler
73+
fi
6974
- name: Checkout repository
7075
uses: actions/checkout@v4
7176
- name: Download cigen binary
@@ -140,8 +145,13 @@ jobs:
140145
if: runner.os == 'Linux'
141146
run: |
142147
set -e
143-
sudo apt-get update
144-
sudo apt-get install -y protobuf-compiler
148+
if command -v sudo >/dev/null 2>&1; then
149+
sudo apt-get update
150+
sudo apt-get install -y protobuf-compiler
151+
else
152+
apt-get update
153+
apt-get install -y protobuf-compiler
154+
fi
145155
- name: Checkout repository
146156
uses: actions/checkout@v4
147157
- name: Download cigen binary
@@ -202,8 +212,6 @@ jobs:
202212
container:
203213
image: rust:latest
204214
needs:
205-
- fmt
206-
- clippy
207215
- build_cigen
208216
steps:
209217
- name: Prepare Node runtime for actions
@@ -218,8 +226,13 @@ jobs:
218226
if: runner.os == 'Linux'
219227
run: |
220228
set -e
221-
sudo apt-get update
222-
sudo apt-get install -y protobuf-compiler
229+
if command -v sudo >/dev/null 2>&1; then
230+
sudo apt-get update
231+
sudo apt-get install -y protobuf-compiler
232+
else
233+
apt-get update
234+
apt-get install -y protobuf-compiler
235+
fi
223236
- name: Checkout repository
224237
uses: actions/checkout@v4
225238
- name: Download cigen binary

.github/workflows/docs.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,13 @@ jobs:
3535
if: runner.os == 'Linux'
3636
run: |
3737
set -e
38-
sudo apt-get update
39-
sudo apt-get install -y protobuf-compiler
38+
if command -v sudo >/dev/null 2>&1; then
39+
sudo apt-get update
40+
sudo apt-get install -y protobuf-compiler
41+
else
42+
apt-get update
43+
apt-get install -y protobuf-compiler
44+
fi
4045
- name: Checkout repository
4146
uses: actions/checkout@v4
4247
- name: Download cigen binary
@@ -149,8 +154,13 @@ jobs:
149154
if: runner.os == 'Linux'
150155
run: |
151156
set -e
152-
sudo apt-get update
153-
sudo apt-get install -y protobuf-compiler
157+
if command -v sudo >/dev/null 2>&1; then
158+
sudo apt-get update
159+
sudo apt-get install -y protobuf-compiler
160+
else
161+
apt-get update
162+
apt-get install -y protobuf-compiler
163+
fi
154164
- name: Checkout repository
155165
uses: actions/checkout@v4
156166
- name: Download cigen binary
@@ -226,8 +236,13 @@ jobs:
226236
if: runner.os == 'Linux'
227237
run: |
228238
set -e
229-
sudo apt-get update
230-
sudo apt-get install -y protobuf-compiler
239+
if command -v sudo >/dev/null 2>&1; then
240+
sudo apt-get update
241+
sudo apt-get install -y protobuf-compiler
242+
else
243+
apt-get update
244+
apt-get install -y protobuf-compiler
245+
fi
231246
- name: Checkout repository
232247
uses: actions/checkout@v4
233248
- name: Download cigen binary

.github/workflows/release.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ jobs:
3333
if: runner.os == 'Linux'
3434
run: |
3535
set -e
36-
sudo apt-get update
37-
sudo apt-get install -y protobuf-compiler
36+
if command -v sudo >/dev/null 2>&1; then
37+
sudo apt-get update
38+
sudo apt-get install -y protobuf-compiler
39+
else
40+
apt-get update
41+
apt-get install -y protobuf-compiler
42+
fi
3843
- name: Checkout repository
3944
uses: actions/checkout@v4
4045
with:
@@ -144,13 +149,18 @@ jobs:
144149
if: runner.os == 'Linux'
145150
run: |
146151
set -e
147-
sudo apt-get update
148-
sudo apt-get install -y protobuf-compiler
152+
if command -v sudo >/dev/null 2>&1; then
153+
sudo apt-get update
154+
sudo apt-get install -y protobuf-compiler
155+
else
156+
apt-get update
157+
apt-get install -y protobuf-compiler
158+
fi
149159
- name: Checkout repository
150160
uses: actions/checkout@v4
151161
with:
152-
fetch-depth: 0
153162
fetch-tags: true
163+
fetch-depth: 0
154164
- name: Download cigen binary
155165
uses: actions/download-artifact@v4
156166
with:
@@ -255,8 +265,13 @@ jobs:
255265
if: runner.os == 'Linux'
256266
run: |
257267
set -e
258-
sudo apt-get update
259-
sudo apt-get install -y protobuf-compiler
268+
if command -v sudo >/dev/null 2>&1; then
269+
sudo apt-get update
270+
sudo apt-get install -y protobuf-compiler
271+
else
272+
apt-get update
273+
apt-get install -y protobuf-compiler
274+
fi
260275
- name: Checkout repository
261276
uses: actions/checkout@v4
262277
with:
@@ -350,11 +365,11 @@ jobs:
350365
if: steps.job_skip_cache.outputs.cache-hit != 'true'
351366
- uses: softprops/action-gh-release@v2
352367
with:
353-
prerelease: ${{ contains(env.RELEASE_TAG, '-') }}
368+
draft: false
354369
body_path: changelog.md
370+
prerelease: ${{ contains(env.RELEASE_TAG, '-') }}
355371
name: CIGen v${{ env.RELEASE_VERSION }}
356372
tag_name: ${{ env.RELEASE_TAG }}
357-
draft: false
358373
files: |
359374
artifacts/**/*.tar.gz
360375
artifacts/**/*.sha256

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ integration_tests/**/build/
1010

1111
/.circleci/
1212
/build/
13+
tmp/
1314

1415
# Nx
1516
.nx/

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Skipping or reordering these steps is not acceptable—they keep our feedback lo
9797

9898
## Project Overview
9999

100-
`cigen` is a Rust CLI tool that generates CI pipeline configurations from templates. It integrates with Nx monorepo tooling and supports multiple CI providers starting with CircleCI.
100+
`cigen` is a Rust CLI tool that generates CI pipeline configurations from templates. It is migrating to a plugin-based architecture that currently targets GitHub Actions for our self-hosting work, with CircleCI support being rebuilt on top of the same system.
101101

102102
See `PRD.txt` for the complete product requirements and specifications.
103103

@@ -352,7 +352,7 @@ You can also reference `/Users/ndbroadbent/code/docspring/lib/tools/generate_cir
352352

353353
## Use Our Own Tool
354354

355-
The goal is to eventually become 'self-hosting' for our own CI pipeline on GitHub Actions. We must have `nx.json` and `project.json` file in the root of the repository, a `.cigen/` directory, and a `.cigen/config.yml` file.
355+
The goal is to eventually become 'self-hosting' for our own CI pipeline on GitHub Actions. We already keep `turbo.json` and other workspace metadata in the repo alongside `.cigen/` so that the CLI can evolve toward Turborepo-aware features.
356356

357357
We will start by hand-writing our own GitHub Actions workflow files, but eventually migrate to using `cigen` to generate our CI configuration.
358358

@@ -395,6 +395,6 @@ We MUST use split config for large configuration sections:
395395

396396
## Key Concepts
397397

398-
- The tool reads Nx `project.json` files to understand project dependencies and file groups
398+
- The tool no longer relies on the old workspace-specific metadata that was tied to previous experiments. Future monorepo integrations will be driven by the plugin system (e.g., Turborepo) once the orchestration layer is complete.
399399
- Templates and configuration live in the `.cigen/` directory
400400
- The tool supports plugin-based cache backends and CI provider emitters

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ description = "A CLI tool that generates CI pipeline configurations from templat
2525
license = "MIT"
2626
repository = "https://github.com/DocSpring/cigen"
2727
readme = "README.md"
28-
keywords = ["cli", "ci", "nx", "circleci", "devops"]
28+
keywords = ["cli", "ci", "github-actions", "circleci", "devops"]
2929
categories = ["command-line-utilities", "development-tools"]
3030

3131
[dependencies]

README.md

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
# CIGen
22

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.
3+
CIGen generates CI configuration from reusable, provider-agnostic files. The project is undergoing a major migration to a Terraform-style plugin architecture: the new Rust core spawns provider binaries over a length-prefixed stdio transport, and those plugins emit provider-specific YAML.
44

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.
5+
Today the GitHub Actions provider plugin powers our own CI (`cargo run -- generate --file .cigen`), while the legacy CircleCI emitter is being rebuilt on top of the same plugin system. The CLI still provides the templating, schema validation, and hashing utilities that powered the earlier monolithic implementation.
66

77
## Features (Current)
88

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-
- Advanced git checkout: shallow clone by default with configurable clone/fetch options, host key scanning, and path overrides
17-
- Descriptive error messages and schema/data validation ([miette], JSON Schema)
18-
- Opt-in Docker builds with a single BASE_HASH and image DAG
9+
- Plugin manager (`src/plugin/`) with framing helpers, handshake workflow, and async request batching
10+
- GitHub Actions provider plugin (`plugins/provider-github`) that generates the workflows under `.github/workflows/`
11+
- Source file grouping and job-hash based skipping backed by `actions/cache`
12+
- Template-based multi-output generation (MiniJinja) for additional artefacts
13+
- Rich schema validation using JSON Schema + miette diagnostics
14+
- Command-line utilities: `cigen generate`, `cigen hash`, and split-config loader (`.cigen/`)
1915

2016
## Not Yet Implemented / In Progress
2117

22-
- GitHub Actions and other providers
23-
- Persistent job-status cache for skipping jobs across runs
24-
- OR-dependencies and approval-status patching via APIs
25-
- Self-hosted runner-specific optimizations and resource-class mapping
18+
- Reintroducing CircleCI (and additional providers) as standalone plugins
19+
- Detect/plan phases that share facts across plugins (currently stubbed)
20+
- Persistent work-signature storage feeding a real preflight hook
21+
- Registry/lockfile support for third-party plugins
22+
- Turborepo-aware project graph ingestion (replacing the previous workspace-specific focus)
2623

2724
## Why did we build this?
2825

@@ -36,9 +33,9 @@ We had built our own internal CI config generation system in Ruby, but it had st
3633

3734
`cigen` simplifies CI/CD configuration management by:
3835

39-
- Generating CI pipeline configurations from reusable templates
36+
- Generating pipelines from reusable templates and structured config (`.cigen/` split config)
4037
- Validating configuration (schema + data-level) with helpful spans
41-
- Emitting native CircleCI 2.1 YAML, including workflows, jobs, and commands
38+
- Emitting provider-native YAML through pluggable emitters (GitHub Actions today, CircleCI next)
4239

4340
## Philosophy
4441

@@ -50,17 +47,13 @@ We automatically add a highly-optimized git checkout step to the beginning of ea
5047

5148
#### Job skipping
5249

53-
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.
50+
Jobs that declare `source_files` automatically receive a skip cache flow. On GitHub Actions this uses `cigen hash` plus `actions/cache`; jobs exit early when nothing changed and record a marker when they succeed. The preflight hook and remote signature storage are still planned so that other providers can share the same mechanism.
5451

5552
#### Cross-platform CI config
5653

5754
CI providers often solve the same problem in different ways. e.g. to avoid duplication in your config, GitHub actions has "reusable workflows" while CircleCI supports "commands".
5855

59-
`cigen` takes the best ideas from each provider and supports our own set of core features. You write your config once, then we compile it to use your chosen CI provider's native features. This avoids vendor lock-in and makes it easier to migrate to other CI providers.
60-
61-
#### You can still use native CI provider features
62-
63-
You can still use native CircleCI features (e.g., orbs). Other providers will come later; unsupported features are validated with clear errors.
56+
`cigen` takes the best ideas from each provider and supports our own set of core features. You write your config once, then we compile it to use your chosen CI provider's native features. As more providers move onto the plugin system, migrations become a matter of switching emitters instead of rewriting YAML.
6457

6558
---
6659

examples/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Perfect if you have:
4040

4141
Perfect if you have:
4242

43-
- Nx or Turborepo setup
43+
- Turborepo-style or large pnpm workspace
4444
- 10+ apps/libraries
4545
- Need selective job execution
4646
- Want 10x faster CI
@@ -77,7 +77,6 @@ Perfect if you want to:
7777
| Skip logic | ✅ (auto) || ✅ (advanced) ||
7878
| Docker builds |||||
7979
| Deployments |||||
80-
| Nx integration |||||
8180
| Multiple providers |||||
8281

8382
## Feature Showcase

0 commit comments

Comments
 (0)