make: clean up help and add documentaiton

This commit is contained in:
realaravinth
2021-10-08 16:02:35 +05:30
parent 975b6ca57a
commit 46e7656967
2 changed files with 32 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
default: frontend default: frontend ## Run app in debug mode
cargo build cargo run
clean: clean: ## Delete build artifacts
@cargo clean @cargo clean
@yarn cache clean @yarn cache clean
@-rm -rf browser/pkg @-rm -rf browser/pkg
@@ -9,75 +9,60 @@ clean:
@-rm -rf ./static/cache/bundle @-rm -rf ./static/cache/bundle
@-rm -rf ./assets @-rm -rf ./assets
coverage: migrate coverage: migrate ## Generate code coverage report in HTML format
cd browser && cargo tarpaulin -t 1200 --out Html cd browser && cargo tarpaulin -t 1200 --out Html
cargo tarpaulin -t 1200 --out Html cargo tarpaulin -t 1200 --out Html
dev-env: dev-env: ## Setup development environtment
cargo fetch cargo fetch
yarn install yarn install
cd docs/openapi && yarn install cd docs/openapi && yarn install
doc: doc: ## Generate documentation
#yarn doc #yarn doc
cargo doc --no-deps --workspace --all-features cargo doc --no-deps --workspace --all-features
cd browser && cargo doc --no-deps --workspace --all-features cd browser && cargo doc --no-deps --workspace --all-features
docker: docker: ## Build Docker image
docker build -t mcaptcha/mcaptcha:master -t mcaptcha/mcaptcha:latest . docker build -t mcaptcha/mcaptcha:master -t mcaptcha/mcaptcha:latest .
docker-publish: docker-publish: docker ## Build and publish Docker image
docker push mcaptcha/mcaptcha:master docker push mcaptcha/mcaptcha:master
docker push mcaptcha/mcaptcha:latest docker push mcaptcha/mcaptcha:latest
frontend: frontend: ## Build frontend
cd browser && wasm-pack build --release cd browser && wasm-pack build --release
cd docs/openapi/ yarn build cd docs/openapi/ yarn build
yarn install yarn install
yarn build yarn build
frontend-test: frontend-test: ## Run frontend tests
cd browser && wasm-pack test --release --headless --chrome cd browser && wasm-pack test --release --headless --chrome
cd browser && wasm-pack test --release --headless --firefox cd browser && wasm-pack test --release --headless --firefox
cd docs/openapi && yarn test cd docs/openapi && yarn test
cd browser && cargo test cd browser && cargo test
yarn test yarn test
lint: lint: ## Lint codebase
cargo fmt -v --all -- --emit files cargo fmt -v --all -- --emit files
cargo clippy --workspace --tests --all-features cargo clippy --workspace --tests --all-features
yarn lint yarn lint
cd docs/openapi && yarn test cd docs/openapi && yarn test
migrate: migrate: ## Run database migrations
cargo run --bin tests-migrate cargo run --bin tests-migrate
release: frontend release: frontend ## Build app with release optimizations
cargo build --release cargo build --release
run: frontend test: frontend-test frontend ## Run all available tests
cargo run
test: frontend-test frontend
echo 'static/' && tree static || true echo 'static/' && tree static || true
echo 'tree/' && tree assets || true echo 'tree/' && tree assets || true
cargo test --all-features --no-fail-fast cargo test --all-features --no-fail-fast
xml-test-coverage: migrate xml-test-coverage: migrate ## Generate code coverage report in XML format
cd browser && cargo tarpaulin -t 1200 --out Xml cd browser && cargo tarpaulin -t 1200 --out Xml
cargo tarpaulin -t 1200 --out Xml cargo tarpaulin -t 1200 --out Xml
help: help: ## Prints help for targets with comments
@echo ' clean - drop builds and environments' @cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@echo ' coverage - build test coverage in HTML format'
@echo ' dev-env - download dependencies'
@echo ' docker - build docker image'
@echo ' docker-publish - build and publish docker image'
@echo ' doc - build documentation'
@echo ' frontend - build static assets in prod mode'
@echo ' frontend-test - run frontend tests'
@echo ' migrate - run database migrations'
@echo ' run - run developer instance'
@echo ' test - run unit and integration tests'
@echo ' xml-coverage - build test coverage in XML for upload to codecov'
@echo ''

View File

@@ -122,12 +122,19 @@ $ make
```bash ```bash
➜ mcaptcha git:(master) ✗ make help ➜ mcaptcha git:(master) ✗ make help
docs - build documentation default Run app in debug mode
run - run developer instance clean Delete build artifacts
test - run unit and integration tests coverage Generate code coverage report in HTML format
migrate - run database migrations dev-env Setup development environtment
dev-env - download dependencies doc Generate documentation
clean - drop builds and environments docker Build Docker image
coverage - build test coverage in HTML format docker-publish Build and publish Docker image
xml-coverage - build test coverage in XML for upload to codecov frontend Build frontend
frontend-test Run frontend tests
lint Lint codebase
migrate Run database migrations
release Build app with release optimizations
test Run all available tests
xml-test-coverage Generate code coverage report in XML format
help Prints help for targets with comments
``` ```