This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
95 lines (88 loc) · 2.57 KB
/
makefile
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.PHONY: test
test:
# Set up variables.
$(eval STD_OUT_LOG := ./zdevelop/tests/_reports/test_stdout.txt)
$(eval STD_ERR_LOG := ./zdevelop/tests/_reports/test_stderr.txt)
$(eval COVERAGE_LOG := ./zdevelop/tests/_reports/coverage.out)
$(eval TEST_REPORT := ./zdevelop/tests/_reports/test_report.html)
$(eval COVERAGE_REPORT := ./zdevelop/tests/_reports/coverage.html)
# Clear the output files.
echo > $(STD_OUT_LOG)
echo > $(STD_ERR_LOG)
# Run tests. I honestly don't quite understand the piping bullshit that has to
# happen here so we can send both stdout and stderr to tee separately (so we can
# both save and display them, but the internet says this is the solution and it
# works.
-(\
go test \
-v \
-failfast \
-covermode=count \
-coverprofile=$(COVERAGE_LOG) \
-coverpkg=./... \
./... \
--minimum-coverage=0.85 \
| tee "$(STD_OUT_LOG)" \
) 3>&1 1>&2 2>&3 \
| tee "$(STD_ERR_LOG)"
# Build Reports
-go tool cover -html=$(COVERAGE_LOG)
-go-test-html "$(STD_OUT_LOG)" "$(STD_ERR_LOG)" "$(TEST_REPORT)"
# Open Reports
-open "$(TEST_REPORT)"
.PHONY: lint
lint:
-revive -config revive.toml ./...
.PHONY: format
format:
-gofmt -s -w ./
-gofmt -s -w ./zdevelop/tests
.PHONY: venv
venv:
ifeq ($(py), )
$(eval PY_PATH := python3)
else
$(eval PY_PATH := $(py))
endif
$(eval VENV_PATH := $(shell $(PY_PATH) ./zdevelop/make_scripts/make_venv.py))
@echo "venv created! To enter virtual env, run:"
@echo ". ~/.bash_profile"
@echo "then run:"
@echo "$(VENV_PATH)"
.PHONY: install-dev
install-dev:
pip install --upgrade pip
pip install --no-cache-dir -e .[build,doc]
# Installs command line tools into global GOPATH.
.PHONY: install-globals
install-globals:
$(eval CURRENT_DIR := $(shell pwd))
cd ~/
# Creates html report of tests.
-go get -u github.com/ains/go-test-html
# Creates API doc server.
-go get -u golang.org/x/tools/cmd/godoc
# Downloads module APIs from API server.
-go get -u github.com/illuscio-dev/docmodule-go
# swap back to the current directory.
cd $(current_dir)
# Creates docs.
.PHONY: doc
doc:
rm -rf ./zdocs/build
mkdir ./zdocs/build
# Rip API docs from godoc. This tools spins up a godoc server and downloads
# module docs
docmodule-go
python setup.py build_sphinx -E
sleep 1
open ./zdocs/build/html/index.html
# Remove Deleted files from git
git add -u
# Add any new files to git
git add zdocs/*
.PHONY: name
name:
$(eval PATH_NEW := $(shell python3 ./zdevelop/make_scripts/make_name.py $(n)))
@echo "library renamed! to switch your current directory, use the following \
command:\ncd '$(PATH_NEW)'"