Skip to content

Commit 253d9d9

Browse files
committed
chore: use github actions
1 parent 2585e8c commit 253d9d9

File tree

4 files changed

+81
-82
lines changed

4 files changed

+81
-82
lines changed

.gitignore

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,11 @@
1-
# Compiled Object files, Static and Dynamic libs (Shared Objects)
2-
*.o
3-
*.a
4-
*.so
5-
6-
# Folders
7-
_obj
8-
_test
9-
10-
# Architecture specific extensions/prefixes
11-
*.[568vq]
12-
[568vq].out
13-
14-
*.cgo1.go
15-
*.cgo2.c
16-
_cgo_defun.c
17-
_cgo_gotypes.go
18-
_cgo_export.*
19-
20-
_testmain.go
21-
22-
*.exe
23-
*.test
24-
*.prof
25-
26-
.cover
27-
vendor
28-
coverage.txt
1+
.*
2+
*.log
3+
*.out
4+
!.github/
5+
!.husky/
6+
!.editorconfig
7+
!.gitignore
8+
!.golangci.yml
9+
!.goreleaser.yml
10+
!.husky.yaml
11+
/tmp/

Makefile

Lines changed: 70 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,75 @@
1-
GO_CMD=go
2-
GO_BUILD=$(GO_CMD) build
3-
GO_BUILD_RACE=$(GO_CMD) build -race
4-
GO_TEST=$(GO_CMD) test
5-
GO_TEST_VERBOSE=$(GO_CMD) test -v
6-
GO_INSTALL=$(GO_CMD) install -v
7-
GO_CLEAN=$(GO_CMD) clean
8-
GO_DEPS=$(GO_CMD) get -d -v
9-
GO_DEPS_UPDATE=$(GO_CMD) get -d -v -u
10-
GO_VET=$(GO_CMD) vet
11-
GO_FMT=$(GO_CMD) fmt
12-
13-
.PHONY: all test lint dep
14-
15-
all: dep test lint
1+
.DEFAULT_GOAL:=help
2+
-include .makerc
163

4+
# --- Targets -----------------------------------------------------------------
5+
6+
# This allows us to accept extra arguments
7+
%:
8+
@:
9+
10+
## === Tasks ===
11+
12+
.PHONY: doc
13+
## Run tests
14+
doc:
15+
@open "http://localhost:6060/pkg/github.com/foomo/contentful/"
16+
@godoc -http=localhost:6060 -play
17+
18+
.PHONY: test
19+
## Run tests
1720
test:
18-
./tools/test.sh
21+
@go test -p 1 -coverprofile=coverage.out -race -json ./... | gotestfmt
1922

23+
.PHONY: lint
24+
## Run linter
2025
lint:
21-
./tools/lint.sh
26+
@golangci-lint run
27+
28+
.PHONY: lint.fix
29+
## Fix lint violations
30+
lint.fix:
31+
@golangci-lint run --fix
32+
33+
.PHONY: tidy
34+
## Run go mod tidy
35+
tidy:
36+
@go mod tidy
37+
38+
.PHONY: outdated
39+
## Show outdated direct dependencies
40+
outdated:
41+
@go list -u -m -json all | go-mod-outdated -update -direct
42+
43+
## === Utils ===
2244

23-
dep:
24-
curl -fsSL -o /tmp/dep https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64
25-
chmod +x /tmp/dep
26-
/tmp/dep ensure -vendor-only
45+
## Show help text
46+
help:
47+
@awk '{ \
48+
if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \
49+
helpCommand = substr($$0, index($$0, ":") + 2); \
50+
if (helpMessage) { \
51+
printf "\033[36m%-23s\033[0m %s\n", \
52+
helpCommand, helpMessage; \
53+
helpMessage = ""; \
54+
} \
55+
} else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \
56+
helpCommand = substr($$0, 0, index($$0, ":")); \
57+
if (helpMessage) { \
58+
printf "\033[36m%-23s\033[0m %s\n", \
59+
helpCommand, helpMessage"\n"; \
60+
helpMessage = ""; \
61+
} \
62+
} else if ($$0 ~ /^##/) { \
63+
if (helpMessage) { \
64+
helpMessage = helpMessage"\n "substr($$0, 3); \
65+
} else { \
66+
helpMessage = substr($$0, 3); \
67+
} \
68+
} else { \
69+
if (helpMessage) { \
70+
print "\n "helpMessage"\n" \
71+
} \
72+
helpMessage = ""; \
73+
} \
74+
}' \
75+
$(MAKEFILE_LIST)

tools/lint.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

tools/test.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)