Skip to content

Commit c31332f

Browse files
committed
fix: validate publishable workspace manifests
1 parent b9cb34f commit c31332f

6 files changed

Lines changed: 42 additions & 18 deletions

File tree

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,10 @@ jobs:
443443
if: inputs.release_tag == ''
444444
uses: dtolnay/rust-toolchain@stable
445445

446+
- name: Preflight crates.io packages
447+
if: inputs.release_tag == '' && needs.check.outputs.recovery-release != 'true'
448+
run: cargo package --workspace --allow-dirty --no-verify
449+
446450
- uses: Extra-Chill/homeboy-action@v2
447451
id: release
448452
if: inputs.release_tag == '' && needs.check.outputs.recovery-release != 'true'

Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
[workspace]
22
# Internal crates split out of the homeboy monolith to gain per-crate
3-
# incremental compilation and lower peak build memory. These are path-only
4-
# members, never published to crates.io; the shipped artifact is still the
5-
# single `homeboy` binary. First extraction (homeboy-redaction) proves the
6-
# pattern ahead of larger extractions (e.g. runner).
3+
# incremental compilation and lower peak build memory. They are published as
4+
# dependencies of the `homeboy` crate; the shipped CLI artifact remains the
5+
# single `homeboy` binary.
76
members = ["crates/*"]
87

98
[package]
@@ -36,16 +35,17 @@ name = "bench-audit-self"
3635
path = "src/bin/bench-audit-self.rs"
3736

3837
[dependencies]
39-
# Internal workspace crates (path-only, not published)
40-
homeboy-cli-contract = { path = "crates/homeboy-cli-contract" }
41-
homeboy-error = { path = "crates/homeboy-error" }
42-
homeboy-finding = { path = "crates/homeboy-finding" }
43-
homeboy-output = { path = "crates/homeboy-output" }
44-
homeboy-paths = { path = "crates/homeboy-paths" }
45-
homeboy-process = { path = "crates/homeboy-process" }
46-
homeboy-product-identity = { path = "crates/homeboy-product-identity" }
47-
homeboy-engine-primitives = { path = "crates/homeboy-engine-primitives" }
48-
homeboy-redaction = { path = "crates/homeboy-redaction" }
38+
# Internal workspace crates. Cargo uses the path locally and the version when
39+
# packaging the publishable homeboy crate for crates.io.
40+
homeboy-cli-contract = { version = "0.1.0", path = "crates/homeboy-cli-contract" }
41+
homeboy-error = { version = "0.1.0", path = "crates/homeboy-error" }
42+
homeboy-finding = { version = "0.1.0", path = "crates/homeboy-finding" }
43+
homeboy-output = { version = "0.1.0", path = "crates/homeboy-output" }
44+
homeboy-paths = { version = "0.1.0", path = "crates/homeboy-paths" }
45+
homeboy-process = { version = "0.1.0", path = "crates/homeboy-process" }
46+
homeboy-product-identity = { version = "0.1.0", path = "crates/homeboy-product-identity" }
47+
homeboy-engine-primitives = { version = "0.1.0", path = "crates/homeboy-engine-primitives" }
48+
homeboy-redaction = { version = "0.1.0", path = "crates/homeboy-redaction" }
4949

5050
# Core library dependencies
5151
base64 = "0.22"

crates/homeboy-engine-primitives/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ name = "homeboy_engine_primitives"
1212
path = "src/lib.rs"
1313

1414
[dependencies]
15-
homeboy-error = { path = "../homeboy-error" }
15+
homeboy-error = { version = "0.1.0", path = "../homeboy-error" }
1616
serde = { version = "1.0", features = ["derive"] }
1717
serde_json = "1.0"
1818
regex = "1.11"

crates/homeboy-paths/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ name = "homeboy_paths"
1212
path = "src/lib.rs"
1313

1414
[dependencies]
15-
homeboy-error = { path = "../homeboy-error" }
16-
homeboy-product-identity = { path = "../homeboy-product-identity" }
15+
homeboy-error = { version = "0.1.0", path = "../homeboy-error" }
16+
homeboy-product-identity = { version = "0.1.0", path = "../homeboy-product-identity" }
1717
shellexpand = "3.1"

crates/homeboy-process/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ name = "homeboy_process"
1212
path = "src/lib.rs"
1313

1414
[dependencies]
15-
homeboy-error = { path = "../homeboy-error" }
15+
homeboy-error = { version = "0.1.0", path = "../homeboy-error" }
1616
libc = "0.2"
1717
ctrlc = "3.4"

tests/release_workflow_test.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,26 @@ fn release_planning_skips_quality_gates_already_owned_by_gate_jobs() {
214214
}
215215
}
216216

217+
#[test]
218+
fn release_prepare_validates_publishable_workspace_before_mutating_release_state() {
219+
let prepare = job_section(release_workflow(), "prepare");
220+
let package_preflight = prepare
221+
.find("name: Preflight crates.io packages")
222+
.expect("prepare must validate crates.io package manifests");
223+
let release_action = prepare
224+
.find("uses: Extra-Chill/homeboy-action@v2")
225+
.expect("prepare must run the release action");
226+
227+
assert!(
228+
prepare.contains("run: cargo package --workspace --allow-dirty --no-verify"),
229+
"publish preflight must package every workspace crate without publishing"
230+
);
231+
assert!(
232+
package_preflight < release_action,
233+
"package preflight must run before release preparation can create a tag"
234+
);
235+
}
236+
217237
#[test]
218238
fn release_prepare_waits_for_command_policy_not_raw_gates() {
219239
let prepare = job_section(release_workflow(), "prepare");

0 commit comments

Comments
 (0)