automatic cargo CI changes

This commit is contained in:
PlexSheep 2024-02-24 13:44:06 +00:00 committed by github-actions[bot]
parent 3e0d32721b
commit a42393864e
7 changed files with 32 additions and 27 deletions

View File

@ -21,7 +21,7 @@ pub enum Error {
#[error("Could not generate the changelog")] #[error("Could not generate the changelog")]
ChangelogError(#[from] ChangelogError), ChangelogError(#[from] ChangelogError),
#[error("Server Api error")] #[error("Server Api error")]
ServerApiError(#[from] ServerApiError) ServerApiError(#[from] ServerApiError),
} }
#[derive(Error, Debug)] #[derive(Error, Debug)]
@ -31,7 +31,7 @@ pub enum ServerApiError {
#[error(transparent)] #[error(transparent)]
InvalidHeaderValue(#[from] reqwest::header::InvalidHeaderValue), InvalidHeaderValue(#[from] reqwest::header::InvalidHeaderValue),
#[error(transparent)] #[error(transparent)]
ReqwestErr(#[from] reqwest::Error) ReqwestErr(#[from] reqwest::Error),
} }
#[derive(Error, Debug)] #[derive(Error, Debug)]

View File

@ -7,10 +7,10 @@ pub struct ReleaseContext {
pub repository: String, pub repository: String,
pub text: String, pub text: String,
pub tag: String, pub tag: String,
pub commit_sig: String pub commit_sig: String,
} }
pub async fn release(cfg: &Config, apis: &mut ApiCollection) -> Result<()> { pub async fn release(cfg: &Config, _apis: &mut ApiCollection) -> Result<()> {
// TODO: git tag // TODO: git tag
// TODO: push to each server // TODO: push to each server

View File

@ -1,12 +1,12 @@
use crate::{ use crate::{
config::{packages::PackageType, Api, ApiType, Config}, config::{Api, Config},
error::*, error::*,
serverapi::{PublishContext, ReleaseContext, ServerApi}, serverapi::{PublishContext, ReleaseContext, ServerApi},
}; };
use async_trait::async_trait; use async_trait::async_trait;
use reqwest::{ use reqwest::{
header::{HeaderMap, HeaderValue}, header::{HeaderMap, HeaderValue},
Client, Method, Request, RequestBuilder, Url, Client, Url,
}; };
pub struct Forgejo { pub struct Forgejo {
@ -38,7 +38,7 @@ impl 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, rc: &ReleaseContext) -> Result<()> { async fn push_release(&mut self, rc: &ReleaseContext) -> Result<()> {
@ -65,14 +65,19 @@ impl ServerApi for Forgejo {
.client .client
.post(url) .post(url)
.body(body) .body(body)
.build().map_err(ServerApiError::from)?; .build()
let response = self.client.execute(request).await.map_err(ServerApiError::from)?; .map_err(ServerApiError::from)?;
let _response = self
.client
.execute(request)
.await
.map_err(ServerApiError::from)?;
Ok(()) Ok(())
} }
async fn push_release_artifact(&mut self, rc: &ReleaseContext) -> Result<()> { async fn push_release_artifact(&mut self, _rc: &ReleaseContext) -> Result<()> {
todo!() todo!()
} }
async fn push_pkg(&mut self, pc: &PublishContext) -> Result<()> { async fn push_pkg(&mut self, _pc: &PublishContext) -> Result<()> {
todo!() todo!()
} }
} }

View File

@ -2,7 +2,7 @@ use async_trait::async_trait;
use super::{PublishContext, ReleaseContext, ServerApi}; use super::{PublishContext, ReleaseContext, ServerApi};
use crate::{ use crate::{
config::{packages::PackageType, Api, ApiType, Config}, config::{Api, Config},
error::*, error::*,
}; };
pub struct Gitea { pub struct Gitea {
@ -11,16 +11,16 @@ 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, rc: &ReleaseContext) -> Result<()> { async fn push_release(&mut self, _rc: &ReleaseContext) -> Result<()> {
todo!() todo!()
} }
async fn push_release_artifact(&mut self, rc: &ReleaseContext) -> Result<()> { async fn push_release_artifact(&mut self, _rc: &ReleaseContext) -> Result<()> {
todo!() todo!()
} }
async fn push_pkg(&mut self, pc: &PublishContext) -> Result<()> { async fn push_pkg(&mut self, _pc: &PublishContext) -> Result<()> {
todo!() todo!()
} }
} }

View File

@ -2,7 +2,7 @@ use async_trait::async_trait;
use super::{PublishContext, ReleaseContext, ServerApi}; use super::{PublishContext, ReleaseContext, ServerApi};
use crate::{ use crate::{
config::{packages::PackageType, Api, ApiType, Config}, config::{Api, Config},
error::*, error::*,
}; };
pub struct Github { pub struct Github {
@ -11,16 +11,16 @@ 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, rc: &ReleaseContext) -> Result<()> { async fn push_release(&mut self, _rc: &ReleaseContext) -> Result<()> {
todo!() todo!()
} }
async fn push_release_artifact(&mut self, rc: &ReleaseContext) -> Result<()> { async fn push_release_artifact(&mut self, _rc: &ReleaseContext) -> Result<()> {
todo!() todo!()
} }
async fn push_pkg(&mut self, pc: &PublishContext) -> Result<()> { async fn push_pkg(&mut self, _pc: &PublishContext) -> Result<()> {
todo!() todo!()
} }
} }

View File

@ -2,7 +2,7 @@ use async_trait::async_trait;
use super::{PublishContext, ReleaseContext, ServerApi}; use super::{PublishContext, ReleaseContext, ServerApi};
use crate::{ use crate::{
config::{packages::PackageType, Api, ApiType, Config}, config::{Api, Config},
error::*, error::*,
}; };
pub struct Gitlab { pub struct Gitlab {
@ -11,16 +11,16 @@ 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, rc: &ReleaseContext) -> Result<()> { async fn push_release(&mut self, _rc: &ReleaseContext) -> Result<()> {
todo!() todo!()
} }
async fn push_release_artifact(&mut self, rc: &ReleaseContext) -> Result<()> { async fn push_release_artifact(&mut self, _rc: &ReleaseContext) -> Result<()> {
todo!() todo!()
} }
async fn push_pkg(&mut self, pc: &PublishContext) -> Result<()> { async fn push_pkg(&mut self, _pc: &PublishContext) -> Result<()> {
todo!() todo!()
} }
} }

View File

@ -54,7 +54,7 @@ pub async fn init_servers(cfg: &Config) -> Result<ApiCollection> {
} }
} }
for api in collection.iter_mut() { for api in collection.iter_mut() {
api.init(&cfg).await?; api.init(cfg).await?;
} }
Ok(collection) Ok(collection)
} }