-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removing Makefile's ci-like-lint target
- Loading branch information
1 parent
93e82b7
commit 44e1e63
Showing
3 changed files
with
34 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,45 @@ | ||
MAKEFLAGS += --silent | ||
GOLANGCI_LINT_VERSION = $(shell head -n 1 .golangci.yml | tr -d '\# ') | ||
TMPDIR ?= /tmp | ||
|
||
all: build | ||
all: clean format test build | ||
|
||
build : | ||
## build: Builds the 'k6' binary. | ||
build: | ||
go build | ||
|
||
format : | ||
## format: Applies Go formatting to code. | ||
format: | ||
find . -name '*.go' -exec gofmt -s -w {} + | ||
|
||
ci-like-lint : | ||
@docker run --rm -t -v $(shell pwd):/app \ | ||
-v $(TMPDIR)/golangci-cache-$(GOLANGCI_LINT_VERSION):/golangci-cache \ | ||
--env "GOLANGCI_LINT_CACHE=/golangci-cache" \ | ||
-w /app golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) \ | ||
make lint | ||
## check-linter-version: Checks if the linter version is the same as the one specified in the linter config. | ||
check-linter-version: | ||
(golangci-lint version | grep "version $(shell head -n 1 .golangci.yml | tr -d '\# ')") || echo "Your installation of golangci-lint is different from the one that is specified in k6's linter config (there it's $(shell head -n 1 .golangci.yml | tr -d '\# ')). Results could be different in the CI." | ||
|
||
lint : | ||
## lint: Runs the linters. | ||
lint: check-linter-version | ||
echo "Running linters..." | ||
golangci-lint run --out-format=tab --new-from-rev master ./... | ||
|
||
tests : | ||
## tests: Executes any unit tests. | ||
tests: | ||
go test -race -timeout 210s ./... | ||
|
||
check : ci-like-lint tests | ||
|
||
.PHONY: build format ci-like-lint lint tests check | ||
## check: Runs the linters and tests. | ||
check: lint tests | ||
|
||
## help: Prints a list of available build targets. | ||
help: | ||
echo "Usage: make <OPTIONS> ... <TARGETS>" | ||
echo "" | ||
echo "Available targets are:" | ||
echo '' | ||
sed -n 's/^##//p' ${PWD}/Makefile | column -t -s ':' | sed -e 's/^/ /' | ||
echo | ||
echo "Targets run by default are: `sed -n 's/^all: //p' ./Makefile | sed -e 's/ /, /g' | sed -e 's/\(.*\), /\1, and /'`" | ||
|
||
## clean: Removes any previously created build artifacts. | ||
clean: | ||
@echo "cleaning" | ||
rm -f ./k6 | ||
|
||
.PHONY: build format lint tests check check-linter-version help |