-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
66 lines (51 loc) · 1.55 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
.PHONY: all build test lint clean deps devel-deps installer
BIN := qiisync
BUILD_LDFLAGS := "-s -w"
GOBIN ?= $(shell go env GOPATH)/bin
GOLANGCILINT_VERSION := 1.35.2
export GO111MODULE=on
repo_name := d-tsuji/qiisync
current_dir := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
all: clean build
deps:
go mod tidy
devel-deps: deps
sh -c '\
tmpdir=$$(mktemp -d); \
cd $$tmpdir; \
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v${GOLANGCILINT_VERSION}; \
rm -rf $$tmpdir'
build:
go build -ldflags=$(BUILD_LDFLAGS) -o $(BIN) ./cmd/qiisync
test: deps
go test -v -count=1 ./...
test-cover: deps
go test -v -count=1 ./... -cover -coverprofile=c.out
go tool cover -html=c.out -o coverage.html
lint: devel-deps
go vet ./...
golangci-lint run --config .golangci.yml
clean:
rm -rf $(BIN)
go clean
installer:
sh -c '\
tmpdir=$$(mktemp -d); \
cd $$tmpdir; \
# Build from source, because "go get github.com/goreleaser/godownloader" will result in an error; \
git clone --depth 1 https://github.com/goreleaser/godownloader && cd godownloader; \
go run . -f -r ${repo_name} -o ${current_dir}/install.sh; \
rm -rf $$tmpdir'
################################
#### For E2E Testing
################################
.PHONY: pull pull-only post update
pull: clean build
rm -rf testdata/output/pull
./$(BIN) pull
pull-only: clean build
./$(BIN) pull
post: clean build
./$(BIN) post ./testdata/qiita/post/test_article.md
update: clean build
./$(BIN) update ./testdata/output/pull/20200424/hoge.md