From 38d897023c8870aedb08539ceab7a0dd4d61909a Mon Sep 17 00:00:00 2001 From: realaravinth Date: Tue, 17 May 2022 01:15:37 +0530 Subject: [PATCH] feat: setup check and test for forge/* workspaces --- Cargo.lock | 24 ++++++++++++++++++++++++ Cargo.toml | 11 +++++++++-- Makefile | 8 ++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a96215e..acddbfe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -563,6 +563,14 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "forge-core" +version = "0.1.0" +dependencies = [ + "async-trait", + "db-core", +] + [[package]] name = "form_urlencoded" version = "1.0.1" @@ -673,6 +681,19 @@ dependencies = [ "wasi 0.10.2+wasi-snapshot-preview1", ] +[[package]] +name = "gitea" +version = "0.1.0" +dependencies = [ + "actix-rt", + "async-trait", + "forge-core", + "reqwest", + "serde", + "serde_json", + "url", +] + [[package]] name = "globset" version = "0.4.8" @@ -2127,10 +2148,13 @@ name = "starchart" version = "0.1.0" dependencies = [ "actix-rt", + "async-trait", "config", "db-core", "db-sqlx-sqlite", "derive_more", + "forge-core", + "gitea", "lazy_static", "log", "rand", diff --git a/Cargo.toml b/Cargo.toml index c6cd47a..126de5d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ build = "build.rs" [dependencies] actix-rt = "2.7" +async-trait = "0.1.51" config = "0.13.0" lazy_static = "1.4.0" rand = "0.8.5" @@ -45,11 +46,17 @@ path = "./db/db-core" [dependencies.db-sqlx-sqlite] path = "./db/db-sqlx-sqlite" + +[dependencies.gitea] +path = "./forge/gitea" + +[dependencies.forge-core] +path = "./forge/forge-core" + [dependencies.sqlx] features = ["runtime-actix-rustls", "uuid", "postgres", "time", "offline", "sqlite"] version = "0.5.11" [workspace] exclude = ["db/migrator"] -members = [".", "db/db-core", "db/db-sqlx-sqlite"] -# "db/db-sqlx-postgres" +members = [".", "db/db-core", "db/db-sqlx-sqlite", "forge/forge-core", "forge/gitea"] diff --git a/Makefile b/Makefile index 42350a7..ee27ab0 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,11 @@ define test_sqlite_db cargo test --no-fail-fast endef +define test_gitea_forge + cd forge/gitea && \ + cargo test --no-fail-fast +endef + default: ## Debug build cargo build @@ -25,6 +30,8 @@ coverage: migrate ## Generate coverage report in HTML format check: ## Check for syntax errors on all workspaces cargo check --workspace --tests --all-features cd db/migrator && cargo check --tests --all-features + cd forge/forge-core && cargo check --tests --all-features + cd forge/gitea && cargo check --tests --all-features cd db/db-sqlx-sqlite &&\ DATABASE_URL=${SQLITE_DATABASE_URL}\ cargo check @@ -67,6 +74,7 @@ sqlx-offline-data: ## prepare sqlx offline data test: migrate ## Run tests $(call launch_test_env) $(call test_sqlite_db) + $(call test_gitea_forge) cargo test --no-fail-fast # cd database/db-sqlx-postgres &&\