Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cigen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ input_groups:
docs_examples:
- "README.md"
- "docs/src/content/docs/**/*.md"
- "docs/src/content/case-studies/**/*.md"
- "docs/src/content/compare/**/*.md"
- "docs/src/examples/*.yml"

docs:
Expand Down
6 changes: 5 additions & 1 deletion internal_docs/STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ What the code does today, checked against the code in December 2026. Where cigen
- `tests/docs_examples.rs`: every YAML example in the docs (`docs/src/content/docs/`), the case studies
(`docs/src/content/case-studies/`, drafts included), the compare pages (`docs/src/content/compare/`) and the
README, and the homepage's config, is run through
`cigen generate`; examples of errors must fail with the error they show.
`cigen generate`; examples of errors must fail with the error they show. Every file it reads must be an input of
cigen's own `test` job.
- `tests/module_scenarios.rs`: a job using the `rust` module installs nothing when it skips, and reruns in mockci when
a file the module contributes or its parameters change; the generated `--modules-digest` changes the hash; unknown
modules and parameters fail generation with a fix.
Expand Down Expand Up @@ -210,6 +211,9 @@ What the code does today, checked against the code in December 2026. Where cigen
step now passes `toJSON(matrix)` to `cigen hash --matrix`, which mixes the entry into the job's hash. The CircleCI
provider can't express a matrix or job parameters through its passthrough, and cigen's own `matrix:` gives each
combination its own job, so neither has the hole.
24. Resolved (PR #53): `tests/docs_examples.rs` read the case studies (PR #40) and the compare pages (PR #55), but
cigen's own `test` job didn't have them as inputs, so a commit that broke one of their configs alone would have
skipped the test that checks it. The test now checks that every file it reads is an input of that job.

## Next

Expand Down
41 changes: 41 additions & 0 deletions tests/docs_examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,44 @@ fn a_repeated_path_starts_a_new_split_project() {
let found = examples_in("page.md", page);
assert_eq!(found.examples.len(), 2);
}

/// The patterns of a job's inputs, with `@group` references expanded.
fn expanded_inputs(config: &cigen::schema::CigenConfig, entries: &[String], out: &mut Vec<String>) {
for entry in entries {
match entry.strip_prefix('@') {
Some(group) => expanded_inputs(config, &config.input_groups[group], out),
None => out.push(entry.clone()),
}
}
}

#[test]
fn every_file_this_test_reads_is_an_input_of_cigens_test_job() {
// cigen's own CI skips its `test` job when its inputs haven't changed. A page this test
// reads that isn't an input would let a broken example skip: a false skip.
let root = support::repo_root();
let config = cigen::config::load(&root.join(".cigen")).expect("cigen's own config loads");
let mut patterns = Vec::new();
expanded_inputs(&config, &config.jobs["test"].inputs, &mut patterns);
let mut inputs = std::collections::BTreeSet::new();
for pattern in &patterns {
inputs.extend(cigen::pathspec::list_files(&root, pattern).expect("pattern matches"));
}
let read = pages()
.into_iter()
.map(|(name, _)| std::path::PathBuf::from(name))
.chain(site_examples().into_iter().map(|path| {
path.strip_prefix(&root)
.expect("examples are in the repository")
.to_path_buf()
}));
let missing: Vec<String> = read
.filter(|path| !inputs.contains(path))
.map(|path| path.display().to_string())
.collect();
assert!(
missing.is_empty(),
"add these to the test job's inputs in .cigen/config.yml: {}",
missing.join(", ")
);
}
Loading