-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
65 lines (53 loc) · 1.63 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
GO := go
PKG_NAME := gopherciser
BIN_NAME := gopherciser
PREFIX := .
TEST_REPORTS := $(PREFIX)/.cover
BIN := build
OSFLAG :=
ifeq ($(OS),Windows_NT)
OSFLAG += $(BIN)/$(BIN_NAME).exe
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OSFLAG += ./$(BIN)/$(BIN_NAME)
endif
ifeq ($(UNAME_S),Darwin)
OSFLAG += ./$(BIN)/$(BIN_NAME)_osx
endif
endif
.PHONY: clean build unit-test-cover unit-test-cover-ext codeclimate lint test alltests
# Compile Go packages
build: clean
./scripts/build.sh $(PREFIX) $(BIN) $(BIN_NAME)
$(OSFLAG) version
# Lint the code
lint:
./scripts/lint.sh
# Minimum level of linting for PR's to be accepted
lint-min:
./scripts/lint.sh MIN
# Unit test and coverage
unit-test-cover: clean
./scripts/unit-test-cover.sh $(TEST_REPORTS) $(BIN_NAME)
# Unit test and cover extended, creates html file for viewing: ${TEST_REPORTS}/c.html
unit-test-cover-ext: unit-test-cover
./scripts/unit-test-cover-ext.sh $(TEST_REPORTS)
# Clear and clean folder
clean:
./scripts/clean.sh $(PREFIX) $(BIN) $(TEST_REPORTS)
# Build documentation
docbuild:
./scripts/docbuild.sh $(BIN)
# Build for current platform only, does not clean, does not do full rebuild, does not create folders, does not set the version nor strip DWARF tables etc.
# Meant to be used during development only
quickbuild:
GO111MODULE=on go build -mod=readonly -o $(OSFLAG)
# Run standard tests
test:
GO111MODULE=on go test -race -mod=readonly ./...
# Run all tests with verbose output
alltests:
GO111MODULE=on go test -race -mod=readonly -v ./... -count=1
# Run quickbuild test and linting. Good to run e.g. before pushing to remote
verify: quickbuild test lint-min