-
Notifications
You must be signed in to change notification settings - Fork 50
/
Makefile
68 lines (55 loc) · 1.6 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
.PHONY: lint build clean test help format staticcheck pre-commit
GOPATH_DIR :=`go env GOPATH`
BINARY_DIR := bin
BINARY_NAME := cairo-vm
TEST := "."
default: help
help:
@echo "This makefile allows the following commands"
@echo " make build - compile the source code"
@echo " make clean - remove binary files"
@echo " make unit - run unit tests"
@echo " make integration - run integration tests"
@echo " make testall - run all tests"
@echo " make bench - benchmark all tests"
@echo " make help - show this help message"
build:
@echo "Building..."
@mkdir -p $(BINARY_DIR)
@go build -o $(BINARY_DIR)/$(BINARY_NAME) cmd/cli/main.go
@if [ $$? -eq 0 ]; then \
echo "Build completed succesfully!"; \
else \
echo "Build failed."; \
exit 1; \
fi
clean:
@echo "Cleaning up..."
@rm -rf $(BINARY_DIR)
unit:
@echo "Running unit tests..."
@go test ./pkg/...
integration:
@echo "Running integration tests..."
@$(MAKE) build
@if [ $$? -eq 0 ]; then \
go test ./integration_tests/... -v; \
else \
echo "Integration tests were not run"; \
exit 1; \
fi
testall:
@echo "Running all tests..."
@$(MAKE) build
@go test ./...
bench:
@echo "Running benchmarks..."
@go run scripts/benchmark.go --pkg=${PKG_NAME} --test=${TEST}
zerobench:
@echo "Running integration benchmarks..."
@go test integration_tests/cairozero_test.go -v -zerobench;
# Use the same version of the golangci-lint as in our CI linting config.
lint:
go install github.com/golangci/golangci-lint/cmd/[email protected]
golangci-lint run ./... -v
@echo "lint: all good!"