-
Notifications
You must be signed in to change notification settings - Fork 434
/
Makefile
57 lines (48 loc) · 1.52 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
53
54
55
56
57
FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -name '*.go' -print)
LOGLEVEL ?= debug
## help: Show makefile commands
.PHONY: help
help: Makefile
@echo "---- Project: kkdai/youtube ----"
@echo " Usage: make COMMAND"
@echo
@echo " Management Commands:"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
## build: Build project
.PHONY: build
build:
goreleaser --rm-dist
## deps: Ensures fresh go.mod and go.sum
.PHONY: deps
deps:
go mod tidy
go mod verify
## lint: Run golangci-lint check
.PHONY: lint
lint:
command -v golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin $(GOLANGCI_LINT_VERSION)
echo "golangci-lint checking..."
golangci-lint run --timeout=30m --enable=misspell --enable=gosec --enable=gofmt --enable=goimports --enable=revive ./cmd/... ./...
go vet ./...
## format: Formats Go code
.PHONY: format
format:
@echo ">> formatting code"
@gofmt -s -w $(FILES_TO_FMT)
## test-unit: Run all Youtube Go unit tests
.PHONY: test-unit
test-unit:
LOGLEVEL=${LOGLEVEL} go test -v -cover ./...
## test-integration: Run all Youtube Go integration tests
.PHONY: test-integration
test-integration:
mkdir -p output
rm -f output/*
LOGLEVEL=${LOGLEVEL} ARTIFACTS=output go test -v -race -covermode=atomic -coverprofile=coverage.out -tags=integration ./...
.PHONY: coverage.out
coverage.out:
## clean: Clean files and downloaded videos from builds during development
.PHONY: clean
clean:
rm -rf dist *.mp4 *.mkv