-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathMakefile
More file actions
530 lines (442 loc) · 20.4 KB
/
Makefile
File metadata and controls
530 lines (442 loc) · 20.4 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
NAMESPACE=mondoo
ifndef LATEST_VERSION_TAG
# echo "read LATEST_VERSION_TAG from git"
LATEST_VERSION_TAG=$(shell git describe --abbrev=0 --tags)
endif
ifndef MANIFEST_VERSION
# echo "read MANIFEST_VERSION from git"
MANIFEST_VERSION=$(shell git describe --abbrev=0 --tags)
endif
ifndef VERSION
# echo "read VERSION from git"
VERSION=${LATEST_VERSION_TAG}+$(shell git rev-list --count HEAD)
endif
MAJOR_VERSION=v13
ifndef TARGETOS
TARGETOS = $(shell go env GOOS)
endif
ifndef TARGETARCH
TARGETARCH = $(shell go env GOARCH)
endif
BIN_SUFFIX = ""
ifeq ($(TARGETOS),windows)
BIN_SUFFIX=".exe"
endif
LDFLAGS=-ldflags "-s -w -X go.mondoo.com/mql/${MAJOR_VERSION}.Version=${VERSION}" # -linkmode external -extldflags=-static
LDFLAGSDIST=-tags production -ldflags "-s -w -X go.mondoo.com/mql/${MAJOR_VERSION}.Version=${LATEST_VERSION_TAG} -s -w"
.PHONY: info/ldflags
info/ldflags:
$(info go run ${LDFLAGS} apps/mql/mql.go)
@:
# 🧹 CLEAN #
clean/proto:
find . -not -path './.*' \( -name '*.ranger.go' -or -name '*.pb.go' -or -name '*.actions.go' -or -name '*-packr.go' -or -name '*.swagger.json' \) -delete
.PHONY: version
version:
@echo $(VERSION)
# 🔨 TOOLS #
prep: prep/tools
prep/tools/windows:
go get -u google.golang.org/protobuf
go get -u gotest.tools/gotestsum
prep/tools/protolint:
# protobuf linting
go install github.com/yoheimuta/protolint/cmd/protolint@latest
prep/tools: prep/tools/protolint prep/tools/mockgen
# additional helper
go install gotest.tools/gotestsum@latest
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
go install github.com/hashicorp/copywrite@latest
prep/tools/mockgen:
go install go.uber.org/mock/mockgen@latest
# 🌙 MQL/MOTOR #
mql/generate: clean/proto llx/generate shared/generate sbom/generate reporter/generate providers
mql/generate/core: clean/proto llx/generate shared/generate providers/proto providers/build/mock providers/build/core sbom/generate reporter/generate
define buildProvider
$(eval $@_HOME = $(1))
$(eval $@_NAME = $(shell basename ${$@_HOME}))
$(eval $@_DIST = "${$@_HOME}"/dist)
$(eval $@_DIST_BIN = "./dist/${$@_NAME}")
$(eval $@_BIN = "${$@_DIST}"/"${$@_NAME}")
echo "--> [${$@_NAME}] process resources"
./lr go ${$@_HOME}/resources/${$@_NAME}.lr --dist ${$@_DIST}
./lr versions ${$@_HOME}/resources/${$@_NAME}.lr
echo "--> [${$@_NAME}] generate CLI json"
cd ${$@_HOME} && go run ./gen/main.go .
@if echo "aws gcp azure" | grep -qw "${$@_NAME}"; then \
echo "--> [${$@_NAME}] extract permissions"; \
go run providers-sdk/v1/util/permissions/permissions.go ${$@_HOME}; \
fi
@if [ "$(SKIP_COMPILE)" = "yes" ]; then \
echo "--> [${$@_NAME}] skipping compile"; \
else \
echo "--> [${$@_NAME}] creating ${$@_BIN}"; \
cd ${$@_HOME} && GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o ${$@_DIST_BIN}${BIN_SUFFIX} ./main.go; \
fi
endef
define buildProviderDist
$(eval $@_HOME = $(1))
$(eval $@_NAME = $(shell basename ${$@_HOME}))
$(eval $@_DIST = "${$@_HOME}"/dist)
$(eval $@_DIST_BIN = "./dist/${$@_NAME}")
$(eval $@_BIN = "${$@_DIST}"/"${$@_NAME}")
echo "--> [${$@_NAME}] process resources"
./lr go ${$@_HOME}/resources/${$@_NAME}.lr --dist ${$@_DIST}
./lr versions ${$@_HOME}/resources/${$@_NAME}.lr
echo "--> [${$@_NAME}] generate CLI json"
cd ${$@_HOME} && go run ./gen/main.go .
@if echo "aws gcp azure" | grep -qw "${$@_NAME}"; then \
echo "--> [${$@_NAME}] extract permissions"; \
go run providers-sdk/v1/util/permissions/permissions.go ${$@_HOME}; \
fi
echo "--> [${$@_NAME}] creating ${$@_BIN}"
cd ${$@_HOME} && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build ${LDFLAGSDIST} -o ${$@_DIST_BIN}${BIN_SUFFIX} ./main.go
endef
define installProvider
$(eval $@_HOME = $(1))
$(eval $@_NAME = $(shell basename ${$@_HOME}))
$(eval $@_DIST = "${$@_HOME}"/dist)
$(eval $@_BIN = "${$@_DIST}"/"${$@_NAME}")
$(eval $@_DST = "$(HOME)/.config/mondoo/providers/${$@_NAME}")
echo "--> install ${$@_NAME}"
install -d "${$@_DST}"
install -m 755 ./${$@_DIST}/${$@_NAME} ${$@_DST}/
install -m 644 ./${$@_DIST}/${$@_NAME}.json ${$@_DST}/
install -m 644 ./${$@_DIST}/${$@_NAME}.resources.json ${$@_DST}/
endef
define bundleProvider
$(eval $@_HOME = $(1))
$(eval $@_NAME = $(shell basename ${$@_HOME}))
$(eval $@_DIST = "${$@_HOME}"/dist)
$(eval $@_DST = "${$@_DIST}/${$@_NAME}.tar.xz")
echo "--> bundle ${$@_NAME} to ${$@_DST} (this may take a while)"
tar -cf ${$@_DST} --no-same-owner \
--use-compress-program='xz -9v' \
-C ${$@_DIST} \
${$@_NAME} ${$@_NAME}.json ${$@_NAME}.resources.json
ls -lha ${$@_DST}
endef
define testProvider
$(eval $@_HOME = $(1))
$(eval $@_NAME = $(shell basename ${$@_HOME}))
$(eval $@_PKGS = $(shell go list ./${$@_HOME}/...))
echo "--> test ${$@_NAME} in ${$@_HOME}"
gotestsum --junitfile ./report_${$@_NAME}.xml --format pkgname -- -cover ${$@_PKGS}
endef
define testGoModProvider
$(eval $@_HOME = $(1))
$(eval $@_NAME = $(shell basename ${$@_HOME}))
$(eval $@_PKGS = $(shell bash -c "cd ${$@_HOME} && go list ./..."))
echo "--> test ${$@_NAME} in ${$@_HOME}"
cd ${$@_HOME} && gotestsum --junitfile ../../report_${$@_NAME}.xml --format pkgname -- -cover ${$@_PKGS}
endef
.PHONY: providers
providers: providers/proto providers/config providers/build
.PHONY: providers/proto
providers/proto:
go generate .
go generate ./providers-sdk/v1/vault
go generate ./providers-sdk/v1/resources
go generate ./providers-sdk/v1/inventory
go generate ./providers-sdk/v1/plugin
go generate ./providers-sdk/v1/recording
.PHONY: providers/config
providers/config:
go run ./providers-sdk/v1/util/configure -f providers.yaml -o providers/builtin_dev.go
.PHONY: providers/defaults
providers/defaults:
go run ./providers-sdk/v1/util/defaults/defaults.go -o providers/defaults.go
.PHONY: providers/lr
providers/lr:
go build -o lr ./providers-sdk/v1/mqlr/main.go
providers/lr/install: providers/lr
cp ./lr ${GOPATH}/bin
.PHONY: providers/mqlr
providers/mqlr:
go build -o mqlr ./providers-sdk/v1/mqlr/main.go
providers/mqlr/install: providers/mqlr
cp ./mqlr ${GOPATH}/bin
# Provider list — add new providers here.
# core is excluded: it has no install target and is always built as a dependency of providers/build.
PROVIDERS := network os ipmi ipinfo oci slack github gitlab terraform \
vsphere opcua okta google-workspace arista equinix vcd gcp k8s azure \
ms365 aws atlassian cloudformation shodan ansible snowflake mondoo \
cloudflare nmap tailscale depsdev
.PHONY: providers/build
providers/build: \
providers/build/mock \
providers/build/core \
$(addprefix providers/build/,$(PROVIDERS))
.PHONY: providers/install
providers/install: $(addprefix providers/install/,$(PROVIDERS))
providers/build/mock: providers/lr
./lr go providers-sdk/v1/testutils/mockprovider/resources/mockprovider.lr
providers/build/%: providers/lr
@$(call buildProvider, providers/$*)
providers/install/%:
@$(call installProvider, providers/$*)
providers/dist: $(addprefix providers/dist/,$(PROVIDERS))
providers/dist/%:
@$(call buildProviderDist, providers/$*)
providers/bundle: $(addprefix providers/bundle/,$(PROVIDERS))
providers/bundle/%:
@$(call bundleProvider, providers/$*)
providers/permissions:
@go run providers-sdk/v1/util/permissions/permissions.go providers/aws
@go run providers-sdk/v1/util/permissions/permissions.go providers/gcp
@go run providers-sdk/v1/util/permissions/permissions.go providers/azure
providers/test:
@$(call testProvider, providers/core)
@$(call testProvider, providers/network)
@$(call testProvider, providers/os)
@$(call testGoModProvider, providers/ipmi)
@$(call testGoModProvider, providers/ipinfo)
@$(call testGoModProvider, providers/oci)
@$(call testGoModProvider, providers/slack)
@$(call testGoModProvider, providers/github)
@$(call testGoModProvider, providers/gitlab)
@$(call testGoModProvider, providers/terraform)
@$(call testGoModProvider, providers/vsphere)
@$(call testGoModProvider, providers/opcua)
@$(call testGoModProvider, providers/okta)
@$(call testGoModProvider, providers/google-workspace)
@$(call testGoModProvider, providers/arista)
@$(call testGoModProvider, providers/equinix)
@$(call testGoModProvider, providers/vcd)
@$(call testGoModProvider, providers/gcp)
@$(call testGoModProvider, providers/k8s)
@$(call testGoModProvider, providers/azure)
@$(call testGoModProvider, providers/ms365)
@$(call testGoModProvider, providers/aws)
@$(call testGoModProvider, providers/atlassian)
@$(call testGoModProvider, providers/cloudformation)
@$(call testGoModProvider, providers/shodan)
@$(call testGoModProvider, providers/ansible)
@$(call testGoModProvider, providers/snowflake)
@$(call testGoModProvider, providers/mondoo)
@$(call testGoModProvider, providers/nmap)
@$(call testGoModProvider, providers/tailscale)
lr/test:
go test ./providers-sdk/v1/mqlr/...
# TODO: migrate
.PHONY: lr/docs/serve
lr/docs/serve:
cd resources/docs && yarn
cd resources/docs && $(shell cd resources/docs && npm bin)/parcel -p 1235 index.html
# TODO: migrate
.PHONY: lr/docs/markdown
lr/docs/markdown: providers/lr
./lr markdown providers/ansible/resources/ansible.lr \
--pack-name "Ansible" \
--description "The Ansible resource pack lets you use MQL to query and assess the security of your Ansible playbooks." \
--output ../docs/docs/mql/resources/ansible-pack
./lr markdown providers/arista/resources/arista.lr \
--pack-name "Arista EOS" \
--description "The Arista EOS resource pack lets you use MQL to query and assess the security of your Arista EOS network devices." \
--output ../docs/docs/mql/resources/arista-pack
./lr markdown providers/atlassian/resources/atlassian.lr \
--pack-name "Atlassian" \
--description "The Atlassian resource pack lets you use MQL to query and assess the security of your Atlassian services." \
--output ../docs/docs/mql/resources/atlassian-pack
./lr markdown providers/aws/resources/aws.lr \
--pack-name "Amazon Web Services (AWS)" \
--description "The Amazon Web Services (AWS) resource pack lets you use MQL to query and assess the security of your AWS cloud services." \
--output ../docs/docs/mql/resources/aws-pack
./lr markdown providers/azure/resources/azure.lr \
--pack-name "Azure" \
--description "The Azure resource pack lets you use MQL to query and assess the security of your Azure cloud services." \
--output ../docs/docs/mql/resources/azure-pack
./lr markdown providers/cloudflare/resources/cloudflare.lr \
--pack-name "Cloudflare" \
--description "The Cloudflare resource pack lets you use MQL to query and assess the security of your Cloudflare configuration." \
--output ../docs/docs/mql/resources/cloudflare-pack
./lr markdown providers/cloudformation/resources/cloudformation.lr \
--pack-name "AWS CloudFormation" \
--description "The AWS CloudFormation resource pack lets you use MQL to query and assess the security of your AWS CloudFormation." \
--output ../docs/docs/mql/resources/cloudformation-pack
./lr markdown providers/core/resources/core.lr \
--pack-name "Core" \
--description "The Core pack provides basic MQL resources that let you query and assess the security of assets in your infrastructure." \
--output ../docs/docs/mql/resources/core-pack
./lr markdown providers/equinix/resources/equinix.lr \
--pack-name "Equinix Metal" \
--description "The Equinix Metal resource pack lets you use MQL to query and assess the security of your Equinix Metal assets." \
--output ../docs/docs/mql/resources/equinix-pack
./lr markdown providers/gcp/resources/gcp.lr \
--pack-name "Google Cloud Platform (GCP)" \
--description "The Google Cloud Platform (GCP) resource pack lets you use MQL to query and assess the security of your Google cloud services." \
--output ../docs/docs/mql/resources/gcp-pack
./lr markdown providers/github/resources/github.lr \
--pack-name "GitHub" \
--description "The GitHub resource pack lets you use MQL to query and assess the security of your GitHub organizations and repositories." \
--output ../docs/docs/mql/resources/github-pack
./lr markdown providers/gitlab/resources/gitlab.lr \
--pack-name "GitLab" \
--description "The GitLab resource pack lets you use MQL to query and assess the security of your GitLab groups and projects." \
--output ../docs/docs/mql/resources/gitlab-pack
./lr markdown providers/google-workspace/resources/google-workspace.lr \
--pack-name "Google Workspace" \
--description "The Google Workspace resource pack lets you use MQL to query and assess the security of your Google Workspace identities and configuration." \
--output ../docs/docs/mql/resources/google-workspace-pack
./lr markdown providers/ipmi/resources/ipmi.lr \
--pack-name "IPMI" \
--description "The IPMI resource pack lets you use MQL to query and assess the security of your IPMI devices." \
--output ../docs/docs/mql/resources/ipmi-pack
./lr markdown providers/ipinfo/resources/ipinfo.lr \
--pack-name "IPinfo" \
--description "The IPinfo resource pack lets you use MQL to query IP address information from ipinfo.io." \
--output ../docs/docs/mql/resources/ipinfo-pack
./lr markdown providers/k8s/resources/k8s.lr \
--pack-name "Kubernetes (K8s)" \
--description "The Kubernetes resource pack lets you use MQL to query and assess the security of your Kubernetes clusters and workloads." \
--output ../docs/docs/mql/resources/k8s-pack
./lr markdown providers/mondoo/resources/mondoo.lr \
--pack-name "Mondoo Platform" \
--description "The Mondoo resource pack lets you interact with Mondoo Platform and its assets and resources." \
--output ../docs/docs/mql/resources/mondoo-pack
./lr markdown providers/ms365/resources/ms365.lr \
--pack-name "Microsoft 365 (M365)" \
--description "The Microsoft 365 (M365) resource pack lets you use MQL to query and assess the security of your Microsoft 365 identities and configuration." \
--output ../docs/docs/mql/resources/m365-pack
./lr markdown providers/network/resources/network.lr \
--pack-name "Network" \
--description "The Network resource pack lets you use MQL to query and assess the security of domains and network services." \
--output ../docs/docs/mql/resources/network-pack
./lr markdown providers/nmap/resources/nmap.lr \
--pack-name "Nmap" \
--description "The Nmap resource pack lets you use MQL to query and assess the network devices with Nmap." \
--output ../docs/docs/mql/resources/nmap-pack
./lr markdown providers/oci/resources/oci.lr \
--pack-name "Oracle Cloud Infrastructure (OCI)" \
--description "The Oracle Cloud Infrastructure (OCI) resource pack lets you use MQL to query and assess the security of your OCI services." \
--output ../docs/docs/mql/resources/oci-pack
./lr markdown providers/okta/resources/okta.lr \
--pack-name "Okta" \
--description "The Okta resource pack lets you use MQL to query and assess the security of your Okta identities and configuration." \
--output ../docs/docs/mql/resources/okta-pack
./lr markdown providers/opcua/resources/opcua.lr \
--pack-name "OPC UA" \
--description "The OPC UA resource pack lets you use MQL to query and assess the security of your OPC UA assets." \
--output ../docs/docs/mql/resources/opcua-pack
./lr markdown providers/os/resources/os.lr \
--pack-name "Operating Systems (OS)" \
--description "The Operating Systems (OS) resource pack lets you use MQL to query and assess the security of your operating system packages and configuration." \
--output ../docs/docs/mql/resources/os-pack
./lr markdown providers/shodan/resources/shodan.lr \
--pack-name "Shodan" \
--description "The Shodan resource pack lets you use MQL to query and assess IP and DNS information via Shodan service." \
--output ../docs/docs/mql/resources/shodan-pack
./lr markdown providers/slack/resources/slack.lr \
--pack-name "Slack" \
--description "The Slack resource pack lets you use MQL to query and assess the security of your Slack identities and configuration." \
--output ../docs/docs/mql/resources/slack-pack
./lr markdown providers/snowflake/resources/snowflake.lr \
--pack-name "Snowflake" \
--description "The Snowflake resource pack lets you use MQL to query and assess the security of your Snowflake identities and configuration." \
--output ../docs/docs/mql/resources/snowflake-pack
./lr markdown providers/tailscale/resources/tailscale.lr \
--pack-name "Tailscale" \
--description "The Tailscale resource pack lets you use MQL to query devices, users, DNS nameservers, and more information about a Tailscale network." \
--output ../docs/docs/mql/resources/tailscale-pack
./lr markdown providers/terraform/resources/terraform.lr \
--pack-name "Terraform IaC" \
--description "The Terraform IaC resource pack lets you use MQL to query and assess the security of your Terraform HCL, plan, and state resources." \
--output ../docs/docs/mql/resources/terraform-pack
./lr markdown providers/vcd/resources/vcd.lr \
--pack-name "VMware Cloud Director" \
--description "The VMware Cloud Director resource pack lets you use MQL to query and assess the security of your VMware Cloud Director configuration." \
--output ../docs/docs/mql/resources/vcd-pack
./lr markdown providers/vsphere/resources/vsphere.lr \
--pack-name "VMware vSphere" \
--description "The VMware vSphere resource pack lets you use MQL to query and assess the security of your VMware vSphere hosts and services." \
--output ../docs/docs/mql/resources/vsphere-pack
lr/docs/stats:
@echo "Please remember to re-run before using this:"
@echo " make providers/build"
@echo ""
go run providers-sdk/v1/util/docs/summarize.go ${PWD}/providers
llx/generate:
go generate ./llx
.PHONY: llx
llx: | llx/generate llx/test
llx/test:
go test -timeout 5s $(shell go list ./llx/... | grep -v '/vendor/')
.PHONY: mqlc
mqlc: | llx mqlc/test
mqlc/test:
go test -timeout 5s $(shell go list ./mqlc/... | grep -v '/vendor/')
sbom/generate:
go generate ./sbom
reporter/generate:
go generate ./cli/reporter
# 🏗 Binary / Build #
.PHONY: mql/build
mql/build:
go build ${LDFLAGSDIST} apps/mql/mql.go
.PHONY: mql/build/linux
mql/build/linux:
GOOS=linux GOARCH=amd64 go build ${LDFLAGSDIST} apps/mql/mql.go
.PHONY: mql/build/windows
mql/build/windows:
GOOS=windows GOARCH=amd64 go build ${LDFLAGSDIST} apps/mql/mql.go
mql/build/darwin:
GOOS=darwin go build ${LDFLAGSDIST} apps/mql/mql.go
.PHONY: mql/install
mql/install:
GOBIN=${GOPATH}/bin go install ${LDFLAGSDIST} apps/mql/mql.go
mql/dist/goreleaser/stable:
goreleaser release --clean --skip=validate,publish -f .goreleaser.yml --timeout 120m
mql/dist/goreleaser/edge:
goreleaser release --clean --skip=validate,publish -f .goreleaser.yml --timeout 120m --snapshot
shared/generate:
go generate ./shared/proto/.
go generate ./providers-sdk/v1/upstream/
go generate ./providers-sdk/v1/upstream/health
go generate ./providers-sdk/v1/upstream/mvd/cvss
go generate ./providers-sdk/v1/upstream/mvd
go generate ./providers-sdk/v1/upstream/etl
# ⛹🏽 Testing #
test/lint: test/lint/golangci-lint/run
test: test/go test/lint
race/go:
go test -race go.mondoo.com/mql/${MAJOR_VERSION}/internal/workerpool
test/generate: prep/tools/mockgen
go generate ./providers/...
test/go: mql/generate test/generate test/go/plain
test/go/plain:
go test -cover $(shell go list ./... | grep -v '/providers/' | grep -v '/test/')
test/go/plain-ci: prep/tools test/generate providers/build
gotestsum --junitfile report.xml --format pkgname -- -cover $(shell go list ./... | grep -v '/vendor/' | grep -v '/providers/' | grep -v '/test/')
test/integration:
go test -cover -p 1 $(shell go list ./... | grep '/test/')
test/go-cli/plain-ci: prep/tools test/generate providers/build
gotestsum --junitfile report.xml --format pkgname -- -cover -p 1 $(shell go list ./... | grep '/test/')
.PHONY: test/lint/staticcheck
test/lint/staticcheck:
staticcheck $(shell go list ./... | grep -v /providers/slack)
.PHONY: test/lint/govet
test/lint/govet:
go vet $(shell go list ./... | grep -v /providers/slack)
.PHONY: test/lint/golangci-lint/run
test/lint/golangci-lint/run: prep/tools
golangci-lint --version
golangci-lint run
test/lint/extended: prep/tools test/generate
golangci-lint run --config=.github/.golangci.yaml --timeout=30m
test/lint/proto: prep/tools/protolint
protolint lint .
license: license/headers/check
license/headers/check:
copywrite headers --plan
license/headers/apply:
copywrite headers
# 📈 METRICS #
metrics/start: metrics/grafana/start metrics/prometheus/start
metrics/prometheus/start:
APP_NAME=mql VERSION=${VERSION} prometheus --config.file=prometheus.yml
metrics/grafana/start:
docker run -d --name=grafana \
-p 3000:3000 \
grafana/grafana
metrics/grafana/stop:
docker stop grafana