-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (42 loc) · 1.25 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
#!/usr/bin/env bash
## Fixes a linker bug on MacOS, see https://github.com/golang/go/issues/61229#issuecomment-1954706803
## Forces the old Apple linker.
ifeq ($(shell uname),Darwin)
DARWIN_TEST_GOFLAGS=-ldflags=-extldflags=-Wl,-ld_classic
endif
GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
all: help
.PHONY: help
help: Makefile
@echo "Available commands:"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
.PHONY: fmt
## fmt: Formats the Go code.
fmt:
go fmt ./...
.PHONY: lint
## lint: Runs golangci-lint run
lint:
golangci-lint run --timeout=5m
.PHONY: build-bandersnatch
## build-bandersnatch: Builds the bandersnatch library
build-bandersnatch:
cargo build --release --lib --manifest-path=bandersnatch/Cargo.toml
.PHONY: test
## test: Runs unit tests.
test: build-bandersnatch
go test ./... -race -v $(DARWIN_TEST_GOFLAGS)
.PHONY: integration
## integration: Runs integration tests.
integration:
go test ./tests/... -race -v $(DARWIN_TEST_GOFLAGS) --tags=integration
## install-hooks: Install git-hooks from .githooks directory.
.PHONY: install-hooks
install-hooks:
git config core.hooksPath .githooks
.PHONY: build
build: build-bandersnatch
GOOS=${GOOS} GOARCH=${GOARCH} go build -o strawberry ./cmd/strawberry