chore: rewrite make commands

This commit is contained in:
Hector
2023-06-19 18:37:27 +00:00
parent 95f9c821ff
commit 8ff64467db
2 changed files with 57 additions and 53 deletions

View File

@ -1,30 +1,26 @@
go/dependencies:
download:
go mod download
# Make sure no unnecessary dependencies are present
go/checkDependencies:
test: download
go test ./... -v -race
fmt: download
go fmt ./...
check/dependencies: download
go mod tidy -v
git diff-index --quiet HEAD
# Standard go test
go/test:
go test ./... -v -race
go/fmt:
go fmt ./...
go/checkFmt:
check/fmt: download
test -z $(shell gofmt -l .)
build/docker:
go build -o fail2ban_exporter \
-ldflags '-X main.version=$(shell git describe --tags) -X main.commit=${shell git rev-parse HEAD} -X "main.date=${shell date --rfc-3339=seconds}" -X main.builtBy=docker' exporter.go
docker/build/latest:
docker build -t registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest .
docker/build/nightly:
docker build -t registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:nightly .
docker/build/tag:
docker build -t registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:$(shell git describe --tags) .
build:
go build \
-ldflags "\
-X main.version=${shell git describe --tags} \
-X main.commit=${shell git rev-parse HEAD} \
-X main.date=${shell date --iso-8601=seconds} \
-X main.builtBy=manual \
" \
-o fail2ban_exporter \
exporter.go