Skip to content

Commit ca0a5c0

Browse files
authored
Merge pull request #37 from jupyterkat/statcount
count number of icons as stats for idb
2 parents 7a1efd9 + 0b57668 commit ca0a5c0

File tree

15 files changed

+1147
-1160
lines changed

15 files changed

+1147
-1160
lines changed

Cargo.lock

Lines changed: 1001 additions & 1065 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/diffbot_lib/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ edition = "2021"
55
license = "MIT"
66

77
[dependencies]
8-
serde = { version = "1.0.206", features = ["derive"] }
9-
octocrab = "0.39.0"
8+
serde = { version = "1.0.218", features = ["derive"] }
9+
octocrab = "0.43.0"
1010
eyre = "0.6.12"
11-
derive_builder = "0.20.0"
12-
chrono = "0.4.38"
11+
derive_builder = "0.20.2"
12+
chrono = "0.4.39"
1313
sha2 = "0.10.8"
1414
hmac = "0.12.1"
1515
hex = "0.4.3"
1616
tracing = "0.1"
1717
tracing-subscriber = { version = "0.3", features = ["fmt", "time"] }
1818
tracing-panic = "0.1.2"
19-
tracing-loki = "0.2.5"
20-
flume = "0.11.0"
19+
tracing-loki = "0.2.6"
20+
flume = "0.11.1"
2121
async-fs = "2.1.2"
2222

2323
actix-web = "4.9.0"

