This repository has been archived by the owner on May 27, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathMakefile
59 lines (47 loc) · 1.59 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
58
59
SOURCE_FILES?=./...
TEST_PATTERN?=.
TEST_OPTIONS?=-v
export PATH := ./bin:$(PATH)
export GO111MODULE := on
# Install all the build and lint dependencies
setup:
curl -sfL https://install.goreleaser.com/github.com/gohugoio/hugo.sh | sh
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
go mod download
.PHONY: setup
# Run all the tests
test:
go test $(TEST_OPTIONS) -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m
.PHONY: test
# Run all the tests and opens the coverage report
cover: test
go tool cover -html=coverage.txt
.PHONY: cover
# Run all the linters
lint:
./bin/golangci-lint run --disable godox --disable wsl --disable gomnd --disable testpackage --disable gofumpt --disable godot --disable nlreturn --enable-all ./...
.PHONY: lint
# Run all the tests and code checks
ci: build test lint
.PHONY: ci
# Build a beta version
build:
go build
.PHONY: build
# gofmt and goimports all go files
fmt:
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
.PHONY: fmt
# Generate the static documentation
static:
@hugo --enableGitInfo --source www
.PHONY: static
serve:
@hugo server --enableGitInfo --watch --source www
.PHONY: serve
favicon:
wget -O www/static/avatar.png https://avatars2.githubusercontent.com/u/16625397
convert www/static/avatar.png -define icon:auto-resize=64,48,32,16 www/static/favicon.ico
convert www/static/avatar.png -resize x120 www/static/apple-touch-icon.png
.PHONY: favicon
.DEFAULT_GOAL := build