feat: init woodpecker #1
3 changed files with 7 additions and 4 deletions
|
@ -18,6 +18,7 @@ steps:
|
|||
environment:
|
||||
POSTGRES_DATABASE_URL: postgres://postgres:password@database:5432/postgres
|
||||
SQLITE_DATABASE_URL: sqlite:///tmp/admin.db
|
||||
FORGEJO_HOST: http://forgejo:3000
|
||||
commands:
|
||||
# - curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&\
|
||||
# - apt update && apt-get -y --no-install-recommends install nodejs tar gpg curl wget
|
||||
|
|
|
@ -31,6 +31,7 @@ pub mod schema;
|
|||
const REPO_SEARCH_PATH: &str = "/api/v1/repos/search";
|
||||
const GITEA_NODEINFO: &str = "/api/v1/nodeinfo";
|
||||
const GITEA_IDENTIFIER: &str = "gitea";
|
||||
const FORGEJO_IDENTIFIER: &str = "forgejo";
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Gitea {
|
||||
|
@ -177,13 +178,13 @@ mod tests {
|
|||
use super::*;
|
||||
use url::Url;
|
||||
|
||||
pub const GITEA_HOST: &str = "http://localhost:8080";
|
||||
pub const NET_REPOSITORIES: u64 = 100;
|
||||
pub const PER_CRAWL: u64 = 10;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn gitea_works() {
|
||||
let ctx = Gitea::new(Url::parse(GITEA_HOST).unwrap(), Client::new());
|
||||
let ctx = Gitea::new(Url::parse(&std::env::var("FORGEJO_HOST").unwrap()).unwrap(), Client::new());
|
||||
|
||||
assert!(ctx.is_forge().await);
|
||||
let steps = NET_REPOSITORIES / PER_CRAWL;
|
||||
|
||||
|
|
|
@ -229,13 +229,14 @@ mod tests {
|
|||
|
||||
use url::Url;
|
||||
|
||||
pub const GITEA_HOST: &str = "http://localhost:8080";
|
||||
pub const GITEA_USERNAME: &str = "bot";
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn crawl_gitea() {
|
||||
let (db, ctx, federate, _tmp_dir) = sqlx_sqlite::get_ctx().await;
|
||||
let url = Url::parse(GITEA_HOST).unwrap();
|
||||
let url = Url::parse(
|
||||
&std::env::var("FORGEJO_HOST").unwrap()
|
||||
).unwrap();
|
||||
ctx.crawl(&url, &db, &federate).await;
|
||||
// let hostname = get_hostname(&Url::parse(GITEA_HOST).unwrap());
|
||||
assert!(db.forge_exists(&url).await.unwrap());
|
||||
|
|
Loading…
Reference in a new issue