10
10
//! but forgot to bump its version.
11
11
//! ```
12
12
13
+ #![ allow( clippy:: print_stdout) ] // Fine for build utilities
14
+
13
15
use std:: collections:: HashMap ;
14
16
use std:: fmt:: Write ;
15
17
use std:: fs;
@@ -56,6 +58,7 @@ pub fn cli() -> clap::Command {
56
58
. arg ( flag ( "locked" , "Require Cargo.lock to be up-to-date" ) . global ( true ) )
57
59
. arg ( flag ( "offline" , "Run without accessing the network" ) . global ( true ) )
58
60
. arg ( multi_opt ( "config" , "KEY=VALUE" , "Override a configuration value" ) . global ( true ) )
61
+ . arg ( flag ( "github" , "Group output using GitHub's syntax" ) )
59
62
. arg (
60
63
Arg :: new ( "unstable-features" )
61
64
. help ( "Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details" )
@@ -114,6 +117,7 @@ fn bump_check(args: &clap::ArgMatches, gctx: &cargo::util::GlobalContext) -> Car
114
117
let base_commit = get_base_commit ( gctx, args, & repo) ?;
115
118
let head_commit = get_head_commit ( args, & repo) ?;
116
119
let referenced_commit = get_referenced_commit ( & repo, & base_commit) ?;
120
+ let github = args. get_flag ( "github" ) ;
117
121
let status = |msg : & str | gctx. shell ( ) . status ( STATUS , msg) ;
118
122
119
123
let crates_not_check_against_channels = [
@@ -134,6 +138,9 @@ fn bump_check(args: &clap::ArgMatches, gctx: &cargo::util::GlobalContext) -> Car
134
138
status ( & format ! ( "head commit `{}`" , head_commit. id( ) ) ) ?;
135
139
136
140
let mut needs_bump = Vec :: new ( ) ;
141
+ if github {
142
+ println ! ( "::group::Checking for bumps of changed packages" ) ;
143
+ }
137
144
let changed_members = changed ( & ws, & repo, & base_commit, & head_commit) ?;
138
145
check_crates_io ( & ws, & changed_members, & mut needs_bump) ?;
139
146
if let Some ( referenced_commit) = referenced_commit. as_ref ( ) {
@@ -166,18 +173,30 @@ fn bump_check(args: &clap::ArgMatches, gctx: &cargo::util::GlobalContext) -> Car
166
173
msg. push_str ( "\n Please bump at least one patch version in each corresponding Cargo.toml." ) ;
167
174
anyhow:: bail!( msg)
168
175
}
176
+ if github {
177
+ println ! ( "::endgroup::" ) ;
178
+ }
169
179
170
180
// Even when we test against baseline-rev, we still need to make sure a
171
181
// change doesn't violate SemVer rules against crates.io releases. The
172
182
// possibility of this happening is nearly zero but no harm to check twice.
183
+ if github {
184
+ println ! ( "::group::SemVer Checks against crates.io" ) ;
185
+ }
173
186
let mut cmd = ProcessBuilder :: new ( "cargo" ) ;
174
187
cmd. arg ( "semver-checks" )
175
188
. arg ( "check-release" )
176
189
. arg ( "--workspace" ) ;
177
190
gctx. shell ( ) . status ( "Running" , & cmd) ?;
178
191
cmd. exec ( ) ?;
192
+ if github {
193
+ println ! ( "::endgroup::" ) ;
194
+ }
179
195
180
196
if let Some ( referenced_commit) = referenced_commit. as_ref ( ) {
197
+ if github {
198
+ println ! ( "::group::SemVer Checks against {}" , referenced_commit. id( ) ) ;
199
+ }
181
200
let mut cmd = ProcessBuilder :: new ( "cargo" ) ;
182
201
cmd. arg ( "semver-checks" )
183
202
. arg ( "--workspace" )
@@ -189,6 +208,9 @@ fn bump_check(args: &clap::ArgMatches, gctx: &cargo::util::GlobalContext) -> Car
189
208
}
190
209
gctx. shell ( ) . status ( "Running" , & cmd) ?;
191
210
cmd. exec ( ) ?;
211
+ if github {
212
+ println ! ( "::endgroup::" ) ;
213
+ }
192
214
}
193
215
194
216
status ( "no version bump needed for member crates." ) ?;
0 commit comments