Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (41 loc) · 1.6 KB
/
Copy pathMakefile
File metadata and controls
51 lines (41 loc) · 1.6 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
#!/usr/bin/make -f
export GOBIN ?= $(shell pwd)/bin
BINARY=xk6-neofs
XK6_VERSION=1.3.5
PYTHON ?= python3
VENV ?= .venv
PRESET_REQUIREMENTS = scenarios/preset/requirements.txt
VERSION ?= $(shell git describe --tags --match "v*" --abbrev=8 2>/dev/null | sed -r 's,^v([0-9]+\.[0-9]+)\.([0-9]+)(-.*)?$$,\1 \2 \3,' | while read mm patch suffix; do if [ -z "$$suffix" ]; then echo $$mm.$$patch; else patch=`expr $$patch + 1`; echo $$mm.$${patch}-pre$$suffix; fi; done)
LDFLAGS:=-s -w -X 'go.k6.io/k6/lib/consts.VersionDetails=xk6-neofs-$(VERSION)'
.PHONY: build install_xk6 install_preset test lint format modernize
# Build xk6-neofs binary
build: install_xk6
@echo "=> Building binary"
$(GOBIN)/xk6 build --build-flags="-ldflags=$(LDFLAGS)" -v --with github.com/nspcc-dev/xk6-neofs=. --output $(BINARY)
# Install required utils
install_xk6:
@echo "=> Installing utils"
@go install go.k6.io/xk6/cmd/xk6@v$(XK6_VERSION)
# Install Python dependencies used by scenarios/preset into a local venv
install_preset:
@echo "=> Installing preset Python dependencies"
$(PYTHON) -m venv $(VENV)
$(VENV)/bin/python -m pip install -r $(PRESET_REQUIREMENTS)
# Run tests
test:
@go test ./... -cover
.golangci.yml:
wget -O $@ https://github.com/nspcc-dev/.github/raw/master/.golangci.yml
# Run linters
lint: .golangci.yml
@golangci-lint --timeout=5m run
# Reformat code
format:
@echo "⇒ Processing gofmt check"
@gofmt -s -w ./
@echo "⇒ Processing goimports check"
@goimports -w ./
# Prettify code
modernize:
@echo "⇒ Processing modernize check"
@go run golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest -fix ./...