-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (73 loc) · 2.13 KB
/
Makefile
File metadata and controls
88 lines (73 loc) · 2.13 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
GO := go
PKG_NAME := gopherciser
BIN_NAME := gopherciser
PREFIX := .
BIN := build
OSFLAG :=
ifeq ($(OS),Windows_NT)
OSFLAG += $(BIN)/$(BIN_NAME).exe
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_M),aarch64)
OSFLAG += ./$(BIN)/$(BIN_NAME)_arm64
else
OSFLAG += ./$(BIN)/$(BIN_NAME)
endif
endif
ifeq ($(UNAME_S),Darwin)
OSFLAG += ./$(BIN)/$(BIN_NAME)_osx
endif
endif
.PHONY: clean build lint test alltests initwiki genwiki build-docker attribution changelog
# 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
# Clear and clean folder
clean:
./scripts/clean.sh $(PREFIX) $(BIN)
# Build documentation
docbuild:
cp ./docs/Readme.txt ./build/Readme.txt
# 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:
go build -mod=readonly -o $(OSFLAG)
# Run standard tests
test:
go test -race -mod=readonly ./...
# Run all tests with verbose output
alltests:
set -eu
go test -race -mod=readonly -v ./... -count=1 -cover -coverprofile=coverage.csv
go tool cover -html=coverage.csv -o coverage.html
# Run quickbuild test and linting. Good to run e.g. before pushing to remote
verify: quickbuild test lint-min
# init submodule and get latest version
initwiki:
git submodule update --init --recursive --remote
git submodule foreach --recursive git checkout master
git submodule foreach --recursive git pull
# generate config and action documenation
genwiki: initwiki
set -e
go generate
go run ./generatedocs/cmd/generatemarkdown $(PARAM) --wiki ./gopherciser.wiki
# build docker image
build-docker:
DOCKERBUILD=y ./scripts/build.sh $(PREFIX) $(BIN) $(BIN_NAME)
# Generate licences.txt
attribution:
go install github.com/google/go-licenses@latest
./scripts/createattribution.sh
# Generate changelog
changelog:
./scripts/generateChangeLog.sh changelog.md