Skip to content
Merged
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
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# ArchUnitRust

[![Crates.io](https://img.shields.io/crates/v/archunit.svg)](https://crates.io/crates/archunit)
[![CI](https://github.com/LukasNiessen/ArchUnitRust/actions/workflows/ci.yml/badge.svg)](https://github.com/LukasNiessen/ArchUnitRust/actions/workflows/ci.yml)
[![Documentation](https://github.com/LukasNiessen/ArchUnitRust/actions/workflows/pages.yml/badge.svg)](https://github.com/LukasNiessen/ArchUnitRust/actions/workflows/pages.yml)

Architecture tests for Cargo projects, expressed as ordinary Rust tests. ArchUnitRust is part of
**ArchUnitEverything** — one architecture-testing library per language.

> **Status:** usable from Git and under active development. The crate is not published on
> crates.io yet; the current package version is `0.0.1` and requires Rust 1.85 or newer.
> **Status:** `archunit` 0.0.1 is published on crates.io, requires Rust 1.85 or newer, and remains
> under active development.

[User guide](https://lukasniessen.github.io/ArchUnitRust/) ·
[API reference](https://lukasniessen.github.io/ArchUnitRust/api/archunit/)
Expand All @@ -17,19 +18,18 @@ Architecture tests for Cargo projects, expressed as ordinary Rust tests. ArchUni
ArchUnit rules belong in the project that they check, so add the crate as a development dependency:

```console
cargo add --dev --git https://github.com/LukasNiessen/ArchUnitRust archunit
cargo add --dev archunit@0.0.1
```

The equivalent `Cargo.toml` entry is:

```toml
[dev-dependencies]
archunit = { git = "https://github.com/LukasNiessen/ArchUnitRust" }
archunit = "0.0.1"
```

Cargo records the resolved Git commit in `Cargo.lock`. Commit that lockfile when the consuming
project normally tracks it. After the first crates.io release, the Git dependency can be replaced
by a versioned registry dependency.
Cargo resolves the registry version into `Cargo.lock`. Commit that lockfile when the consuming
project normally tracks it.

## File rules

Expand Down Expand Up @@ -140,10 +140,8 @@ have a source-checked example below:
All Rust snippets in this README are included in the crate documentation and compiled as doctests.
The sections after this guide are the detailed reference for the implemented surface.

## What is not implemented yet
## Known limitations

- crates.io publication is tracked by [#44](https://github.com/LukasNiessen/ArchUnitRust/issues/44),
so installation currently uses the Git repository;
- extraction is syntax-based: it does not expand macros or inspect build-script-generated source,
evaluates `cfg` branches as a conservative union, and exposes files rather than Rust items as
dependency nodes.
Expand Down
2 changes: 1 addition & 1 deletion docs/PORTING_PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ preserve the small conventional commits made on the branch.
| Cross-cutting | #39 | Opt-in deterministic logging is covered |
| Self-hosting | #40 | ArchUnitRust enforces its own module rules |
| Adoption | #41-#43 | README, source-checked rustdoc/GitHub Pages, and the full CI matrix are live |
| Release | #44 | A verified package is published and install instructions are tested |
| Release | #44 | `archunit` 0.0.1 is published and its exact registry install is tested |

Issue #38 stays open until every selector family has exclusion coverage, even though the matching
model is designed for exclusions in the kernel. Release notes state exactly which selectors have it.
Expand Down
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ graph, and evaluates the rule.

## Install

ArchUnitRust currently installs from Git as a development dependency and requires Rust 1.85 or
ArchUnitRust 0.0.1 installs from crates.io as a development dependency and requires Rust 1.85 or
newer:

```console
cargo add --dev --git https://github.com/LukasNiessen/ArchUnitRust archunit
cargo add --dev archunit@0.0.1
```

Cargo records the resolved commit in `Cargo.lock`. The package is not on crates.io yet, so a
versioned registry dependency is not currently an honest installation instruction.
The equivalent manifest entry is `archunit = "0.0.1"` under `[dev-dependencies]`. Cargo records the
resolved registry version in `Cargo.lock`.

## Your first rule

Expand Down
19 changes: 19 additions & 0 deletions tests/release_workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,25 @@ fn standalone_fixture_pins_and_exercises_the_exact_registry_version() {
assert!(architecture.contains("assert_passes!(rule);"));
}

#[test]
fn public_installation_docs_name_the_verified_registry_version() {
let readme = read("README.md");
let guide = read("docs/index.md");
let plan = read("docs/PORTING_PLAN.md");

for public_entry_point in [&readme, &guide] {
assert!(public_entry_point.contains("cargo add --dev archunit@0.0.1"));
assert!(public_entry_point.contains("archunit = \"0.0.1\""));
assert!(!public_entry_point.contains("cargo add --dev --git"));
assert!(!public_entry_point.contains("not on crates.io"));
assert!(!public_entry_point.contains("not published on"));
}
assert!(readme.contains("https://crates.io/crates/archunit"));
assert!(
plan.contains("`archunit` 0.0.1 is published and its exact registry install is tested")
);
}

fn read(path: &str) -> String {
fs::read_to_string(path)
.unwrap_or_else(|error| panic!("failed to read {path}: {error}"))
Expand Down