From a259fd3552f2feb99c53585133232d974c5215f6 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 25 May 2024 11:25:13 +0100 Subject: [PATCH] WIP: add github crate --- Cargo.toml | 2 + crates/config/Cargo.toml | 2 +- crates/forge-github/Cargo.toml | 59 +++++++++++++++++++ .../src/github.rs => forge-github/src/lib.rs} | 8 +-- crates/forge/Cargo.toml | 5 +- crates/forge/src/lib.rs | 8 +-- crates/repo-actor/Cargo.toml | 2 +- crates/server/Cargo.toml | 5 -- 8 files changed, 72 insertions(+), 19 deletions(-) create mode 100644 crates/forge-github/Cargo.toml rename crates/{forge/src/github.rs => forge-github/src/lib.rs} (62%) diff --git a/Cargo.toml b/Cargo.toml index 8fcdffc..bb4b4d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ members = [ "crates/git", "crates/forge", "crates/forge-forgejo", + "crates/forge-github", "crates/repo-actor", ] @@ -26,6 +27,7 @@ git-next-config = { path = "crates/config" } git-next-git = { path = "crates/git" } git-next-forge = { path = "crates/forge" } git-next-forge-forgejo = { path = "crates/forge-forgejo" } +git-next-forge-github = { path = "crates/forge-github" } git-next-repo-actor = { path = "crates/repo-actor" } # CLI parsing diff --git a/crates/config/Cargo.toml b/crates/config/Cargo.toml index 30d5810..49fe34d 100644 --- a/crates/config/Cargo.toml +++ b/crates/config/Cargo.toml @@ -4,7 +4,7 @@ version = { workspace = true } edition = { workspace = true } [features] -default = ["forgejo"] +default = ["forgejo", "github"] forgejo = [] github = [] diff --git a/crates/forge-github/Cargo.toml b/crates/forge-github/Cargo.toml new file mode 100644 index 0000000..500233f --- /dev/null +++ b/crates/forge-github/Cargo.toml @@ -0,0 +1,59 @@ +[package] +name = "git-next-forge-github" +version = { workspace = true } +edition = { workspace = true } + +[dependencies] +git-next-config = { workspace = true } +git-next-git = { workspace = true } + +# logging +console-subscriber = { workspace = true } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } + +# base64 decoding +base64 = { workspace = true } + +# git +async-trait = { workspace = true } + +# fs/network +kxio = { workspace = true } + +# TOML parsing +serde = { workspace = true } +serde_json = { workspace = true } +toml = { workspace = true } + +# Secrets and Password +secrecy = { workspace = true } + +# Conventional Commit check +git-conventional = { workspace = true } + +# Webhooks +bytes = { workspace = true } +ulid = { workspace = true } +warp = { workspace = true } + +# boilerplate +derive_more = { workspace = true } + +# file watcher +inotify = { workspace = true } + +# # Actors +# actix = { workspace = true } +# actix-rt = { workspace = true } +tokio = { workspace = true } + +[dev-dependencies] +# Testing +assert2 = { workspace = true } + +[lints.clippy] +nursery = { level = "warn", priority = -1 } +# pedantic = "warn" +unwrap_used = "warn" +expect_used = "warn" diff --git a/crates/forge/src/github.rs b/crates/forge-github/src/lib.rs similarity index 62% rename from crates/forge/src/github.rs rename to crates/forge-github/src/lib.rs index 7398d5a..59ad7ad 100644 --- a/crates/forge/src/github.rs +++ b/crates/forge-github/src/lib.rs @@ -1,7 +1,7 @@ -use crate::network::Network; +use kxio::network::Network; struct Github; -pub(super) struct GithubEnv { +pub struct GithubEnv { net: Network, } impl GithubEnv { @@ -10,12 +10,12 @@ impl GithubEnv { } } #[async_trait::async_trait] -impl super::ForgeLike for GithubEnv { +impl git_next_git::ForgeLike for GithubEnv { fn name(&self) -> String { "github".to_string() } - async fn branches_get_all(&self) -> Vec { + async fn branches_get_all(&self) -> Vec { todo!() } } diff --git a/crates/forge/Cargo.toml b/crates/forge/Cargo.toml index 407f512..551b277 100644 --- a/crates/forge/Cargo.toml +++ b/crates/forge/Cargo.toml @@ -4,14 +4,15 @@ version = { workspace = true } edition = { workspace = true } [features] -default = ["forgejo"] +default = ["forgejo", "github"] forgejo = ["git-next-forge-forgejo"] -github = [] +github = ["git-next-forge-github"] [dependencies] git-next-config = { workspace = true } git-next-git = { workspace = true } git-next-forge-forgejo = { workspace = true, optional = true } +git-next-forge-github = { workspace = true, optional = true } # logging console-subscriber = { workspace = true } diff --git a/crates/forge/src/lib.rs b/crates/forge/src/lib.rs index e4dddf8..8875475 100644 --- a/crates/forge/src/lib.rs +++ b/crates/forge/src/lib.rs @@ -1,12 +1,8 @@ #![allow(dead_code)] -use git_next_forge_forgejo as forgejo; use git_next_git as git; use kxio::network::Network; -#[cfg(feature = "github")] -mod github; - mod mock_forge; #[derive(Clone, Debug)] @@ -14,9 +10,9 @@ pub enum Forge { Mock(mock_forge::MockForgeEnv), #[allow(clippy::enum_variant_names)] #[cfg(feature = "forgejo")] - ForgeJo(forgejo::ForgeJo), + ForgeJo(git_next_forge_forgejo::ForgeJo), #[cfg(feature = "github")] - Github(github::GithubEnv), + Github(git_next_forge_github::GithubEnv), } impl Forge { pub const fn new_mock() -> Self { diff --git a/crates/repo-actor/Cargo.toml b/crates/repo-actor/Cargo.toml index 1738481..3125c9e 100644 --- a/crates/repo-actor/Cargo.toml +++ b/crates/repo-actor/Cargo.toml @@ -4,7 +4,7 @@ version = { workspace = true } edition = { workspace = true } [features] -default = ["forgejo"] +default = ["forgejo", "github"] forgejo = [] github = [] diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index 4b6049f..0b57586 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -3,11 +3,6 @@ name = "git-next-server" version = { workspace = true } edition = { workspace = true } -[features] -default = ["forgejo"] -forgejo = [] -github = [] - [dependencies] git-next-config = { workspace = true } git-next-git = { workspace = true }