-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (47 loc) · 1.41 KB
/
Makefile
File metadata and controls
54 lines (47 loc) · 1.41 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
LOCAL_BIN := $(CURDIR)/bin
GOLANGCI_BIN := $(LOCAL_BIN)/golangci-lint
GOLANGCI_TAG=1.61.0
GO_TEST=$(LOCAL_BIN)/gotest
GO_TEST_ARGS="-race -v ./..."
# Выполнить полный цикл
all: lint test
# Устанавливает зависимости для использования
.PHONY: install-deps
install-deps:
echo 'Installing dependencies...'
tmp=$$(mktemp -d) && cd $$tmp && pwd && go mod init temp && \
GOBIN=$(LOCAL_BIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$(GOLANGCI_TAG) && \
GOBIN=$(LOCAL_BIN) go install github.com/rakyll/gotest@v0.0.6 && \
rm -fr $$tmp
# Запускает линтер по файлам
.PHONY: lint
lint: install-deps
echo 'Running linter on files...'
$(GOLANGCI_BIN) run \
--new-from-rev=origin/main \
--config=.golangci.yaml \
--sort-results \
--max-issues-per-linter=0 \
--max-same-issues=0
# Прогоняет все тесты
.PHONY: test
test: install-deps
echo 'Running tests...'
${GO_TEST} "${GO_TEST_ARGS}"
# Обновить репозиторий
.PHONY: update
update:
ifeq (-n $(git status --untracked-files=no --porcelain),)
@echo 'You have some changes. Please commit, checkout or stash them.'
@exit 1
endif
@echo 'Updating repository to latest main...'
# Обновляем main
git checkout main
git pull --all
# Обновляем hw
git checkout hw
git pull --all
git rebase main
git push -f
@echo 'Successfully updated'