MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / run

Function run

src/cli/mod.rs:187–269  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

185}
186
187pub async fn run() -> Result<()> {
188 let cli = Cli::parse();
189
190 if let Commands::Internal(command) = cli.command {
191 return run_internal(command);
192 }
193
194 let codspeed_config = load_config(&cli)?;
195 let mut api_client = build_api_client(&cli, &codspeed_config);
196
197 // Discover project configuration file
198 let discovered_config = DiscoveredProjectConfig::discover_and_load(
199 cli.config.as_deref(),
200 &std::env::current_dir()?,
201 )?;
202
203 // In the context of the CI, it is likely that a ~ made its way here without being expanded by the shell
204 let setup_cache_dir = cli
205 .setup_cache_dir
206 .as_ref()
207 .map(|d| PathBuf::from(shellexpand::tilde(d).as_ref()));
208 let setup_cache_dir = setup_cache_dir.as_deref();
209
210 match cli.command {
211 // These initialize their own logging.
212 Commands::Run(_) | Commands::Exec(_) => {}
213 _ => {
214 init_local_logger()?;
215 }
216 }
217
218 match cli.command {
219 Commands::Run(args) => {
220 let mut args = *args;
221 args.shared
222 .upload_url
223 .get_or_insert_with(|| codspeed_config.upload_url.clone());
224 args.shared.experimental.warn_if_active();
225 args.shared.experimental.warn_if_deprecated();
226 run::run(
227 args,
228 &mut api_client,
229 discovered_config.as_ref(),
230 setup_cache_dir,
231 )
232 .await?
233 }
234 Commands::Exec(args) => {
235 let mut args = *args;
236 args.shared
237 .upload_url
238 .get_or_insert_with(|| codspeed_config.upload_url.clone());
239 args.shared.experimental.warn_if_active();
240 args.shared.experimental.warn_if_deprecated();
241 exec::run(
242 args,
243 &mut api_client,
244 discovered_config.as_ref().map(|d| &d.config),

Callers 2

run_internalFunction · 0.70
mainFunction · 0.50

Calls 6

run_internalFunction · 0.85
load_configFunction · 0.85
build_api_clientFunction · 0.85
init_local_loggerFunction · 0.85
warn_if_activeMethod · 0.80
warn_if_deprecatedMethod · 0.80

Tested by

no test coverage detected