-
Notifications
You must be signed in to change notification settings - Fork 544
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (35 loc) · 1.14 KB
/
Makefile
File metadata and controls
40 lines (35 loc) · 1.14 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
.PHONY: test
test:
# we clean the cache to avoid scenarios when we change something in the db and we want to retest without noticing nothing run
go clean -testcache
go test -race -timeout 3m ./...
.PHONY: coverage
coverage:
go clean -testcache
go test -timeout 3m -coverprofile=coverage.out.tmp ./... || true
cat coverage.out.tmp | grep -vE "MockGen|codegen|mocks" > coverage.out
rm coverage.out.tmp
echo "| File | Function | Coverage |" > coverage.md
echo "| --- | --- | --- |" >> coverage.md
go tool cover -func=coverage.out | tail -n +2 | while read line; do \
file=$$(echo $$line | awk '{print $$1}'); \
func=$$(echo $$line | awk '{print $$2}'); \
cov=$$(echo $$line | awk '{print $$3}'); \
printf "| %s | %s | %s |\\n" "$$file" "$$func" "$$cov" >> coverage.md; \
done
rm coverage.out
.PHONY: lint
lint:
golangci-lint run --config ../../.golangci.yml
.PHONY: gen-spec-schema
gen-spec-schema:
go run client/spec/gen/main.go
.PHONY: gen-licenses
gen-licenses:
ifndef CI
go install github.com/google/go-licenses@v1.6.0
go run github.com/cloudquery/licenser@v0.2.0 report .
endif
# All gen targets
.PHONY: gen
gen: gen-spec-schema gen-licenses