Compare commits

...

2 Commits

Author SHA1 Message Date
Christoph J. Scherr 06bf976a7d ci add cargo test of docs
cargo devel CI / cargo CI (push) Failing after 2m19s Details
2024-05-12 17:27:27 +02:00
Christoph J. Scherr 12dc5f1c84 github api sucks idk
cargo devel CI / cargo CI (push) Failing after 1m36s Details
2024-04-26 15:57:38 +02:00
6 changed files with 26 additions and 27 deletions

View File

@ -17,14 +17,14 @@ api:
type: github type: github
repository: autocrate repository: autocrate
auth: auth:
user: PlexSheep user: plexsheep
pass: pass:
!env TOKEN_GH !env TOKEN_GH
cscherr: # cscherr:
type: forgejo # type: forgejo
endpoint: https://git.cscherr.de # endpoint: https://git.cscherr.de
repository: autocrate # repository: autocrate
auth: # auth:
user: PlexSheep # user: PlexSheep
pass: # pass:
!env TOKEN_CSCHERR # !env TOKEN_CSCHERR

View File

@ -37,7 +37,7 @@ jobs:
- name: cargo fmt - name: cargo fmt
run: cargo fmt --all run: cargo fmt --all
- name: cargo test - name: cargo test
run: cargo test --all-features --all-targets --workspace run: cargo test --all-features --all-targets --workspace && cargo test --all-features --workspace --doc
- name: commit back to repository - name: commit back to repository
uses: https://github.com/stefanzweifel/git-auto-commit-action@v5 uses: https://github.com/stefanzweifel/git-auto-commit-action@v5
with: with:

View File

@ -38,7 +38,7 @@ jobs:
- name: cargo fmt - name: cargo fmt
run: cargo fmt --all run: cargo fmt --all
- name: cargo test - name: cargo test
run: cargo test --all-features --all-targets --workspace run: cargo test --all-features --all-targets --workspace && cargo test --all-features --workspace --doc
- name: commit back to repository - name: commit back to repository
uses: stefanzweifel/git-auto-commit-action@v5 uses: stefanzweifel/git-auto-commit-action@v5
with: with:

View File

@ -8,7 +8,7 @@ use libpt::log::{debug, error, trace};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use url::Url; use url::Url;
use crate::error::*; use crate::{error::*, git};
pub mod cli; pub mod cli;
pub mod packages; pub mod packages;
@ -295,14 +295,7 @@ impl Debug for Config {
impl Config { impl Config {
pub fn load(cli: &Cli) -> Result<Self> { pub fn load(cli: &Cli) -> Result<Self> {
let repo = match git2::Repository::open_from_env() { let repo = git::get_repo()?;
Ok(repo) => repo,
Err(_err) => {
let err = ConfigError::GitRepoNotFound.into();
error!("{err}");
return Err(err);
}
};
let mut path = repo.path().to_path_buf(); let mut path = repo.path().to_path_buf();
path.pop(); // we want the real root, not the `.git` dir path.pop(); // we want the real root, not the `.git` dir

View File

@ -9,6 +9,7 @@ use autocrate::{
release::release, release::release,
serverapi::ApiCollection, serverapi::ApiCollection,
}; };
use libpt::log::{debug, error, trace};
#[tokio::main] #[tokio::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {
@ -39,5 +40,9 @@ async fn main() -> Result<()> {
todo!() todo!()
} }
}; };
if let Some(err) = status {
error!("{err}");
trace!("{:#?}", err.source());
}
Ok(()) Ok(())
} }

View File

@ -1,4 +1,5 @@
use async_trait::async_trait; use async_trait::async_trait;
use libpt::log::debug;
use octocrab; use octocrab;
use super::{PublishContext, ReleaseContext, ServerApi}; use super::{PublishContext, ReleaseContext, ServerApi};
@ -21,18 +22,18 @@ impl Github {
#[async_trait] #[async_trait]
impl ServerApi for Github { impl ServerApi for Github {
async fn push_release(&mut self, rc: ReleaseContext) -> Result<()> { async fn push_release(&mut self, rc: ReleaseContext) -> Result<()> {
let _response = octocrab::instance() debug!("release context: {rc:#?}");
.repos(rc.username, rc.repository) let t1 = octocrab::instance();
.releases() let t2 = t1.repos(rc.username, rc.repository);
let t = t2.releases();
let req = t
.create(&rc.tag) .create(&rc.tag)
.target_commitish(&rc.commit_sig) .target_commitish(&rc.commit_sig)
.name(&rc.tag) .name(&rc.tag)
.body(&rc.text) .body(&rc.text)
.draft(rc.draft) .draft(rc.draft)
.prerelease(rc.prerelease) .prerelease(rc.prerelease);
.send() req.send().await.map_err(ServerApiError::from)?;
.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<()> {