-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
55 lines (44 loc) · 1.03 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
.PHONY: all clean build
# Install golangci-lint if it doesn't exist
.PHONY: download-golangci-lint
download-golangci-lint:
ifeq (,$(wildcard ./bin/golangci-lint))
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.64.5
endif
# Install air if it doesn't exist
.PHONY: download-air
download-air:
ifeq (,$(wildcard ./bin/air))
curl -sSfL https://raw.githubusercontent.com/air-verse/air/master/install.sh | sh -s
endif
# Download missing modules
.PHONY: tidy
tidy:
go mod tidy
# Run go fmt
.PHONY: fmt
fmt:
go fmt ./...
# Run linting
.PHONY: lint
lint: download-golangci-lint tidy fmt
./bin/golangci-lint run
# Run full test
.PHONY: test
test: lint
go test -v ./...
# Run air for test on save
.PHONY: air
air: download-golangci-lint download-air
./bin/air
# Build everything
all: clean fmt test build
# Clean build artifacts
clean:
rm -f ./cmd/mule/bin/mule
# Build backend
build:
cd cmd/mule && CGO_ENABLED=0 GOOS=linux go build -o bin/mule
# Run the application
run: all
./cmd/mule/bin/mule