Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (54 loc) · 2.09 KB
/
Copy pathMakefile
File metadata and controls
64 lines (54 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
VENV_NAME = harlequin
VENV = $(shell conda info --base)/envs/$(VENV_NAME)/bin/
.PHONY: help
help: ## Show the help.
@echo "Usage: make <target>"
@echo ""
@echo "Targets:"
@grep -F "##" Makefile | grep -F -v fgrep
.PHONY: fmt
fmt: ## Format code using black & isort.
@$(VENV)isort harlequin/
@$(VENV)black harlequin/
.PHONY: test
test: ## Run tests.
$(VENV)pytest -v -l --tb=short --maxfail=1 tests/
.PHONY: test-cov
test-cov: ## Run tests and generate coverage report.
$(VENV)pytest -v --cov-config .coveragerc --cov=harlequin -l --tb=short --maxfail=1 tests/
$(VENV)coverage html
.PHONY: virtualenv
virtualenv: ## Create a virtual environment.
@echo "creating virtualenv ..."
@conda create -n $(VENV_NAME) python=3.10 -y
.PHONY: install
install: ## Install dependencies.
@echo "installing dependencies ..."
@$(VENV)pip install -r requirements.txt
@$(VENV)pip install -r requirements.dev.txt
.PHONY: precommit-install
precommit-install: ## Install pre-commit hooks.
@echo "installing pre-commit hooks ..."
@$(VENV)pre-commit install
.PHONY: precommit-uninstall
precommit-uninstall: ## Uninstall pre-commit hooks.
@echo "uninstalling pre-commit hooks ..."
@$(VENV)pre-commit uninstall
.PHONY: release
.ONESHELL:
release: ## Create a new tag for release.
@echo "WARNING: This operation will create a version tag and push to github"
@read -p "Version? (provide the next X.Y.Z semver) : " TAG
@echo "$${TAG}" > harlequin/VERSION
@$(VENV)gitchangelog > HISTORY.md
@sed -i -E "/version/s/.*/version = \"$${TAG}\"/" pyproject.toml
@read -p "Create commit and tag? [y/N] " CONFIRM1
@if [ "$${CONFIRM1}" != "y" ]; then echo "Aborted"; exit; fi
@git add harlequin/VERSION HISTORY.md pyproject.toml
@git commit -m "release: v$${TAG}"
@echo "creating git tag : v$${TAG}"
@git tag v$${TAG}
@read -p "Push to origin? [y/N] " CONFIRM2
@if [ "$${CONFIRM2}" != "y" ]; then echo "Aborted"; exit; fi
@git push -u origin HEAD --tags
@echo "Github Actions will detect the new tag and release the new version."