automatic cargo CI changes

This commit is contained in:
PlexSheep 2024-02-24 12:28:29 +00:00 committed by github-actions[bot]
parent bd04eea9cc
commit 19d5d11b05
7 changed files with 20 additions and 25 deletions

View File

@ -10,7 +10,6 @@ use crate::error::*;
pub mod cli; pub mod cli;
pub mod packages; pub mod packages;
use cli::Cli; use cli::Cli;
use packages::*;
pub trait YamlConfigSection: Debug + Clone + for<'a> Deserialize<'a> { pub trait YamlConfigSection: Debug + Clone + for<'a> Deserialize<'a> {
fn check(&self) -> Result<()>; fn check(&self) -> Result<()>;
@ -65,7 +64,7 @@ impl Pass {
self.check()?; self.check()?;
Ok(match self { Ok(match self {
Self::Text(pass) => pass.clone(), Self::Text(pass) => pass.clone(),
Self::Env(key) => std::env::var(key).map_err(|err| ConfigError::from(err))?, Self::Env(key) => std::env::var(key).map_err(ConfigError::from)?,
Self::File(file) => std::fs::read_to_string(file)?, Self::File(file) => std::fs::read_to_string(file)?,
}) })
} }
@ -75,10 +74,7 @@ impl YamlConfigSection for Pass {
match self { match self {
Self::Text(_) => (), Self::Text(_) => (),
Self::Env(envvar) => { Self::Env(envvar) => {
if !std::env::var(envvar) if !std::env::var(envvar).map_err(ConfigError::from)?.is_empty() {
.map_err(ConfigError::from)?
.is_empty()
{
} else { } else {
return Err(ConfigError::EnvNotSet(envvar.clone()).into()); return Err(ConfigError::EnvNotSet(envvar.clone()).into());
} }

View File

@ -1,3 +1,3 @@
pub enum PackageType { pub enum PackageType {
Cargo Cargo,
} }

View File

@ -22,6 +22,6 @@ pub async fn release(cfg: &Config, apis: &mut ApiCollection) -> Result<()> {
Ok(()) Ok(())
} }
async fn tag(cfg: &Config) -> Result<()> { async fn tag(_cfg: &Config) -> Result<()> {
todo!() todo!()
} }

View File

@ -2,14 +2,14 @@ use async_trait::async_trait;
use super::ServerApi; use super::ServerApi;
use crate::{ use crate::{
config::{packages::PackageType, ApiType, Config}, config::{packages::PackageType, Config},
error::*, error::*,
}; };
pub struct Forgejo; pub struct Forgejo;
#[async_trait] #[async_trait]
impl ServerApi for Forgejo { impl ServerApi for Forgejo {
async fn init(&mut self, cfg: &Config) -> Result<()> { async fn init(&mut self, _cfg: &Config) -> Result<()> {
todo!() todo!()
} }
async fn push_release(&mut self) -> Result<()> { async fn push_release(&mut self) -> Result<()> {
@ -18,14 +18,13 @@ impl ServerApi for Forgejo {
async fn push_release_artifact(&mut self) -> Result<()> { async fn push_release_artifact(&mut self) -> Result<()> {
todo!() todo!()
} }
async fn push_pkg(&mut self, pkg_type: PackageType) -> Result<()> { async fn push_pkg(&mut self, _pkg_type: PackageType) -> Result<()> {
todo!() todo!()
} }
} }
impl Forgejo { impl Forgejo {
pub async fn build(cfg: &Config) -> Result<Self> { pub async fn build(_cfg: &Config) -> Result<Self> {
todo!() todo!()
} }
} }

View File

@ -2,14 +2,14 @@ use async_trait::async_trait;
use super::ServerApi; use super::ServerApi;
use crate::{ use crate::{
config::{packages::PackageType, ApiType, Config}, config::{packages::PackageType, Config},
error::*, error::*,
}; };
pub struct Gitea; pub struct Gitea;
#[async_trait] #[async_trait]
impl ServerApi for Gitea { impl ServerApi for Gitea {
async fn init(&mut self, cfg: &Config) -> Result<()> { async fn init(&mut self, _cfg: &Config) -> Result<()> {
todo!() todo!()
} }
async fn push_release(&mut self) -> Result<()> { async fn push_release(&mut self) -> Result<()> {
@ -18,13 +18,13 @@ impl ServerApi for Gitea {
async fn push_release_artifact(&mut self) -> Result<()> { async fn push_release_artifact(&mut self) -> Result<()> {
todo!() todo!()
} }
async fn push_pkg(&mut self, pkg_type: PackageType) -> Result<()> { async fn push_pkg(&mut self, _pkg_type: PackageType) -> Result<()> {
todo!() todo!()
} }
} }
impl Gitea { impl Gitea {
pub async fn build(cfg: &Config) -> Result<Self> { pub async fn build(_cfg: &Config) -> Result<Self> {
todo!() todo!()
} }
} }

View File

@ -2,14 +2,14 @@ use async_trait::async_trait;
use super::ServerApi; use super::ServerApi;
use crate::{ use crate::{
config::{packages::PackageType, ApiType, Config}, config::{packages::PackageType, Config},
error::*, error::*,
}; };
pub struct Github; pub struct Github;
#[async_trait] #[async_trait]
impl ServerApi for Github { impl ServerApi for Github {
async fn init(&mut self, cfg: &Config) -> Result<()> { async fn init(&mut self, _cfg: &Config) -> Result<()> {
todo!() todo!()
} }
async fn push_release(&mut self) -> Result<()> { async fn push_release(&mut self) -> Result<()> {
@ -18,13 +18,13 @@ impl ServerApi for Github {
async fn push_release_artifact(&mut self) -> Result<()> { async fn push_release_artifact(&mut self) -> Result<()> {
todo!() todo!()
} }
async fn push_pkg(&mut self, pkg_type: PackageType) -> Result<()> { async fn push_pkg(&mut self, _pkg_type: PackageType) -> Result<()> {
todo!() todo!()
} }
} }
impl Github { impl Github {
pub async fn build(cfg: &Config) -> Result<Self> { pub async fn build(_cfg: &Config) -> Result<Self> {
todo!() todo!()
} }
} }

View File

@ -2,14 +2,14 @@ use async_trait::async_trait;
use super::ServerApi; use super::ServerApi;
use crate::{ use crate::{
config::{packages::PackageType, ApiType, Config}, config::{packages::PackageType, Config},
error::*, error::*,
}; };
pub struct Gitlab; pub struct Gitlab;
#[async_trait] #[async_trait]
impl ServerApi for Gitlab { impl ServerApi for Gitlab {
async fn init(&mut self, cfg: &Config) -> Result<()> { async fn init(&mut self, _cfg: &Config) -> Result<()> {
todo!() todo!()
} }
async fn push_release(&mut self) -> Result<()> { async fn push_release(&mut self) -> Result<()> {
@ -18,13 +18,13 @@ impl ServerApi for Gitlab {
async fn push_release_artifact(&mut self) -> Result<()> { async fn push_release_artifact(&mut self) -> Result<()> {
todo!() todo!()
} }
async fn push_pkg(&mut self, pkg_type: PackageType) -> Result<()> { async fn push_pkg(&mut self, _pkg_type: PackageType) -> Result<()> {
todo!() todo!()
} }
} }
impl Gitlab { impl Gitlab {
pub async fn build(cfg: &Config) -> Result<Self> { pub async fn build(_cfg: &Config) -> Result<Self> {
todo!() todo!()
} }
} }