forked from kkdai/youtube
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (47 loc) · 1.55 KB
/
Makefile
File metadata and controls
57 lines (47 loc) · 1.55 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
55
56
57
FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -name '*.go' -print)
## 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:
@if [ ! -f ./bin/golangci-lint ]; then \
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s $(GOLANGCI_LINT_VERSION); \
fi;
@echo "golangci-lint checking..."
@./bin/golangci-lint run --deadline=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:
@go test -v -cover ./...
## test-integration: Run all Youtube Go integration tests
.PHONY: test-integration
test-integration:
echo 'mode: atomic' > coverage.out
go list ./... | xargs -n1 -I{} sh -c 'go test -race -tags=integration -covermode=atomic -coverprofile=coverage.tmp -coverpkg $(go list ./... | tr "\n" ",") {} && tail -n +2 coverage.tmp >> coverage.out || exit 255'
rm coverage.tmp
## clean: Clean files and downloaded videos from builds during development
.PHONY: clean
clean:
@rm -rf dist *.mp4 *.mkv