feat: Makefile with common workflows

This commit is contained in:
Aravinth Manivannan 2023-07-04 19:08:58 +05:30
parent 148f1cb70d
commit 080ecceabd
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
3 changed files with 46 additions and 1 deletions

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
/target /target
**/*.rs.bk **/*.rs.bk
Cargo.locktarpaulin-report.html Cargo.locktarpaulin-report.html
cobertura.xml
tarpaulin-report.html

43
Makefile Normal file
View file

@ -0,0 +1,43 @@
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
define test_core
cargo test --no-fail-fast
endef
default: ## Build library in debug mode
cargo build
check: ## Check for syntax errors on all workspaces
cargo check --workspace --tests --all-features
clean: ## Delete build artifacts
@cargo clean
doc: ## Generate documentation
cargo doc --no-deps --workspace --all-features
env: ## Setup development environtment
cargo fetch
lint: ## Lint codebase
cargo fmt -v --all -- --emit files
cargo clippy --workspace --tests --all-features
release: ## Build library with release optimizations
cargo build --release
test: ## Run all available tests
$(call test_core)
test.cov.html: ## Generate code coverage report in HTML format
cargo tarpaulin -t 1200 --out Html
test.cov.xml: ## Generate code coverage report in XML format
cargo tarpaulin -t 1200 --out Xml
test.core: ## Run all core tests
$(call test_core)
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

@ -25,7 +25,7 @@ use std::marker::PhantomData;
use derive_builder::Builder; use derive_builder::Builder;
//use num::Num; //use num::Num;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sha2::{Digest, digest::Update, Sha256}; use sha2::{digest::Update, Digest, Sha256};
/// Proof of Work over concrete type T. T can be any type that implements serde::Serialize. /// Proof of Work over concrete type T. T can be any type that implements serde::Serialize.
#[derive(Serialize, Builder, Deserialize, PartialEq, Clone, Debug)] #[derive(Serialize, Builder, Deserialize, PartialEq, Clone, Debug)]