Skip to content

Commit f1a3c13

Browse files
Run the adapter's feature-gated configuration in CI
The `memory-git` feature added alongside the lifted diff family gates that family, and the test asserting it is *withheld* without the feature is `#[cfg(not(feature = "memory-git"))]`. Both existing jobs — `--all-features` and default — compile that test out, so it was checked by nothing: a feature-gated test whose default fate is to be built by one job and executed by none. Adds the configuration as its own step, and asserts the property the feature exists for: `cargo tree --no-default-features` must link no `git2` or `libgit2-sys`. A guard rather than a comment, because "this feature keeps the native build out of the graph" is a claim that silently stops being true the first time a dependency picks it up transitively. Verified: `diff_is_withheld_when_the_snapshot_store_is_compiled_out` appears in `--no-default-features -- --list` and is absent from the `--all-features` listing, which is what "running nowhere" looked like. Refs #18 (§C3, §E2)
1 parent 4ab4d55 commit f1a3c13

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,30 @@ jobs:
4949
- name: Test default features
5050
run: cargo test
5151

52+
# The adapter's `memory-git` feature gates the diff family, and the test
53+
# that the family is *withheld* without it is `#[cfg(not(feature =
54+
# "memory-git"))]`. Both the `--all-features` and default runs above
55+
# compile that test out, so without this step it would be checked by
56+
# nothing — a feature-gated test whose default fate is to be built by one
57+
# job and executed by none.
58+
#
59+
# This is also the configuration that keeps the promise the feature
60+
# exists for: no `git2` / `libgit2-sys` in the graph.
61+
- name: Lint and test the adapter without its optional engine features
62+
run: |
63+
cargo clippy -p tinymemory-tinycortex --all-targets --no-default-features -- -D warnings
64+
cargo test -p tinymemory-tinycortex --no-default-features
65+
66+
- name: Assert the default adapter build links no native git
67+
run: |
68+
linked="$(cargo tree -p tinymemory-tinycortex --no-default-features \
69+
-e normal --prefix none | grep -cE '^(git2|libgit2-sys)' || true)"
70+
if [ "$linked" -ne 0 ]; then
71+
echo "the default adapter build linked $linked native-git crate(s);" >&2
72+
echo "the memory-git feature exists to keep them out" >&2
73+
exit 1
74+
fi
75+
5276
# The module crate is its own workspace root (see the `exclude` note in the
5377
# root Cargo.toml), so NONE of the steps above touch it: `--all-targets`,
5478
# `--all-features` and `--workspace` all stop at the workspace boundary and

0 commit comments

Comments
 (0)