From 8379ee277f489e7ecf21db35af5f9e1bc7fd305b Mon Sep 17 00:00:00 2001 From: Hector Date: Wed, 21 Jun 2023 15:57:25 +0100 Subject: [PATCH 1/2] remove dependency format check --- .gitlab-ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ab44653..a6423c6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,12 +12,6 @@ sast: include: - template: Security/SAST.gitlab-ci.yml -dependencies: - extends: .go_template - stage: test - script: - - make check/dependencies - format: extends: .go_template stage: test From a0a6cc4f6e0b2fa697fb0693483743d29c376409 Mon Sep 17 00:00:00 2001 From: Hector Date: Wed, 21 Jun 2023 15:57:42 +0100 Subject: [PATCH 2/2] update makefile --- Makefile | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 702a3ff..e3a6ae6 100644 --- a/Makefile +++ b/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: 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 go test ./... -v -race +# Format code +.PHONY: fmt fmt: download + go mod tidy go fmt ./... -check/dependencies: download - go mod tidy -v - git diff-index --quiet HEAD - +# Check for unformatted go code +.PHONY: check/fmt check/fmt: download test -z $(shell gofmt -l .) +# Build project +.PHONY: build build: go build \ -ldflags "\ @@ -27,5 +44,7 @@ build: -o fail2ban_exporter \ exporter.go +# Build project docker container +.PHONY: build/docker build/docker: build docker build -t fail2ban-prometheus-exporter .