build: introduce conventional commits, ref NOISSUE

This commit is contained in:
2024-11-30 21:22:54 +01:00
parent 9183a5bd58
commit 980cd38f8e
5 changed files with 215 additions and 10 deletions

View File

@@ -1,5 +1,13 @@
.ONESHELL:
.PHONY: issetup
issetup:
@[ -f .git/hooks/commit-msg ] || (echo "You must run 'make setup' first to initialize the repo!" && exit 1)
.PHONY: setup
setup:
@cp .gitea/conventional_commits/commit-msg .git/hooks/
.PHONY: help
help: ## Show the help.
@echo "Usage: make <target>"
@@ -8,35 +16,35 @@ help: ## Show the help.
@fgrep "##" Makefile | fgrep -v fgrep
.PHONY: buildrel
buildrel: ## Format code.
buildrel: issetup ## Format code.
dotnet build -c Release project_name.sln
.PHONY: build
build: ## Format code.
build: issetup ## Format code.
dotnet build project_name.sln
.PHONY: publish
publish: ## Format code.
publish: issetup ## Format code.
dotnet publish -c Release project_name.sln
.PHONY: fmt
fmt: ## Format code.
fmt: issetup ## Format code.
dotnet format project_name.sln
.PHONY: lint
lint: ## Lint code.
lint: issetup ## Lint code.
dotnet format --verify-no-changes --verbosity diagnostic project_name.sln
.PHONY: test
test: ## Run tests and generate coverage report.
test: issetup ## Run tests and generate coverage report.
dotnet test project_name.sln
.PHONY: clean
clean: ## Clean unused files.
clean: issetup ## Clean unused files.
dotnet clean project_name.sln
.PHONY: release
release: ## Create a new tag for release.
release: issetup ## Create a new tag for release.
@echo "WARNING: This operation will create a version tag and push to gitea"
@read -p "Version? (provide the next x.y.z semver) : " TAG; echo "$$TAG" > project_name/VERSION
@gitchangelog > HISTORY.md
@@ -48,7 +56,7 @@ release: ## Create a new tag for release.
@echo "Gitea Actions will detect the new tag and release the new version."
.PHONY: docs
docs: ## Build the documentation.
docs: issetup ## Build the documentation.
@echo "building documentation ..."
@mkdocs build
URL="site/index.html"; xdg-open $$URL || sensible-browser $$URL || x-www-browser $$URL || gnome-open $$URL || open $$URL