This repository has been archived by the owner on Feb 13, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 252
/
Makefile
64 lines (53 loc) · 2.03 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
60
61
62
63
64
.PHONY: default help build package push helm run test clean
SHELL = /bin/bash
APP_NAME = teler
VERSION = $(shell git describe --always --tags)
SQUAD = infosec
default: help
help:
@echo 'Management commands for ${APP_NAME}:'
@echo
@echo 'Usage:'
@echo ' make build Compile the project.'
@echo ' make build-all Cross-compile the procject.'
@echo ' make test Run tests on a compiled project.'
@echo ' make lint Run linters on the project.'
@echo ' make golangci-lint Run GolangCI-Lint linter.'
@echo ' make semgrep Run Semgrep linter.'
@echo ' make clean Clean the directory tree.'
@echo
build:
@echo "--- Building ${APP_NAME} ${VERSION}"
@echo "GOPATH=${GOPATH}"
go build -ldflags "-s -w -X github.com/kitabisa/teler/common.Version=${VERSION}" -buildvcs=false -o ./bin/${APP_NAME} .
build-all:
@echo "--- Cross-platform build ${APP_NAME} ${VERSION}"
@if ! [ -x "$(shell command -v goreleaser)" ]; then \
echo "Error: GoReleaser is not installed." >&2; \
echo " See https://goreleaser.com/install/" >&2; \
exit 1; \
fi; \
goreleaser build --clean --skip=validate --snapshot --timeout=30m
test: lint build-all clean
# @echo "--- Testing ${APP_NAME} ${VERSION}"
# go test ./...
lint: golangci-lint semgrep
clean:
@echo "--- Removing ${APP_NAME} ${VERSION}"
@find ./bin ./dist -type f -delete
golangci-lint:
@echo "--- Run GolangCI-Lint"
@if ! [ -x "$(shell command -v golangci-lint)" ]; then \
echo "Error: GolangCI-Lint is not installed." >&2; \
echo " Get at https://github.com/golangci/golangci-lint/releases" >&2; \
exit 1; \
fi; \
golangci-lint run ./... --tests=0 --issues-exit-code=1 --timeout=30m
semgrep:
@echo "--- Run Semgrep"
@if ! [ -x "$(shell command -v semgrep)" ]; then \
echo "Error: Semgrep is not installed." >&2; \
echo " See https://semgrep.dev/docs/getting-started/#run-semgrep-locally" >&2; \
exit 1; \
fi; \
semgrep scan --config auto --dryrun -q --include "**.go"