Merge branch 'chore/update-makefile-commands' into 'main'
chore: update makefile commands See merge request hectorjsmith/fail2ban-prometheus-exporter!92
This commit is contained in:
commit
211a5015d0
@ -12,12 +12,6 @@ sast:
|
|||||||
include:
|
include:
|
||||||
- template: Security/SAST.gitlab-ci.yml
|
- template: Security/SAST.gitlab-ci.yml
|
||||||
|
|
||||||
dependencies:
|
|
||||||
extends: .go_template
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- make check/dependencies
|
|
||||||
|
|
||||||
format:
|
format:
|
||||||
extends: .go_template
|
extends: .go_template
|
||||||
stage: test
|
stage: test
|
||||||
|
29
Makefile
29
Makefile
@ -1,21 +1,38 @@
|
|||||||
.PHONY: download test fmt check/dependencies check/fmt build build/docker
|
# List make commands
|
||||||
|
.PHONY: ls
|
||||||
|
ls:
|
||||||
|
cat Makefile | grep "^[a-zA-Z#].*" | cut -d ":" -f 1 | sed s';#;\n#;'g
|
||||||
|
|
||||||
|
# Download dependencies
|
||||||
|
.PHONY: download
|
||||||
download:
|
download:
|
||||||
go mod download
|
go mod download
|
||||||
|
|
||||||
|
# Update project dependencies
|
||||||
|
.PHONY: update
|
||||||
|
update:
|
||||||
|
go get -u
|
||||||
|
go mod download
|
||||||
|
go mod tidy
|
||||||
|
|
||||||
|
# Run project tests
|
||||||
|
.PHONY: test
|
||||||
test: download
|
test: download
|
||||||
go test ./... -v -race
|
go test ./... -v -race
|
||||||
|
|
||||||
|
# Format code
|
||||||
|
.PHONY: fmt
|
||||||
fmt: download
|
fmt: download
|
||||||
|
go mod tidy
|
||||||
go fmt ./...
|
go fmt ./...
|
||||||
|
|
||||||
check/dependencies: download
|
# Check for unformatted go code
|
||||||
go mod tidy -v
|
.PHONY: check/fmt
|
||||||
git diff-index --quiet HEAD
|
|
||||||
|
|
||||||
check/fmt: download
|
check/fmt: download
|
||||||
test -z $(shell gofmt -l .)
|
test -z $(shell gofmt -l .)
|
||||||
|
|
||||||
|
# Build project
|
||||||
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
go build \
|
go build \
|
||||||
-ldflags "\
|
-ldflags "\
|
||||||
@ -27,5 +44,7 @@ build:
|
|||||||
-o fail2ban_exporter \
|
-o fail2ban_exporter \
|
||||||
exporter.go
|
exporter.go
|
||||||
|
|
||||||
|
# Build project docker container
|
||||||
|
.PHONY: build/docker
|
||||||
build/docker: build
|
build/docker: build
|
||||||
docker build -t fail2ban-prometheus-exporter .
|
docker build -t fail2ban-prometheus-exporter .
|
||||||
|
Loading…
Reference in New Issue
Block a user