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

Function run

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

Source from the content-addressed store, hash-verified

130}
131
132pub async fn run() -> Result<()> {
133 let cli = Cli::parse();
134 let codspeed_config = load_config(&cli)?;
135 let mut api_client = build_api_client(&cli, &codspeed_config);
136
137 // Discover project configuration file
138 let discovered_config = DiscoveredProjectConfig::discover_and_load(
139 cli.config.as_deref(),
140 &std::env::current_dir()?,
141 )?;
142
143 // In the context of the CI, it is likely that a ~ made its way here without being expanded by the shell
144 let setup_cache_dir = cli
145 .setup_cache_dir
146 .as_ref()
147 .map(|d| PathBuf::from(shellexpand::tilde(d).as_ref()));
148 let setup_cache_dir = setup_cache_dir.as_deref();
149
150 match cli.command {
151 Commands::Run(_) | Commands::Exec(_) | Commands::Internal(InternalCommands::Samply(_)) => {} // these are responsible for their own logger initialization
152 _ => {
153 init_local_logger()?;
154 }
155 }
156
157 match cli.command {
158 Commands::Run(args) => {
159 let mut args = *args;
160 args.shared
161 .upload_url
162 .get_or_insert_with(|| codspeed_config.upload_url.clone());
163 args.shared.experimental.warn_if_active();
164 run::run(
165 args,
166 &mut api_client,
167 discovered_config.as_ref(),
168 setup_cache_dir,
169 )
170 .await?
171 }
172 Commands::Exec(args) => {
173 let mut args = *args;
174 args.shared
175 .upload_url
176 .get_or_insert_with(|| codspeed_config.upload_url.clone());
177 args.shared.experimental.warn_if_active();
178 exec::run(
179 args,
180 &mut api_client,
181 discovered_config.as_ref().map(|d| &d.config),
182 setup_cache_dir,
183 )
184 .await?
185 }
186 Commands::Auth(args) => {
187 #[allow(deprecated)]
188 let config_name = cli.config_name.as_deref();
189 auth::run(args, &api_client, config_name, codspeed_config).await?

Callers 1

mainFunction · 0.50

Calls 4

load_configFunction · 0.85
build_api_clientFunction · 0.85
init_local_loggerFunction · 0.85
warn_if_activeMethod · 0.80

Tested by

no test coverage detected