Skip to content

Commit 1b7fbad

Browse files
committed
Build & upload rustdoc json output next to other docs
1 parent b3b4388 commit 1b7fbad

File tree

4 files changed

+278
-12
lines changed

4 files changed

+278
-12
lines changed

src/db/delete.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use super::{CrateId, update_latest_version_id};
1111

1212
/// List of directories in docs.rs's underlying storage (either the database or S3) containing a
1313
/// subdirectory named after the crate. Those subdirectories will be deleted.
14-
static LIBRARY_STORAGE_PATHS_TO_DELETE: &[&str] = &["rustdoc", "sources"];
14+
static LIBRARY_STORAGE_PATHS_TO_DELETE: &[&str] = &["rustdoc", "rustdoc-json", "sources"];
1515
static OTHER_STORAGE_PATHS_TO_DELETE: &[&str] = &["sources"];
1616

1717
#[derive(Debug, thiserror::Error)]
@@ -222,6 +222,7 @@ mod tests {
222222
use super::*;
223223
use crate::db::ReleaseId;
224224
use crate::registry_api::{CrateOwner, OwnerKind};
225+
use crate::storage::rustdoc_json_path;
225226
use crate::test::{async_wrapper, fake_release_that_failed_before_build};
226227
use test_case::test_case;
227228

@@ -405,6 +406,17 @@ mod tests {
405406
.collect())
406407
}
407408

409+
async fn json_exists(storage: &AsyncStorage, version: &str) -> Result<bool> {
410+
storage
411+
.exists(&rustdoc_json_path(
412+
"a",
413+
version,
414+
"x86_64-unknown-linux-gnu",
415+
crate::storage::RustdocJsonFormatVersion::Latest,
416+
))
417+
.await
418+
}
419+
408420
let mut conn = env.async_db().await.async_conn().await;
409421
let v1 = env
410422
.fake_release()
@@ -426,6 +438,7 @@ mod tests {
426438
.rustdoc_file_exists("a", "1.0.0", None, "a/index.html", archive_storage)
427439
.await?
428440
);
441+
assert!(json_exists(&*env.async_storage().await, "1.0.0").await?);
429442
let crate_id = sqlx::query_scalar!(
430443
r#"SELECT crate_id as "crate_id: CrateId" FROM releases WHERE id = $1"#,
431444
v1.0
@@ -457,6 +470,7 @@ mod tests {
457470
.rustdoc_file_exists("a", "2.0.0", None, "a/index.html", archive_storage)
458471
.await?
459472
);
473+
assert!(json_exists(&*env.async_storage().await, "2.0.0").await?);
460474
assert_eq!(
461475
owners(&mut conn, crate_id).await?,
462476
vec!["Peter Rabbit".to_string()]
@@ -494,13 +508,16 @@ mod tests {
494508
.await?
495509
);
496510
}
511+
assert!(!json_exists(&*env.async_storage().await, "1.0.0").await?);
512+
497513
assert!(release_exists(&mut conn, v2).await?);
498514
assert!(
499515
env.async_storage()
500516
.await
501517
.rustdoc_file_exists("a", "2.0.0", None, "a/index.html", archive_storage)
502518
.await?
503519
);
520+
assert!(json_exists(&*env.async_storage().await, "2.0.0").await?);
504521
assert_eq!(
505522
owners(&mut conn, crate_id).await?,
506523
vec!["Peter Rabbit".to_string()]

0 commit comments

Comments
 (0)