From 328bb44d2362a679dee2211d947e1ff6c065c7fb Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Thu, 13 Feb 2020 17:21:03 -0500 Subject: [PATCH 1/2] Fix cargo fmt stuff --- youmubot-cf/src/announcer.rs | 9 ++++++--- youmubot-core/src/db.rs | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/youmubot-cf/src/announcer.rs b/youmubot-cf/src/announcer.rs index e324990..3c1e837 100644 --- a/youmubot-cf/src/announcer.rs +++ b/youmubot-cf/src/announcer.rs @@ -60,9 +60,12 @@ fn update_user( let mut send_message = |rc: RatingChange| -> CommandResult { let channels = channels_list.get_or_insert_with(|| channels.channels_of(http.clone(), user_id)); - if channels.is_empty() { return Ok(()); } - let (contest, _, _) = - codeforces::Contest::standings(reqwest, rc.contest_id, |f| f.limit(1, 1))?; for channel in channels { + if channels.is_empty() { + return Ok(()); + } + let (contest, _, _) = + codeforces::Contest::standings(reqwest, rc.contest_id, |f| f.limit(1, 1))?; + for channel in channels { if let Err(e) = channel.send_message(http.http(), |e| { e.content(format!("Rating change for {}!", user_id.mention())) .embed(|c| { diff --git a/youmubot-core/src/db.rs b/youmubot-core/src/db.rs index f7926a6..452562e 100644 --- a/youmubot-core/src/db.rs +++ b/youmubot-core/src/db.rs @@ -1,9 +1,7 @@ use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; -use serenity::{ - model::id::{RoleId, UserId}, -}; +use serenity::model::id::{RoleId, UserId}; use std::collections::HashMap; use youmubot_db::{GuildMap, DB}; From e5a5b88980f13f9cbf799e946661080fb1ae1556 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Thu, 13 Feb 2020 17:17:03 -0500 Subject: [PATCH 2/2] Create drone config -- --check [ci test] build and deploy [ci test] change ssh key source [ci test] avoid duplicates [ci test] run test pipeline Restrict deployment to master branch --- .drone.yml | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..e214088 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,51 @@ +--- +kind: pipeline +type: docker +name: default + +trigger: + event: + - push + +steps: +- name: format_check + image: rust:1.41 + commands: + - rustup component add rustfmt + - cargo fmt -- --check +- name: cargo_check + image: rust:1.41 + commands: + - cargo check + +--- +kind: pipeline +type: docker +name: deploy +trigger: + branch: + - master + event: + - push + +steps: +- name: build_release + image: rust:1.41 + commands: + - cargo build --release +- name: deploy + image: drillster/drone-rsync + environment: + RSYNC_KEY: + from_secret: rsync_key + settings: + user: natsukagami + args: -zz + hosts: + - "104.248.149.133" # Youmubot + source: + - ./target/release/youmubot + target: + - ~/youmubot/youmubot + script: + - systemctl --user restart youmubot