From 705e86eb4c0079d0775f0c1490968f1183095fcc Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 4 Apr 2024 10:14:59 -0400 Subject: [PATCH] Fixing docker release (#4592) * Re-add notif on tag failure. * Upping rust version. * Version 0.19.4-beta.1a * Try again. * Version 0.19.4-beta.1b * Removing unstable inspect. * Version 0.19.4-beta.1c * Remove use release cache. * Trying to fix cargo publish 1. * Version 0.19.4-beta.1d * Re-adding publish release * Version 0.19.4-beta.2 * Fixing workspace for lemmy_federate --- .woodpecker.yml | 5 ++--- Cargo.lock | 26 +++++++++++++------------- Cargo.toml | 25 +++++++++++++------------ docker/Dockerfile | 6 +++--- docker/docker-compose.yml | 2 -- src/scheduled_tasks.rs | 32 ++++++++++++++++---------------- 6 files changed, 47 insertions(+), 49 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 28c526a0c..4c9af5441 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,7 +2,7 @@ # See https://github.com/woodpecker-ci/woodpecker/issues/1677 variables: - - &rust_image "rust:1.76" + - &rust_image "rust:1.77" - &install_pnpm "corepack enable pnpm" - &slow_check_paths - event: pull_request @@ -42,7 +42,7 @@ steps: - git submodule init - git submodule update when: - - event: pull_request + - event: [pull_request, tag] prettier_check: image: tmknom/prettier:3.0.0 @@ -248,7 +248,6 @@ steps: publish_to_crates_io: image: *rust_image commands: - - 'echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"' - cargo install cargo-workspaces - cp -r migrations crates/db_schema/ - cargo login "$CARGO_API_TOKEN" diff --git a/Cargo.lock b/Cargo.lock index a446fe418..c0edf2dcf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2612,7 +2612,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lemmy_api" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "activitypub_federation", "actix-web", @@ -2641,7 +2641,7 @@ dependencies = [ [[package]] name = "lemmy_api_common" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "activitypub_federation", "actix-web", @@ -2679,7 +2679,7 @@ dependencies = [ [[package]] name = "lemmy_api_crud" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "accept-language", "activitypub_federation", @@ -2702,7 +2702,7 @@ dependencies = [ [[package]] name = "lemmy_apub" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "activitypub_federation", "actix-web", @@ -2740,7 +2740,7 @@ dependencies = [ [[package]] name = "lemmy_db_perf" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "anyhow", "clap", @@ -2755,7 +2755,7 @@ dependencies = [ [[package]] name = "lemmy_db_schema" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "activitypub_federation", "anyhow", @@ -2795,7 +2795,7 @@ dependencies = [ [[package]] name = "lemmy_db_views" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "actix-web", "chrono", @@ -2817,7 +2817,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_actor" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "chrono", "diesel", @@ -2837,7 +2837,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_moderator" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "diesel", "diesel-async", @@ -2849,7 +2849,7 @@ dependencies = [ [[package]] name = "lemmy_federate" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "activitypub_federation", "anyhow", @@ -2872,7 +2872,7 @@ dependencies = [ [[package]] name = "lemmy_routes" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "activitypub_federation", "actix-web", @@ -2897,7 +2897,7 @@ dependencies = [ [[package]] name = "lemmy_server" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "activitypub_federation", "actix-cors", @@ -2940,7 +2940,7 @@ dependencies = [ [[package]] name = "lemmy_utils" -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" dependencies = [ "actix-web", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index a7ca399a9..554448d02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.19.4-beta.1" +version = "0.19.4-beta.2" edition = "2021" description = "A link aggregator for the fediverse" license = "AGPL-3.0" @@ -88,16 +88,17 @@ unused_self = "deny" unwrap_used = "deny" [workspace.dependencies] -lemmy_api = { version = "=0.19.4-beta.1", path = "./crates/api" } -lemmy_api_crud = { version = "=0.19.4-beta.1", path = "./crates/api_crud" } -lemmy_apub = { version = "=0.19.4-beta.1", path = "./crates/apub" } -lemmy_utils = { version = "=0.19.4-beta.1", path = "./crates/utils", default-features = false } -lemmy_db_schema = { version = "=0.19.4-beta.1", path = "./crates/db_schema" } -lemmy_api_common = { version = "=0.19.4-beta.1", path = "./crates/api_common" } -lemmy_routes = { version = "=0.19.4-beta.1", path = "./crates/routes" } -lemmy_db_views = { version = "=0.19.4-beta.1", path = "./crates/db_views" } -lemmy_db_views_actor = { version = "=0.19.4-beta.1", path = "./crates/db_views_actor" } -lemmy_db_views_moderator = { version = "=0.19.4-beta.1", path = "./crates/db_views_moderator" } +lemmy_api = { version = "=0.19.4-beta.2", path = "./crates/api" } +lemmy_api_crud = { version = "=0.19.4-beta.2", path = "./crates/api_crud" } +lemmy_apub = { version = "=0.19.4-beta.2", path = "./crates/apub" } +lemmy_utils = { version = "=0.19.4-beta.2", path = "./crates/utils", default-features = false } +lemmy_db_schema = { version = "=0.19.4-beta.2", path = "./crates/db_schema" } +lemmy_api_common = { version = "=0.19.4-beta.2", path = "./crates/api_common" } +lemmy_routes = { version = "=0.19.4-beta.2", path = "./crates/routes" } +lemmy_db_views = { version = "=0.19.4-beta.2", path = "./crates/db_views" } +lemmy_db_views_actor = { version = "=0.19.4-beta.2", path = "./crates/db_views_actor" } +lemmy_db_views_moderator = { version = "=0.19.4-beta.2", path = "./crates/db_views_moderator" } +lemmy_federate = { version = "=0.19.4-beta.2", path = "./crates/federate" } activitypub_federation = { version = "0.5.2", default-features = false, features = [ "actix-web", ] } @@ -175,7 +176,7 @@ lemmy_utils = { workspace = true } lemmy_db_schema = { workspace = true } lemmy_api_common = { workspace = true } lemmy_routes = { workspace = true } -lemmy_federate = { version = "0.19.4-beta.1", path = "crates/federate" } +lemmy_federate = { workspace = true } activitypub_federation = { workspace = true } diesel = { workspace = true } diesel-async = { workspace = true } diff --git a/docker/Dockerfile b/docker/Dockerfile index 9539402df..ff3dfc7ff 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1.6 -ARG RUST_VERSION=1.76 +ARG RUST_VERSION=1.77 ARG CARGO_BUILD_FEATURES=default ARG RUST_RELEASE_MODE=debug @@ -35,7 +35,7 @@ RUN --mount=type=cache,target=/lemmy/target set -ex; \ # Release build RUN --mount=type=cache,target=/lemmy/target set -ex; \ if [ "${RUST_RELEASE_MODE}" = "release" ]; then \ - [ -z "$USE_RELEASE_CACHE" ] && cargo clean --release; \ + cargo clean --release; \ cargo build --features "${CARGO_BUILD_FEATURES}" --release; \ mv target/"${RUST_RELEASE_MODE}"/lemmy_server ./lemmy_server; \ fi @@ -68,7 +68,7 @@ RUN --mount=type=cache,target=./target,uid=10001,gid=10001 set -ex; \ # Release build RUN --mount=type=cache,target=./target,uid=10001,gid=10001 set -ex; \ if [ "${RUST_RELEASE_MODE}" = "release" ]; then \ - [ -z "$USE_RELEASE_CACHE" ] && cargo clean --release; \ + cargo clean --release; \ cargo build --features "${CARGO_BUILD_FEATURES}" --release; \ mv "./target/$CARGO_BUILD_TARGET/$RUST_RELEASE_MODE/lemmy_server" /home/lemmy/lemmy_server; \ fi diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 30b38ad85..1bf38863f 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3.7" - x-logging: &default-logging driver: "json-file" options: diff --git a/src/scheduled_tasks.rs b/src/scheduled_tasks.rs index 491902fb3..e225b96ff 100644 --- a/src/scheduled_tasks.rs +++ b/src/scheduled_tasks.rs @@ -94,7 +94,7 @@ pub async fn setup(context: LemmyContext) -> Result<(), LemmyError> { delete_old_denied_users(&mut context.pool()).await; update_instance_software(&mut context.pool(), context.client()) .await - .inspect_err(|e| warn!("Failed to update instance software: {e}")) + .map_err(|e| warn!("Failed to update instance software: {e}")) .ok(); } }); @@ -276,10 +276,10 @@ async fn delete_expired_captcha_answers(pool: &mut DbPool<'_>) { ) .execute(&mut conn) .await - .inspect(|_| { + .map(|_| { info!("Done."); }) - .inspect_err(|e| error!("Failed to clear old captcha answers: {e}")) + .map_err(|e| error!("Failed to clear old captcha answers: {e}")) .ok(); } Err(e) => { @@ -300,7 +300,7 @@ async fn clear_old_activities(pool: &mut DbPool<'_>) { ) .execute(&mut conn) .await - .inspect_err(|e| error!("Failed to clear old sent activities: {e}")) + .map_err(|e| error!("Failed to clear old sent activities: {e}")) .ok(); diesel::delete( @@ -309,8 +309,8 @@ async fn clear_old_activities(pool: &mut DbPool<'_>) { ) .execute(&mut conn) .await - .inspect(|_| info!("Done.")) - .inspect_err(|e| error!("Failed to clear old received activities: {e}")) + .map(|_| info!("Done.")) + .map_err(|e| error!("Failed to clear old received activities: {e}")) .ok(); } Err(e) => { @@ -322,10 +322,10 @@ async fn clear_old_activities(pool: &mut DbPool<'_>) { async fn delete_old_denied_users(pool: &mut DbPool<'_>) { LocalUser::delete_old_denied_local_users(pool) .await - .inspect(|_| { + .map(|_| { info!("Done."); }) - .inspect(|e| error!("Failed to deleted old denied users: {e}")) + .map_err(|e| error!("Failed to deleted old denied users: {e}")) .ok(); } @@ -348,10 +348,10 @@ async fn overwrite_deleted_posts_and_comments(pool: &mut DbPool<'_>) { )) .execute(&mut conn) .await - .inspect(|_| { + .map(|_| { info!("Done."); }) - .inspect_err(|e| error!("Failed to overwrite deleted posts: {e}")) + .map_err(|e| error!("Failed to overwrite deleted posts: {e}")) .ok(); info!("Overwriting deleted comments..."); @@ -364,10 +364,10 @@ async fn overwrite_deleted_posts_and_comments(pool: &mut DbPool<'_>) { .set(comment::content.eq(DELETED_REPLACEMENT_TEXT)) .execute(&mut conn) .await - .inspect(|_| { + .map(|_| { info!("Done."); }) - .inspect_err(|e| error!("Failed to overwrite deleted comments: {e}")) + .map_err(|e| error!("Failed to overwrite deleted comments: {e}")) .ok(); } Err(e) => { @@ -399,14 +399,14 @@ async fn active_counts(pool: &mut DbPool<'_>) { sql_query(update_site_stmt) .execute(&mut conn) .await - .inspect_err(|e| error!("Failed to update site stats: {e}")) + .map_err(|e| error!("Failed to update site stats: {e}")) .ok(); let update_community_stmt = format!("update community_aggregates ca set users_active_{} = mv.count_ from community_aggregates_activity('{}') mv where ca.community_id = mv.community_id_", i.1, i.0); sql_query(update_community_stmt) .execute(&mut conn) .await - .inspect_err(|e| error!("Failed to update community stats: {e}")) + .map_err(|e| error!("Failed to update community stats: {e}")) .ok(); } @@ -433,7 +433,7 @@ async fn update_banned_when_expired(pool: &mut DbPool<'_>) { .set(person::banned.eq(false)) .execute(&mut conn) .await - .inspect_err(|e| error!("Failed to update person.banned when expires: {e}")) + .map_err(|e| error!("Failed to update person.banned when expires: {e}")) .ok(); diesel::delete( @@ -441,7 +441,7 @@ async fn update_banned_when_expired(pool: &mut DbPool<'_>) { ) .execute(&mut conn) .await - .inspect_err(|e| error!("Failed to remove community_ban expired rows: {e}")) + .map_err(|e| error!("Failed to remove community_ban expired rows: {e}")) .ok(); } Err(e) => {