-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
48 lines (39 loc) · 1.17 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
###########
# Testing #
###########
.PHONY: test
test:
@go test ./... -v -race -covermode=atomic -coverprofile=coverage.out
###########
# Linting #
###########
.PHONY: lint-install lint lint-fix
GOLANGCI_VERSION=v1.59.1
# Install golangci-lint if not present
lint-install:
@if ! command -v golangci-lint &> /dev/null; then \
echo "--> golangci-lint is not installed. Installing..."; \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_VERSION}; \
else \
if ! golangci-lint --version | grep -q ${GOLANGCI_VERSION}; then \
echo "--> golangci-lint version is incorrect. Updating..."; \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_VERSION}; \
fi \
fi
# Run golangci-lint on the project
lint:
@$(MAKE) lint-install
@echo "--> Running golangci-lint"
@golangci-lint run
# Run golangci-lint on the project and fix any issues
lint-fix:
@$(MAKE) lint-install
@echo "--> Running golangci-lint"
@golangci-lint run --fix
##############################
# Run GitHub Actions Locally #
##############################
.PHONY: gha-preview
gha-preview:
@echo "--> Running GitHub Actions locally"
@act -P macos-latest=-self-hosted