crates/diffbot_lib/src/github/github_api.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl CheckRun {
7676
) -> Result<Self> {
7777
let inst_id = inst_id.into();
7878
let result: RawCheckRun = octocrab::instance()
79-
.installation(inst_id)
79+
.installation(inst_id)?
8080
.post(
8181
format!("/repos/{full_repo}/check-runs"),
8282
Some(&CreateCheckRun {
@@ -181,7 +181,7 @@ impl CheckRun {
181181
#[derive(Deserialize)]
182182
struct Empty {}
183183
let _: Empty = octocrab::instance()
184-
.installation(self.installation_id)
184+
.installation(self.installation_id)?
185185
.patch(
186186
format!(
187187
"/repos/{repo}/check-runs/{check_run_id}",

crates/diffbot_lib/src/github/graphql.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub async fn get_pull_files<I: Into<InstallationId>>(
107107
installation: I,
108108
pull: &super::github_types::PullRequest,
109109
) -> Result<Vec<FileDiff>> {
110-
let crab = octocrab::instance().installation(installation.into());
110+
let crab = octocrab::instance().installation(installation.into())?;
111111

112112
let mut cursor = "".to_string();
113113

crates/icondiffbot2/Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@ license = "MIT"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
serde = { version = "1.0.206", features = ["derive"] }
10-
serde_json = "1.0.124"
11-
octocrab = "0.39.0"
9+
serde = { version = "1.0.218", features = ["derive"] }
10+
serde_json = "1.0.139"
11+
octocrab = "0.43.0"
1212
dmm-tools = { git = "https://github.com/jupyterkat/SpacemanDMM/" }
13-
jsonwebtoken = "9.3.0"
14-
reqwest = "0.12.5"
13+
jsonwebtoken = "9.3.1"
14+
reqwest = "0.12.12"
1515
diffbot_lib = { path = "../diffbot_lib" }
1616
eyre = "0.6.12"
1717
simple-eyre = "0.3.1"
1818
rayon = "1.10.0"
19-
toml = "0.8.19"
19+
toml = "0.8.20"
2020
ahash = "0.8.11"
21-
hashbrown = { version = "0.14.5", features = ["rayon"] }
22-
tracing-loki = "0.2.5"
23-
flume = "0.11.0"
24-
mysql_async = "0.34.1"
25-
time = "0.3.36"
26-
secrecy = "0.8.0"
21+
hashbrown = { version = "0.15.2", features = ["rayon"] }
22+
tracing-loki = "0.2.6"
23+
flume = "0.11.1"
24+
mysql_async = "0.35.1"
25+
time = "0.3.37"
26+
secrecy = "0.10.3"
2727
percent-encoding = "2.3.1"
2828

2929
actix-web = "4.9.0"
@@ -33,5 +33,5 @@ actix-files = "0.6.6"
3333
tikv-jemallocator = "0.6.0"
3434

3535
[dependencies.tracing]
36-
version = "0.1.40"
36+
version = "0.1.41"
3737
features = ["attributes"]

crates/icondiffbot2/src/downloading.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async fn find_content<S: AsRef<str>>(
2525
) -> Result<Content> {
2626
let (owner, repo) = repo.name_tuple();
2727
let items = octocrab::instance()
28-
.installation(*installation)
28+
.installation(*installation)?
2929
.repos(owner, repo)
3030
.get_content()
3131
.path(

crates/icondiffbot2/src/github_processor.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async fn handle_pull_request(
3737
payload.pull_request.number,
3838
);
3939

40-
handle_pull(payload, job_sender, check_run).await?;
40+
let num_icons = handle_pull(payload, job_sender, check_run).await?;
4141

4242
if let Some(ref pool) = pool {
4343
let mut conn = match pool.get_conn().await {
@@ -54,20 +54,23 @@ async fn handle_pull_request(
5454
check_id,
5555
repo_id,
5656
pr_number,
57-
merge_date
57+
merge_date,
58+
num_icons
5859
)
5960
VALUES(
6061
:check_id,
6162
:repo_id,
6263
:pr_number,
63-
:merge_date
64+
:merge_date,
65+
:num_icons
6466
)
6567
",
6668
params! {
6769
"check_id" => check_id,
6870
"repo_id" => repo_id,
6971
"pr_number" => pr_number,
70-
"merge_date" => None::<time::PrimitiveDateTime>,
72+
"merge_date" => None::<usize>,
73+
"num_icons" => num_icons,
7174
},
7275
)
7376
.await
@@ -88,14 +91,13 @@ async fn handle_pull_request(
8891
};
8992

9093
let now = time::OffsetDateTime::now_utc();
91-
let now = time::PrimitiveDateTime::new(now.date(), now.time());
9294
if let Err(e) = conn
9395
.exec_drop(
9496
r"UPDATE jobs SET merge_date=:date
9597
WHERE repo_id=:rp_id
9698
AND pr_number=:pr_num",
9799
params! {
98-
"date" => now,
100+
"date" => mysql_async::Value::Date(now.year() as u16, now.month() as u8, now.day(), now.hour(), now.minute(), now.second(), now.microsecond()),
99101
"rp_id" => payload.repository.id,
100102
"pr_num" => payload.pull_request.number,
101103
},
@@ -115,7 +117,7 @@ async fn handle_pull(
115117
payload: PullRequestEventPayload,
116118
job_sender: DataJobSender,
117119
check_run: CheckRun,
118-
) -> Result<()> {
120+
) -> Result<usize> {
119121
if payload
120122
.pull_request
121123
.title
@@ -131,7 +133,7 @@ async fn handle_pull(
131133
};
132134

133135
check_run.mark_skipped(output).await?;
134-
return Ok(());
136+
return Ok(0);
135137
}
136138

137139
let conf = &crate::CONFIG.get().unwrap();
@@ -149,7 +151,7 @@ async fn handle_pull(
149151

150152
check_run.mark_skipped(output).await?;
151153

152-
return Ok(());
154+
return Ok(0);
153155
}
154156

155157
let files = get_pull_files(
@@ -170,6 +172,8 @@ async fn handle_pull(
170172
})
171173
.collect();
172174

175+
let num_icons_diffed = changed_dmis.len();
176+
173177
if changed_dmis.is_empty() {
174178
let output = Output {
175179
title: "No icon changes",
@@ -179,7 +183,7 @@ async fn handle_pull(
179183

180184
check_run.mark_skipped(output).await?;
181185

182-
return Ok(());
186+
return Ok(0);
183187
}
184188

185189
check_run.mark_queued().await?;
@@ -199,7 +203,7 @@ async fn handle_pull(
199203

200204
job_sender.send_async(job).await?;
201205

202-
Ok(())
206+
Ok(num_icons_diffed)
203207
}
204208

205209
#[actix_web::post("/payload")]

crates/icondiffbot2/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ async fn main() -> eyre::Result<()> {
181181
`repo_id` BIGINT(20) NOT NULL,
182182
`pr_number` INT(11) NOT NULL,
183183
`merge_date` DATETIME NULL DEFAULT NULL,
184+
`num_icons` BIGINT(20) NOT NULL DEFAULT b'0',
184185
`processed` BIT(1) NOT NULL DEFAULT b'0',
185186
PRIMARY KEY (`check_id`) USING BTREE,
186187
INDEX `merge_date` (`processed`) USING BTREE,

crates/icondiffbot_test_generator/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ license = "MIT"
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10-
octocrab = "0.39.0"
11-
clap = { version = "4.5.15", features = ["derive"] }
12-
tokio = { version = "1.39.2", features = ["full"] }
10+
octocrab = "0.43.0"
11+
clap = { version = "4.5.31", features = ["derive"] }
12+
tokio = { version = "1.43.0", features = ["full"] }

crates/mapdiffbot2/Cargo.toml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@ license = "MIT"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
serde = { version = "1.0.206", features = ["derive"] }
10-
serde_json = { version = "1.0.124" }
11-
toml = "0.8.19"
12-
octocrab = "0.39.0"
9+
serde = { version = "1.0.218", features = ["derive"] }
10+
serde_json = { version = "1.0.139" }
11+
toml = "0.8.20"
12+
octocrab = "0.43.0"
1313
dmm-tools = { git = "https://github.com/jupyterkat/SpacemanDMM/" }
1414
dreammaker = { git = "https://github.com/jupyterkat/SpacemanDMM/" }
1515
ahash = "0.8.11"
1616
path-absolutize = "3.1.1"
17-
jsonwebtoken = "9.3.0"
17+
jsonwebtoken = "9.3.1"
1818
eyre = "0.6.12"
1919
simple-eyre = "0.3.1"
2020
rayon = "1.10.0"
21-
image = "0.25.2"
21+
image = "0.25.5"
2222
diffbot_lib = { path = "../diffbot_lib" }
23-
git2 = "0.19.0"
23+
git2 = "0.20.0"
2424
walkdir = "2.5.0"
2525
delay_timer = "0.11.6"
26-
itertools = "0.13.0"
27-
indexmap = { version = "2.3.0", features = ["rayon"] }
28-
tracing-loki = "0.2.5"
29-
flume = "0.11.0"
30-
object_store = { version = "0.10.2", features = ["azure"] }
31-
mysql_async = "0.34.1"
32-
time = "0.3.36"
33-
secrecy = "0.8.0"
26+
itertools = "0.14.0"
27+
indexmap = { version = "2.7.1", features = ["rayon"] }
28+
tracing-loki = "0.2.6"
29+
flume = "0.11.1"
30+
object_store = { version = "0.11.2", features = ["azure"] }
31+
mysql_async = "0.35.1"
32+
time = "0.3.37"
33+
secrecy = "0.10.3"
3434

3535
actix-web = "4.9.0"
3636
actix-files = "0.6.6"

0 commit comments

Comments
 (0)