-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (46 loc) · 1.1 KB
/
Makefile
File metadata and controls
63 lines (46 loc) · 1.1 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
.PHONY: build run test test-integration clean docker lint lint-fix fmt fmt-diff
BINARY_NAME=awsim
VERSION?=$(shell grep 'const Version' version.go | cut -d'"' -f2)
BUILD_DIR=bin
GOLANGCI_LINT=go tool -modfile tools/go.mod golangci-lint
# Build
build:
go build -ldflags "-X main.version=$(VERSION)" -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/awsim
run:
go run ./cmd/awsim
# Test
test:
go test -v -race ./...
test-cover:
go test -v -race -coverprofile=coverage.out -coverpkg=./... ./...
go tool cover -html=coverage.out -o coverage.html
test-integration:
go test -C test -v -tags=integration ./integration/...
# Lint
lint:
$(GOLANGCI_LINT) run ./...
lint-fix:
$(GOLANGCI_LINT) run --fix ./...
fmt:
$(GOLANGCI_LINT) fmt ./...
fmt-diff:
$(GOLANGCI_LINT) fmt ./... --diff
# Docker
docker:
docker build -t awsim:$(VERSION) -f docker/Dockerfile .
docker-run:
docker run -p 4566:4566 awsim:$(VERSION)
compose-up:
docker compose up -d
compose-down:
docker compose down
# Clean
clean:
rm -rf $(BUILD_DIR)
rm -f coverage.out coverage.html
# Tools
tools:
cd tools && go mod tidy
# Go mod
mod:
go mod tidy