2022-04-13 12:21:34 +05:30
|
|
|
define launch_test_env
|
|
|
|
docker-compose -f docker-compose-dev-deps.yml up --detach
|
|
|
|
python ./scripts/gitea.py
|
|
|
|
endef
|
|
|
|
|
2022-04-12 17:46:53 +05:30
|
|
|
define test_sqlite_db
|
|
|
|
cd db/db-sqlx-sqlite &&\
|
|
|
|
DATABASE_URL=${SQLITE_DATABASE_URL}\
|
|
|
|
cargo test --no-fail-fast
|
|
|
|
endef
|
|
|
|
|
2022-05-17 01:15:37 +05:30
|
|
|
define test_gitea_forge
|
|
|
|
cd forge/gitea && \
|
|
|
|
cargo test --no-fail-fast
|
|
|
|
endef
|
|
|
|
|
2022-03-27 22:02:31 +05:30
|
|
|
default: ## Debug build
|
|
|
|
cargo build
|
|
|
|
|
|
|
|
clean: ## Clean all build artifacts and dependencies
|
|
|
|
@-/bin/rm -rf target/
|
|
|
|
@-/bin/rm -rf database/migrator/target/
|
|
|
|
@-/bin/rm -rf database/*/target/
|
|
|
|
@-/bin/rm -rf database/*/tmp/
|
|
|
|
@cargo clean
|
|
|
|
|
|
|
|
coverage: migrate ## Generate coverage report in HTML format
|
2022-03-28 12:24:35 +05:30
|
|
|
cargo tarpaulin -t 1200 --out Html --skip-clean --all-features --no-fail-fast #--workspace=database/db-sqlx-postgres,database/db-sqlx-sqlite,.
|
2022-03-27 22:02:31 +05:30
|
|
|
|
2022-04-06 10:06:14 +05:30
|
|
|
check: ## Check for syntax errors on all workspaces
|
2022-04-12 17:46:53 +05:30
|
|
|
cargo check --workspace --tests --all-features
|
|
|
|
cd db/migrator && cargo check --tests --all-features
|
2022-05-17 01:15:37 +05:30
|
|
|
cd forge/forge-core && cargo check --tests --all-features
|
|
|
|
cd forge/gitea && cargo check --tests --all-features
|
2022-04-12 17:46:53 +05:30
|
|
|
cd db/db-sqlx-sqlite &&\
|
|
|
|
DATABASE_URL=${SQLITE_DATABASE_URL}\
|
|
|
|
cargo check
|
|
|
|
cd db/db-core/ && cargo check
|
2022-04-06 10:06:14 +05:30
|
|
|
|
2022-03-27 22:02:31 +05:30
|
|
|
dev-env: ## Download development dependencies
|
2022-04-13 15:01:06 +05:30
|
|
|
$(call launch_test_env)
|
2022-03-27 22:02:31 +05:30
|
|
|
cargo fetch
|
|
|
|
|
|
|
|
doc: ## Prepare documentation
|
|
|
|
cargo doc --no-deps --workspace --all-features
|
|
|
|
|
|
|
|
#docker: ## Build docker images
|
|
|
|
# docker build -t realaravinth/gitpad:master -t realaravinth/gitpad:latest .
|
|
|
|
#
|
|
|
|
#docker-publish: docker ## Build and publish docker images
|
|
|
|
# docker push realaravinth/gitpad:master
|
|
|
|
# docker push realaravinth/gitpad:latest
|
|
|
|
|
|
|
|
lint: ## Lint codebase
|
|
|
|
cargo fmt -v --all -- --emit files
|
|
|
|
cargo clippy --workspace --tests --all-features
|
|
|
|
|
|
|
|
release: ## Release build
|
|
|
|
cargo build --release
|
|
|
|
|
|
|
|
run: default ## Run debug build
|
|
|
|
cargo run
|
|
|
|
|
|
|
|
migrate: ## run migrations
|
2022-04-12 17:46:53 +05:30
|
|
|
@-rm -rf db/db-sqlx-sqlite/tmp && mkdir db/db-sqlx-sqlite/tmp
|
|
|
|
cd db/migrator && cargo run
|
|
|
|
# echo TODO: add migrations
|
2022-03-27 22:02:31 +05:30
|
|
|
|
|
|
|
sqlx-offline-data: ## prepare sqlx offline data
|
2022-04-12 17:46:53 +05:30
|
|
|
cd db/db-sqlx-sqlite/ \
|
|
|
|
&& DATABASE_URL=${SQLITE_DATABASE_URL} cargo sqlx prepare
|
|
|
|
# cargo sqlx prepare --database-url=${POSTGRES_DATABASE_URL} -- --bin starchart \
|
2022-03-27 22:02:31 +05:30
|
|
|
--all-features
|
|
|
|
test: migrate ## Run tests
|
2022-04-13 12:21:34 +05:30
|
|
|
$(call launch_test_env)
|
2022-04-12 17:46:53 +05:30
|
|
|
$(call test_sqlite_db)
|
2022-05-17 01:15:37 +05:30
|
|
|
$(call test_gitea_forge)
|
2022-03-30 10:22:27 +05:30
|
|
|
cargo test --no-fail-fast
|
2022-04-12 17:46:53 +05:30
|
|
|
|
2022-03-28 12:24:35 +05:30
|
|
|
# cd database/db-sqlx-postgres &&\
|
|
|
|
# DATABASE_URL=${POSTGRES_DATABASE_URL}\
|
|
|
|
# cargo test --no-fail-fast
|
2022-03-27 22:02:31 +05:30
|
|
|
|
|
|
|
xml-test-coverage: migrate ## Generate cobertura.xml test coverage
|
2022-03-28 12:24:35 +05:30
|
|
|
cargo tarpaulin -t 1200 --out Xml --skip-clean --all-features --no-fail-fast #--workspace=database/db-sqlx-postgres,database/db-sqlx-sqlite,.
|
2022-03-27 22:02:31 +05:30
|
|
|
|
|
|
|
help: ## Prints help for targets with comments
|
|
|
|
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|