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
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
2 changed files with 32 additions and 40 deletions

View file

@ -1,7 +1,7 @@
default: frontend
cargo build
default: frontend ## Run app in debug mode
cargo run
clean:
clean: ## Delete build artifacts
@cargo clean
@yarn cache clean
@-rm -rf browser/pkg
@ -9,75 +9,60 @@ clean:
@-rm -rf ./static/cache/bundle
@-rm -rf ./assets
coverage: migrate
coverage: migrate ## Generate code coverage report in HTML format
cd browser && cargo tarpaulin -t 1200 --out Html
cargo tarpaulin -t 1200 --out Html
dev-env:
dev-env: ## Setup development environtment
cargo fetch
yarn install
cd docs/openapi && yarn install
doc:
doc: ## Generate documentation
#yarn doc
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-publish:
docker-publish: docker ## Build and publish Docker image
docker push mcaptcha/mcaptcha:master
docker push mcaptcha/mcaptcha:latest
frontend:
frontend: ## Build frontend
cd browser && wasm-pack build --release
cd docs/openapi/ yarn build
yarn install
yarn build
frontend-test:
frontend-test: ## Run frontend tests
cd browser && wasm-pack test --release --headless --chrome
cd browser && wasm-pack test --release --headless --firefox
cd docs/openapi && yarn test
cd browser && cargo test
yarn test
lint:
lint: ## Lint codebase
cargo fmt -v --all -- --emit files
cargo clippy --workspace --tests --all-features
yarn lint
cd docs/openapi && yarn test
migrate:
migrate: ## Run database migrations
cargo run --bin tests-migrate
release: frontend
release: frontend ## Build app with release optimizations
cargo build --release
run: frontend
cargo run
test: frontend-test frontend
test: frontend-test frontend ## Run all available tests
echo 'static/' && tree static || true
echo 'tree/' && tree assets || true
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
cargo tarpaulin -t 1200 --out Xml
help:
@echo ' clean - drop builds and environments'
@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 ''
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}'

View file

@ -122,12 +122,19 @@ $ make
```bash
➜ mcaptcha git:(master) ✗ make help
docs - build documentation
run - run developer instance
test - run unit and integration tests
migrate - run database migrations
dev-env - download dependencies
clean - drop builds and environments
coverage - build test coverage in HTML format
xml-coverage - build test coverage in XML for upload to codecov
default Run app in debug mode
clean Delete build artifacts
coverage Generate code coverage report in HTML format
dev-env Setup development environtment
doc Generate documentation
docker Build Docker image
docker-publish Build and publish Docker image
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
```