diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3631d4226..12cc36da8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -280,6 +280,12 @@ jobs: - name: Run lib tests without default features run: cargo test -p rmcp --lib --no-default-features + - name: Check published crates ship LICENSE + run: | + for crate in rmcp rmcp-macros; do + cargo package --list -p "$crate" | grep -qx LICENSE + done + test-no-local: name: Run Tests (no local feature) runs-on: ubuntu-latest diff --git a/crates/rmcp-macros/LICENSE b/crates/rmcp-macros/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/rmcp-macros/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/rmcp/Cargo.toml b/crates/rmcp/Cargo.toml index 772844d86..064a64fcd 100644 --- a/crates/rmcp/Cargo.toml +++ b/crates/rmcp/Cargo.toml @@ -1,5 +1,6 @@ [package] name = "rmcp" +exclude = ["tests/test_package_license.rs"] license = { workspace = true } version = { workspace = true } edition = { workspace = true } diff --git a/crates/rmcp/LICENSE b/crates/rmcp/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/crates/rmcp/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/crates/rmcp/tests/test_package_license.rs b/crates/rmcp/tests/test_package_license.rs new file mode 100644 index 000000000..cbb6b8459 --- /dev/null +++ b/crates/rmcp/tests/test_package_license.rs @@ -0,0 +1,28 @@ +//! The published crates must ship the repository LICENSE (see #1335). +//! `cargo package` only picks up files inside the crate directory, so each +//! crate keeps a LICENSE symlink to the workspace root file. + +use std::path::Path; + +fn assert_crate_license(crate_dir: &Path) { + let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); + let expected = std::fs::read_to_string(root.join("LICENSE")).expect("root LICENSE"); + let actual = std::fs::read_to_string(crate_dir.join("LICENSE")) + .unwrap_or_else(|e| panic!("{} has no LICENSE: {e}", crate_dir.display())); + assert_eq!( + actual, + expected, + "{}/LICENSE differs from root", + crate_dir.display() + ); +} + +#[test] +fn rmcp_crate_ships_license() { + assert_crate_license(Path::new(env!("CARGO_MANIFEST_DIR"))); +} + +#[test] +fn rmcp_macros_crate_ships_license() { + assert_crate_license(&Path::new(env!("CARGO_MANIFEST_DIR")).join("../rmcp-macros")); +}