WIP: add github crate

This commit is contained in:
Paul Campbell 2024-05-25 11:25:13 +01:00
parent 6cab8bb2ba
commit a259fd3552
8 changed files with 72 additions and 19 deletions

View file

@ -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

View file

@ -4,7 +4,7 @@ version = { workspace = true }
edition = { workspace = true }
[features]
default = ["forgejo"]
default = ["forgejo", "github"]
forgejo = []
github = []

View file

@ -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"

View file

@ -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<super::Branch> {
async fn branches_get_all(&self) -> Vec<Branch> {
todo!()
}
}

View file

@ -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 }

View file

@ -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 {

View file

@ -4,7 +4,7 @@ version = { workspace = true }
edition = { workspace = true }
[features]
default = ["forgejo"]
default = ["forgejo", "github"]
forgejo = []
github = []

View file

@ -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 }