@@ -23,26 +23,13 @@ fn validate_base_url(url: &str) -> bool {
2323 || url. starts_with ( "http://127.0.0.1" )
2424}
2525
26- /// Verify the version-bump logic lives in bump-version.sh and is referenced
27- /// from release.sh. release.sh delegates — bump-version.sh is the single
28- /// source of truth so CI-visible drift is impossible.
29- fn bump_version_script ( ) -> & ' static str {
30- include_str ! ( "../../scripts/bump-version.sh" )
31- }
32-
33- fn release_sh_delegates_to_bump_version ( ) -> bool {
34- let release_sh = include_str ! ( "../../scripts/release.sh" ) ;
35- release_sh. contains ( "bump-version.sh" )
36- }
37-
38- /// Extract binary names from release.sh build section.
39- fn extract_binary_names_from_release_sh ( ) -> Vec < String > {
40- let release_sh = include_str ! ( "../../scripts/release.sh" ) ;
26+ /// Extract binary names from the release workflow file.
27+ fn extract_binary_names_from_workflow ( ) -> Vec < String > {
28+ let workflow = include_str ! ( "../../.github/workflows/release.yml" ) ;
4129 let mut binaries = Vec :: new ( ) ;
42-
43- for line in release_sh. lines ( ) {
44- if line. contains ( "cp target" ) && line. contains ( "dist/8v-" ) {
45- if let Some ( start) = line. find ( "dist/" ) {
30+ for line in workflow. lines ( ) {
31+ if line. trim_start ( ) . starts_with ( "cp " ) && line. contains ( "dist/8v-" ) {
32+ if let Some ( start) = line. find ( "dist/8v-" ) {
4633 let rest = & line[ start + 5 ..] ;
4734 let binary = rest. split_whitespace ( ) . next ( ) . unwrap_or ( "" ) ;
4835 if !binary. is_empty ( ) {
@@ -69,24 +56,31 @@ fn workspace_cargo_toml_has_version_field() {
6956 ) ;
7057 assert ! (
7158 content. contains( "version = \" " ) ,
72- "Workspace Cargo.toml missing version field — release.sh sed would silently skip it "
59+ "Workspace Cargo.toml missing version field — bump the version in [workspace.package] "
7360 ) ;
7461}
7562
7663#[ test]
77- fn release_sh_version_bump_targets_workspace_root ( ) {
78- assert ! (
79- release_sh_delegates_to_bump_version( ) ,
80- "release.sh must delegate to scripts/bump-version.sh for version bumping"
81- ) ;
82- let bump = bump_version_script ( ) ;
64+ fn workflow_targets_workspace_package_version ( ) {
65+ let root = workspace_root ( ) ;
66+ let cargo_toml = root. join ( "Cargo.toml" ) ;
67+ let content = fs:: read_to_string ( & cargo_toml) . expect ( "read workspace Cargo.toml" ) ;
68+ // The workflow releases whatever version is in [workspace.package].
69+ // Verify the section and version key are present so a tag push reflects
70+ // the correct version.
8371 assert ! (
84- bump . contains( "[workspace.package]" ) ,
85- "bump-version.sh does not target the [workspace.package] section"
72+ content . contains( "[workspace.package]" ) ,
73+ "[workspace.package] section missing — workflow release would use wrong version "
8674 ) ;
75+ let in_section = content
76+ . lines ( )
77+ . skip_while ( |l| !l. trim ( ) . starts_with ( "[workspace.package]" ) )
78+ . skip ( 1 )
79+ . take_while ( |l| !l. trim_start ( ) . starts_with ( '[' ) )
80+ . any ( |l| l. trim_start ( ) . starts_with ( "version = \" " ) ) ;
8781 assert ! (
88- bump . contains ( "^version = " ) ,
89- "bump- version.sh does not anchor on ^version = (may match dependency versions) "
82+ in_section ,
83+ "version field not found under [workspace.package] — CI release would be unversioned "
9084 ) ;
9185}
9286
@@ -187,14 +181,17 @@ fn checksum_format_parseable() {
187181
188182#[ test]
189183fn binary_names_match_install_platforms ( ) {
190- let binaries = extract_binary_names_from_release_sh ( ) ;
191- assert ! ( !binaries. is_empty( ) , "Failed to extract binary names" ) ;
184+ let binaries = extract_binary_names_from_workflow ( ) ;
185+ assert ! (
186+ !binaries. is_empty( ) ,
187+ "Failed to extract binary names from workflow"
188+ ) ;
192189
193190 let expected = [ "darwin-arm64" , "darwin-x64" , "linux-x64" , "linux-arm64" ] ;
194191 for expected_name in expected {
195192 assert ! (
196193 binaries. iter( ) . any( |b| b. contains( expected_name) ) ,
197- "Binary name {} not found in release.sh " ,
194+ "Binary name {} not found in release workflow " ,
198195 expected_name
199196 ) ;
200197 }
@@ -226,42 +223,6 @@ fn version_txt_has_no_whitespace() {
226223 ) ;
227224}
228225
229- #[ test]
230- fn changelog_sed_preserves_unreleased_and_adds_version ( ) {
231- let project = TempProject :: empty ( ) ;
232- let changelog_path = project. path ( ) . join ( "CHANGELOG.md" ) ;
233-
234- let original = r#"# Changelog
235-
236- ## [Unreleased]
237-
238- ## [1.0.0] - 2026-01-01
239-
240- ### Added
241-
242- - Some feature
243- "# ;
244- project
245- . write_file ( "CHANGELOG.md" , original. as_bytes ( ) )
246- . expect ( "write CHANGELOG" ) ;
247-
248- let content = fs:: read_to_string ( & changelog_path) . expect ( "read CHANGELOG" ) ;
249-
250- // Simulate sed: insert new version after [Unreleased]
251- let updated = content. replace (
252- "## [Unreleased]" ,
253- "## [Unreleased]\n \n ## [2.0.0] - 2026-04-07" ,
254- ) ;
255- project
256- . write_file ( "CHANGELOG.md" , updated. as_bytes ( ) )
257- . expect ( "write updated CHANGELOG" ) ;
258-
259- let result = fs:: read_to_string ( & changelog_path) . expect ( "read updated" ) ;
260- assert ! ( result. contains( "## [Unreleased]" ) ) ;
261- assert ! ( result. contains( "## [2.0.0] - 2026-04-07" ) ) ;
262- assert ! ( result. contains( "## [1.0.0] - 2026-01-01" ) ) ;
263- }
264-
265226#[ test]
266227fn semver_regex_accepts_valid_versions ( ) {
267228 let valid = [ "0.1.0" , "1.0.0" , "10.20.30" , "1.2.3" ] ;
0 commit comments