2024-05-13 21:30:15 +05:30
|
|
|
define deploy_dependencies ## deploy dependencies
|
2024-05-18 20:41:52 +05:30
|
|
|
@-docker-compose -f ./docker-compose-dev-deps.yml \
|
|
|
|
up -d
|
2024-05-13 21:30:15 +05:30
|
|
|
endef
|
|
|
|
|
|
|
|
define run_migrations ## run database migrations
|
|
|
|
cd utils/db-migrations/ && unset DATABASE_URL && cargo build
|
|
|
|
cd utils/db-migrations/ && cargo run
|
|
|
|
endef
|
|
|
|
|
|
|
|
#define cache_bust ## run cache_busting program
|
|
|
|
# npm run sass
|
|
|
|
# cd utils/cache-bust && cargo run
|
|
|
|
#endef
|
|
|
|
#
|
|
|
|
default: ## Debug build
|
|
|
|
# $(call cache_bust)
|
|
|
|
cargo run -- serve
|
|
|
|
#
|
|
|
|
#cache-bust: ## Run cache buster on static assets
|
|
|
|
# $(call cache_bust)
|
|
|
|
|
|
|
|
check: ## Check for syntax errors on all workspaces
|
|
|
|
cargo check --workspace --tests --all-features
|
|
|
|
#cd utils/cache-bust && cargo check --tests --all-features
|
|
|
|
|
|
|
|
clean: ## Clean all build artifacts and dependencies
|
|
|
|
@cargo clean
|
|
|
|
|
|
|
|
db.migrate: ## run migrations
|
|
|
|
$(call run_migrations)
|
|
|
|
|
|
|
|
db.sqlx.offline: ## prepare sqlx offline data
|
|
|
|
cargo sqlx prepare \
|
|
|
|
--database-url=${DATABASE_URL} -- \
|
|
|
|
--all-features
|
|
|
|
|
|
|
|
#dev-env: ## Download development dependencies
|
|
|
|
# npm install
|
|
|
|
# cargo fetch
|
|
|
|
|
|
|
|
doc: ## Prepare documentation
|
|
|
|
cargo doc --no-deps --workspace --all-features
|
|
|
|
|
|
|
|
docker.build: ## Build docker images
|
|
|
|
docker build \
|
2024-05-14 23:30:34 +05:30
|
|
|
-t libresolutions/vanikam:master \
|
|
|
|
-t libresolutions/vanikam:latest \
|
|
|
|
-t libresolutions/vanikam:0.1.0 .
|
2024-05-13 21:30:15 +05:30
|
|
|
|
|
|
|
docker.publish: docker.build ## Build and publish docker images
|
2024-05-14 23:30:34 +05:30
|
|
|
docker push libresolutions/vanikam:master
|
|
|
|
docker push libresolutions/vanikam:latest
|
|
|
|
docker push libresolutions/vanikam:0.1.0
|
2024-05-13 21:30:15 +05:30
|
|
|
|
|
|
|
|
2024-05-18 20:41:52 +05:30
|
|
|
env: ## Deploy dependencies
|
2024-05-13 21:30:15 +05:30
|
|
|
$(call deploy_dependencies)
|
|
|
|
sleep 5
|
|
|
|
$(call run_migrations)
|
|
|
|
|
2024-05-18 20:41:52 +05:30
|
|
|
env.recreate: ## Deploy dependencies from scratch
|
|
|
|
@-docker-compose -f ./docker-compose-dev-deps.yml \
|
|
|
|
down -v --remove-orphans
|
2024-05-13 21:30:15 +05:30
|
|
|
$(call deploy_dependencies)
|
|
|
|
sleep 5
|
|
|
|
$(call run_migrations)
|
|
|
|
|
|
|
|
lint: ## Lint codebase
|
|
|
|
cargo fmt -v --all -- --emit files
|
|
|
|
cargo clippy --workspace --tests --all-features
|
|
|
|
|
|
|
|
#migrate: ## run migrations
|
|
|
|
# $(call cache_bust)
|
|
|
|
# unset DATABASE_URL && cargo build
|
|
|
|
# DATABASE_URL=${DATABASE_URL} cargo run -- migrate
|
|
|
|
|
|
|
|
release: ## Release build
|
|
|
|
#$(call cache_bust)
|
|
|
|
cargo build --release
|
|
|
|
|
|
|
|
run: default ## Run debug build
|
|
|
|
cargo run -- serve
|
|
|
|
|
|
|
|
#sqlx-offline-data: ## prepare sqlx offline data
|
|
|
|
# cargo sqlx prepare \
|
|
|
|
# --database-url=${DATABASE_URL} -- \
|
|
|
|
# --all-features
|
|
|
|
|
|
|
|
test: ## Run tests
|
|
|
|
#$(call cache_bust)
|
2024-07-11 02:41:27 +05:30
|
|
|
cargo test --all-features --no-fail-fast -- --skip test_server_env_override
|
|
|
|
cargo test --all-features --no-fail-fast -- test_server_env_override
|
2024-05-13 21:30:15 +05:30
|
|
|
|
|
|
|
#test.coverage.xml: ## Generate cobertura.xml test coverage
|
|
|
|
# #$(call cache_bust)
|
|
|
|
# cargo tarpaulin -t 1200 --out Xml
|
|
|
|
#
|
|
|
|
#test.coverage.html: ## Generate HTML code coverage
|
|
|
|
# $(call cache_bust)
|
|
|
|
# cargo tarpaulin -t 1200 --out Html
|
|
|
|
#
|
|
|
|
|
|
|
|
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}'
|