-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (54 loc) · 2.18 KB
/
Makefile
File metadata and controls
65 lines (54 loc) · 2.18 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
65
EXEC=gh-md-toc
CMD_SRC=cmd/${EXEC}/main.go
BUILD_DIR=build
E2E_DIR=e2e-tests
E2E_RUN=go run cmd/gh-md-toc/main.go ./README.md
E2E_RUN_RHTML=go run cmd/gh-md-toc/main.go https://github.com/ekalinin/github-markdown-toc.go/blob/master/README.md
E2E_RUN_RMD=go run cmd/gh-md-toc/main.go https://raw.githubusercontent.com/ekalinin/github-markdown-toc.go/master/README.md
bold := $(shell tput bold)
clear := $(shell tput sgr0)
clean:
@rm -f ${EXEC}
@rm -f ${BUILD_DIR}/*
@go clean
lint:
@go vet ./...
@golangci-lint run ./...
# make run ARGS="--help"
run:
@go run ${CMD_SRC} $(ARGS)
build: clean lint
go build -race -o ${EXEC} ${CMD_SRC}
test: clean lint
@go test -cover ./...
test-cover:
@go test -covermode=count -coverprofile .cover.out ./internal/... | sort
@go tool cover -html .cover.out -o .coverage.html
e2e:
@echo "${bold}>> 1. Local MD, with options ...${clear}"
${E2E_RUN} > ${E2E_DIR}/got.md
@diff ${E2E_DIR}/want.md ${E2E_DIR}/got.md
${E2E_RUN} --hide-header --hide-footer --depth=1 --no-escape > ${E2E_DIR}/got2.md
@diff ${E2E_DIR}/want2.md ${E2E_DIR}/got2.md
${E2E_RUN} --hide-header --hide-footer --indent=4 > ${E2E_DIR}/got3.md
@diff ${E2E_DIR}/want3.md ${E2E_DIR}/got3.md
@echo "${bold}>> 2. Remote MD, with options ...${clear}"
${E2E_RUN_RMD} > ${E2E_DIR}/got4.md
@diff ${E2E_DIR}/want.md ${E2E_DIR}/got4.md
${E2E_RUN_RMD} --hide-header --hide-footer --depth=1 --no-escape > ${E2E_DIR}/got5.md
@diff ${E2E_DIR}/want2.md ${E2E_DIR}/got5.md
${E2E_RUN_RMD} --hide-header --hide-footer --indent=4 > ${E2E_DIR}/got6.md
@diff ${E2E_DIR}/want3.md ${E2E_DIR}/got6.md
@echo "${bold}>> 3. Remote HTML, with options ...${clear}"
${E2E_RUN_RHTML} > ${E2E_DIR}/got7.md
@diff ${E2E_DIR}/want.md ${E2E_DIR}/got7.md
${E2E_RUN_RHTML} --hide-header --hide-footer --depth=1 --no-escape > ${E2E_DIR}/got8.md
@diff ${E2E_DIR}/want2.md ${E2E_DIR}/got8.md
${E2E_RUN_RHTML} --hide-header --hide-footer --indent=4 > ${E2E_DIR}/got9.md
@diff ${E2E_DIR}/want3.md ${E2E_DIR}/got9.md
release: test
@git tag v`grep "\tVersion" internal/version/version.go | grep -o -E '[0-9]\.[0-9]\.[0-9]{1,2}'`
@git push --tags origin master
release-local:
@goreleaser check
@goreleaser release --snapshot --clean