Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some more context #23

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/cli/octocrab_utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::Result;
use anyhow::{Context, Result};
use octocrab::models::Installation;
use secrecy::ExposeSecret;

Expand All @@ -17,7 +17,11 @@ where
cli::Auth::AppKey(app_key) => {
let key = jsonwebtoken::EncodingKey::from_rsa_pem(app_key.expose_secret().as_bytes())?;
let base = octocrab::Octocrab::builder().app(APP_ID, key).build()?;
let Installation { id, html_url, .. } = base.apps().get_org_installation(ORG).await?;
let Installation { id, html_url, .. } = base
.apps()
.get_org_installation(ORG)
.await
.context("failed to get org installation")?;
tracing::info!(
"Found installation: {}",
html_url.unwrap_or_else(|| id.to_string())
Expand Down
16 changes: 12 additions & 4 deletions src/server/runner.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::path::Path;
use std::process::Output;

use anyhow::Result;
use futures::{channel::mpsc::Receiver, StreamExt};
Expand Down Expand Up @@ -49,11 +50,18 @@ async fn compare(wd: &Path, cmp: &Compare) -> Result<String> {
let [before, after] = cmp.run_benchmark.run_on.as_slice() else {
panic!("run_on is not a slice of size 2");
};
let output = asv_compare_command(wd, before, after).output().await?;
if output.status.code() != Some(0) {
return Err(anyhow::anyhow!("asv compare exited with {}", output.status));
let Output {
stdout,
stderr,
status,
} = asv_compare_command(wd, before, after).output().await?;
if status.code() != Some(0) {
return Err(anyhow::anyhow!(
"asv compare exited with {status}:\n{}",
String::from_utf8_lossy(&stderr)
));
}
let table_md = String::from_utf8(output.stdout)?;
let table_md = String::from_utf8(stdout)?;
comment::update(cmp, &table_md).await?;
Ok(table_md)
}