forked from canonical/microcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (43 loc) · 1.18 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
GOMIN=1.22.4
.PHONY: default
default: build
# Build targets.
.PHONY: build
build:
go install -tags=agent -v ./cmd/microcloud
go install -tags=agent -v ./cmd/microcloudd
# Testing targets.
.PHONY: check
check: check-static check-unit check-system
.PHONY: check-unit
check-unit:
go test ./...
.PHONY: check-system
check-system:
cd test && ./main.sh
.PHONY: check-static
check-static:
ifeq ($(shell command -v golangci-lint 2> /dev/null),)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$HOME/go/bin
endif
ifeq ($(shell command -v revive 2> /dev/null),)
go install github.com/mgechev/revive@latest
endif
golangci-lint run --timeout 5m
revive -config revive.toml -exclude ./cmd/... -set_exit_status ./...
run-parts --exit-on-error --regex '.sh' test/lint
# Update targets.
.PHONY: update-gomod
update-gomod:
go get -u ./...
go mod tidy -go=$(GOMIN)
# Update lxd-generate generated database helpers.
.PHONY: update-schema
update-schema:
go generate ./...
gofmt -s -w ./database/
goimports -w ./database/
@echo "Code generation completed"
doc-%:
cd doc && $(MAKE) -f Makefile.sp sp-$* ALLFILES='*.md **/*.md'
doc: doc-clean-doc doc-html