-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (22 loc) · 835 Bytes
/
Makefile
File metadata and controls
31 lines (22 loc) · 835 Bytes
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
.DEFAULT_GOAL := build
.PHONY: build test test-integration fmt lint fmt-check
BIN_DIR := $(CURDIR)/bin
BIN := $(BIN_DIR)/obsync
CMD := ./cmd/obsync
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
COMMIT := $(shell git rev-parse --short=12 HEAD 2>/dev/null || echo "")
DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -X obsync/internal/cmd.version=$(VERSION) -X obsync/internal/cmd.commit=$(COMMIT) -X obsync/internal/cmd.date=$(DATE)
build:
@mkdir -p $(BIN_DIR)
@go build -ldflags "$(LDFLAGS)" -o $(BIN) $(CMD)
test:
@go test ./...
test-integration:
@go test -tags integration -timeout 120s ./internal/integration/
fmt:
@gofumpt -w . 2>/dev/null || gofmt -w .
lint:
@golangci-lint run || true
fmt-check:
@gofmt -l . | grep -q . && echo "Files need formatting" && exit 1 || true