-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (73 loc) · 2.35 KB
/
Makefile
File metadata and controls
91 lines (73 loc) · 2.35 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
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
# go-workflows Makefile
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
GOFMT=gofmt
GOLINT=golangci-lint
CUSTOM_GOLINT=./custom-gcl
# Test parameters
TEST_TIMEOUT=240s
TEST_FLAGS=-race -count=1 -v
TEST_SHORT_FLAGS=-short $(TEST_FLAGS)
# Build targets
.PHONY: all build clean test test-integration test-redis test-mysql test-postgres test-sqlite test-backends lint fmt
# Default target
all: build test lint
# Build the main project
build:
@echo "Building go-workflows..."
$(GOBUILD) -v ./...
# Run tests with short flag (excludes long-running tests)
test:
@echo "Running tests..."
$(GOTEST) $(TEST_SHORT_FLAGS) -timeout $(TEST_TIMEOUT) ./...
# Run all tests
test-integration:
@echo "Running all tests..."
$(GOTEST) $(TEST_FLAGS) -timeout $(TEST_TIMEOUT) ./...
# Run Redis backend tests
test-redis:
@echo "Running Redis backend tests..."
$(GOTEST) $(TEST_FLAGS) -timeout $(TEST_TIMEOUT) github.com/cschleiden/go-workflows/backend/redis
# Run MySQL backend tests
test-mysql:
@echo "Running MySQL backend tests..."
$(GOTEST) $(TEST_FLAGS) -timeout $(TEST_TIMEOUT) github.com/cschleiden/go-workflows/backend/mysql
# Run Postgres backend tests
test-postgres:
@echo "Running Postgres backend tests..."
$(GOTEST) $(TEST_FLAGS) -timeout $(TEST_TIMEOUT) github.com/cschleiden/go-workflows/backend/postgres
# Run SQLite backend tests
test-sqlite:
@echo "Running SQLite backend tests..."
$(GOTEST) $(TEST_FLAGS) -timeout $(TEST_TIMEOUT) github.com/cschleiden/go-workflows/backend/sqlite
# Run monoprocess backend tests
test-monoprocess:
@echo "Running monoprocess backend tests..."
$(GOTEST) $(TEST_FLAGS) -timeout $(TEST_TIMEOUT) github.com/cschleiden/go-workflows/backend/monoprocess
# Run all backend tests
test-backends: test-redis test-mysql test-postgres test-sqlite test-monoprocess
custom-gcl:
@echo "Checking if golangci-lint is installed..."
@which $(GOLINT) > /dev/null || (echo "golangci-lint is not installed. Please install it first." && exit 1)
@echo "Building custom linter plugin..."
$(GOLINT) custom
# Lint the code
lint: custom-gcl
@echo "Running linter..."
$(CUSTOM_GOLINT) run
# Format the code
fmt:
@echo "Formatting code..."
$(GOFMT) -s -w .
# Clean build artifacts
clean:
@echo "Cleaning..."
$(GOCLEAN)
rm -f coverage.out coverage.html
rm -f *.sqlite
rm -f report.xml