Skip to content

Commit 6c411c6

Browse files
Fix quality gate variable expansion and binary size test: use debug+strip (fast CI) instead of release build (slow)
1 parent 5a4eef6 commit 6c411c6

2 files changed

Lines changed: 28 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,17 @@ jobs:
103103
steps:
104104
- name: Summary
105105
run: |
106+
LINT="${{ needs.lint.result }}"
107+
TEST="${{ needs.test.result }}"
108+
BUILD="${{ needs.build.result }}"
109+
SECURITY="${{ needs.security.result }}"
106110
echo "Quality Gate Summary"
107111
echo "===================="
108-
FAILED=0
109-
for job in lint test build security; do
110-
result="${{ needs[job].result }}"
111-
echo " $(echo $job | tr '[:lower:]' '[:upper:]' | head -c1)$(echo $job | cut -c2-) : $result"
112-
[ "$result" != "success" ] && FAILED=$((FAILED+1))
113-
done
114-
[ "$FAILED" -eq 0 ] && echo "All checks PASSED" || exit 1
112+
echo " Lint : $LINT"
113+
echo " Test : $TEST"
114+
echo " Build : $BUILD"
115+
echo " Security : $SECURITY"
116+
[ "$LINT" = "success" ] && [ "$TEST" = "success" ] && [ "$BUILD" = "success" ] && [ "$SECURITY" = "success" ] && echo "All checks PASSED" || exit 1
115117
116118
publish:
117119
name: Publish to crates.io

tests/release_gate_integration.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22
/// This ensures our release gates properly catch real issues and block releases
33
use std::process::Command;
44

5+
/// Strip debug info from binary. Returns stripped size, or None if strip unavailable.
6+
fn stripped_binary_size(path: &str) -> Option<u64> {
7+
if Command::new("strip").arg("--version").output().is_ok() {
8+
let _ = Command::new("strip")
9+
.args(["--strip-debug", path])
10+
.output();
11+
std::fs::metadata(path).ok().map(|m| m.len())
12+
} else {
13+
None
14+
}
15+
}
16+
517
#[test]
618
fn test_release_gate_system_exists() {
719
// Validate that release.yml contains the mandatory gates
@@ -124,9 +136,10 @@ fn test_gate_3_template_packaging_protection() {
124136

125137
#[test]
126138
fn test_gate_4_binary_size_constitutional_limit() {
127-
// First ensure we have a binary to test (release build = what users run)
139+
// Build the default feature set (airframe + huggingface = what ships)
140+
// Use dev profile — deps already cached from parent `cargo test`
128141
let build_output = Command::new("cargo")
129-
.args(["build", "--release"])
142+
.args(["build"])
130143
.output()
131144
.expect("Failed to build binary for size test");
132145

@@ -135,15 +148,15 @@ fn test_gate_4_binary_size_constitutional_limit() {
135148
"Failed to build binary for size test"
136149
);
137150

138-
// Test constitutional size limit (release binary = what users run)
139151
let binary_path = if cfg!(windows) {
140-
"target/release/shimmy.exe"
152+
"target/debug/shimmy.exe"
141153
} else {
142-
"target/release/shimmy"
154+
"target/debug/shimmy"
143155
};
144156

145157
if let Ok(metadata) = std::fs::metadata(binary_path) {
146-
let size = metadata.len();
158+
// Strip DWARF debug info to get realistic code size (debug info can be 25MB+ on Linux)
159+
let size = stripped_binary_size(binary_path).unwrap_or_else(|| metadata.len());
147160
let max_size = 15 * 1024 * 1024; // 15MB constitutional limit
148161

149162
assert!(

0 commit comments

Comments
 (0)