-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
119 lines (90 loc) · 2.67 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
MAKEFLAGS += --warn-undefined-variables
SHELL := /bin/bash -o pipefail
CONTAINER_ENGINE ?= docker
CONTAINER_REPO ?= "a3s"
CONTAINER_IMAGE ?= "a3s"
CONTAINER_TAG ?= "dev"
export GO111MODULE = on
default: lint vuln test a3s cli
.PHONY: ui docker
## Tests
lint:
golangci-lint run \
--timeout=5m \
--disable-all \
--exclude-use-default=false \
--exclude=dot-imports \
--exclude=package-comments \
--exclude=unused-parameter \
--exclude=dot-imports \
--enable=errcheck \
--enable=goimports \
--enable=ineffassign \
--enable=revive \
--enable=unused \
--enable=staticcheck \
--enable=unconvert \
--enable=misspell \
--enable=prealloc \
--enable=nakedret \
--enable=typecheck \
--enable=unparam \
--enable=gosimple \
--enable=nilerr \
./...
test:
go test ./... -race -cover -covermode=atomic -coverprofile=unit_coverage.out
sec:
gosec -quiet ./...
vuln:
govulncheck ./...
update-deps:
go get -u go.aporeto.io/tg@master
go get -u go.aporeto.io/bahamut@master
go get -u go.aporeto.io/manipulate@master
go get -u go.aporeto.io/elemental@master
go get -u github.com/nats-io/nats-server/v2@latest
go get -u github.com/smartystreets/goconvey@latest
go get -u github.com/spf13/viper@latest
go get -u github.com/spf13/cobra@latest
go get -u github.com/spf13/pflag@latest
go get -u golang.org/x/term@latest
go get -u go.uber.org/zap@latest
go get -u github.com/golang-jwt/jwt/v4
go mod tidy
## Code generation
generate:
go generate ./...
api:
cd pkgs/api && make codegen
ui:
cd internal/ui/js/login && yarn && yarn build
codegen: api ui generate
## Main build
a3s:
cd cmd/a3s && CGO_ENABLED=0 go build -ldflags="-w -s" -trimpath
a3s_linux:
cd cmd/a3s && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -trimpath
cli:
cd cmd/a3sctl && CGO_ENABLED=0 go install -ldflags="-w -s" -trimpath
cli_linux:
cd cmd/a3sctl && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install -ldflags="-w -s" -trimpath
## Containers
docker:
CONTAINER_ENGINE=docker make container
podman:
CONTAINER_ENGINE=podman make container
container: codegen generate a3s_linux package_ca_certs
mkdir -p docker/in
cp cmd/a3s/a3s docker/in
cd docker && ${CONTAINER_ENGINE} build -t ${CONTAINER_REPO}/${CONTAINER_IMAGE}:${CONTAINER_TAG} .
package_ca_certs:
mkdir -p docker/in
go install github.com/agl/extract-nss-root-certs@latest
curl -s https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt -o certdata.txt
mkdir -p docker/in
extract-nss-root-certs > docker/in/ca-certificates.pem
rm -f certdata.txt
# tag the commit, set GITHUB_TOKEN, then run...
release:
unset GITLAB_TOKEN && goreleaser check && goreleaser release --clean