-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
100 lines (78 loc) · 2.58 KB
/
Makefile
File metadata and controls
100 lines (78 loc) · 2.58 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Check to see if we can use ash, in Alpine images, or default to BASH.
SHELL_PATH = /bin/ash
SHELL = $(if $(wildcard $(SHELL_PATH)),/bin/ash,/bin/bash)
# Load environment variables from .env file if it exists
ifneq (,$(wildcard ./.env))
include .env
export
endif
.PHONY: all
all: install-libs lint test cover
# ==============================================================================
# Install dependencies
.PHONY: install-libs
install-libs:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install golang.org/x/vuln/cmd/govulncheck@latest
go install github.com/vektra/mockery/v2@latest
go install github.com/swaggo/swag/cmd/swag@latest
go install go.uber.org/nilaway/cmd/nilaway@latest
# ==============================================================================
# Administration
.PHONY: run
run:
go run ./main.go server
.PHONY: migrate
migrate:
go run ./main.go db:migrate
# ==============================================================================
# Running tests within the local computer
.PHONY: static
static: lint vuln-check nilaway
.PHONY: lint
lint:
golangci-lint run ./... --allow-parallel-runners
.PHONY: vuln-check
vuln-check:
govulncheck -show verbose ./...
.PHONY: nilaway
nilaway:
nilaway --include-pkgs="github.com/cristiano-pacheco/pingo" --exclude-pkgs="vendor/" ./...
.PHONY: test
test:
CGO_ENABLED=0 go test ./...
.PHONY: test-e2e
test-e2e:
APP_BASE_URL=http://localhost:9000 CGO_ENABLED=0 go test -v -race -timeout=30s -tags=e2e ./test/e2e/...
.PHONY: cover
cover:
mkdir -p reports
go test -race -coverprofile=reports/cover.out -coverpkg=./... ./... && \
go tool cover -html=reports/cover.out -o reports/cover.html
.PHONY: update-mocks
update-mocks:
mockery
.PHONY: update-swagger
update-swagger:
go install github.com/swaggo/swag/cmd/swag@latest
swag i --parseDependency
# ==============================================================================
# Trace generation
.PHONY: tracegen
tracegen:
go run ./main.go tracegen --path ./internal/modules --verbose
.PHONY: tracegen-dry
tracegen-dry:
go run ./main.go tracegen --path ./internal/modules --dry-run --verbose
.PHONY: tracegen-remove
tracegen-remove:
go run ./main.go tracegen --path ./internal/modules --remove --verbose
# ==============================================================================
# NOTES
#
# RSA Keys
# To generate a private key PEM file.
# $ openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 | base64 | tr -d '\n' > private_key_base64.txt
#
# To convert the txt file to a PEM file.
# base64 -D -i private_key_base64.txt -o private.pem