Skip to content

Commit 2670070

Browse files
authored
Add readme existence check to package validation (#3787)
1 parent d468916 commit 2670070

File tree

7 files changed

+42
-4
lines changed

7 files changed

+42
-4
lines changed

.github/workflows/publish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: publish
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- '.github/ISSUE_TEMPLATE/**'
7+
- '.github/workflows/web.yml'
8+
- 'web/**'
9+
push:
10+
paths-ignore:
11+
- '.github/ISSUE_TEMPLATE/**'
12+
- '.github/workflows/web.yml'
13+
- 'web/**'
14+
branches:
15+
- master
16+
17+
jobs:
18+
publish:
19+
runs-on: windows-2025
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v5
23+
- name: Update toolchain
24+
run: rustup update --no-self-update stable && rustup default stable
25+
- name: Check
26+
run: cargo publish --workspace --dry-run

crates/libs/implement/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.60.2"
44
edition = "2021"
55
rust-version = "1.74"
66
license = "MIT OR Apache-2.0"
7-
description = "The implement macro for the windows crate"
7+
description = "The implement macro for the Windows crates"
88
repository = "https://github.com/microsoft/windows-rs"
99
categories = ["os::windows-apis"]
1010
readme = "readme.md"

crates/libs/implement/readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## The implement macro for the Windows crates
2+
3+
See [windows-core](https://crates.io/crates/windows-core) for more information.

crates/libs/interface/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.59.3"
44
edition = "2021"
55
rust-version = "1.74"
66
license = "MIT OR Apache-2.0"
7-
description = "The interface macro for the windows crate"
7+
description = "The interface macro for the Windows crates"
88
repository = "https://github.com/microsoft/windows-rs"
99
categories = ["os::windows-apis"]
1010
readme = "readme.md"

crates/libs/interface/readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## The interface macro for the Windows crates
2+
3+
See [windows-core](https://crates.io/crates/windows-core) for more information.

crates/tests/misc/package/tests/test.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ fn test() {
3434
assert!(package.description.is_some());
3535
assert!(!package.description.as_ref().unwrap().is_empty());
3636
assert_eq!(package.readme, Some("readme.md".to_string()));
37+
38+
let mut path = toml.path.expect("path");
39+
path.set_file_name("readme.md");
40+
assert!(path.exists(), "missing readme for crate: {}", package.name);
3741
}
3842
}
3943
}

crates/tools/helpers/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::path::Path;
66
pub struct Crate {
77
pub package: Package,
88
pub lints: Option<Lints>,
9+
pub path: Option<std::path::PathBuf>,
910
}
1011

1112
impl PartialEq for Crate {
@@ -65,8 +66,9 @@ fn find<P: AsRef<Path>>(path: P) -> Vec<Crate> {
6566
crates.append(&mut find(file.path()));
6667
} else if file.file_name() == "Cargo.toml" {
6768
let text = std::fs::read_to_string(file.path()).expect("Cargo.toml");
68-
let toml: Crate = toml::from_str(&text).expect("toml");
69-
crates.push(toml);
69+
let mut entry: Crate = toml::from_str(&text).expect("toml");
70+
entry.path = Some(file.path());
71+
crates.push(entry);
7072
}
7173
}
7274
}

0 commit comments

Comments
 (0)