refactor: update project makefile
Rename steps in the project makefile to follow a more consistent naming scheme. Add new gitlab CI step to check for unused dependencies.
This commit is contained in:
parent
5363cad4ce
commit
695447a4c2
@ -1,21 +1,26 @@
|
||||
image: golang:latest
|
||||
|
||||
before_script:
|
||||
- make install-deps
|
||||
- make go/dependencies
|
||||
|
||||
stages:
|
||||
- test
|
||||
- build
|
||||
|
||||
dependencies:
|
||||
stage: test
|
||||
script:
|
||||
- make go/checkDependencies
|
||||
|
||||
format:
|
||||
stage: test
|
||||
script:
|
||||
- make format
|
||||
- make go/checkFmt
|
||||
|
||||
test:
|
||||
stage: test
|
||||
script:
|
||||
- make test
|
||||
- make go/test
|
||||
|
||||
build:
|
||||
stage: build
|
||||
@ -31,7 +36,7 @@ build:
|
||||
- dist/checksums.txt
|
||||
expire_in: 1 day
|
||||
|
||||
docker-gitlab:
|
||||
docker/gitlab:
|
||||
stage: build
|
||||
only:
|
||||
- main
|
||||
@ -44,6 +49,6 @@ docker-gitlab:
|
||||
- apk add make
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
script:
|
||||
- make docker/build-latest
|
||||
- make docker/build-tag
|
||||
- make docker/build/latest
|
||||
- make docker/build/tag
|
||||
- docker push registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Make sure to check the documentation at http://goreleaser.com
|
||||
before:
|
||||
hooks:
|
||||
- make install-deps
|
||||
- make go/dependencies
|
||||
builds:
|
||||
-
|
||||
dir: src
|
||||
|
26
Makefile
26
Makefile
@ -1,20 +1,22 @@
|
||||
install-deps:
|
||||
go/dependencies:
|
||||
cd src/ && go mod download
|
||||
|
||||
# Standard go test
|
||||
test:
|
||||
cd src/ && go test ./... -v -race
|
||||
|
||||
# Make sure no unnecessary dependencies are present
|
||||
go-mod-tidy:
|
||||
go/checkDependencies:
|
||||
cd src/ && go mod tidy -v
|
||||
git diff-index --quiet HEAD
|
||||
|
||||
format:
|
||||
cd src/ && go fmt $(go list ./... | grep -v /vendor/)
|
||||
cd src/ && go vet $(go list ./... | grep -v /vendor/)
|
||||
# Standard go test
|
||||
go/test:
|
||||
cd src/ && go test ./... -v -race
|
||||
|
||||
generateChangelog:
|
||||
go/fmt:
|
||||
cd src/ && go fmt ./...
|
||||
|
||||
go/checkFmt:
|
||||
test -z $(shell gofmt -l .)
|
||||
|
||||
docs/genChangelog:
|
||||
./tools/git-chglog_linux_amd64 --config tools/chglog/config.yml 0.0.0.. > CHANGELOG_gen.md
|
||||
|
||||
build/snapshot:
|
||||
@ -27,8 +29,8 @@ build/docker:
|
||||
cd src/ && go build -o 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/latest:
|
||||
docker build -t registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest .
|
||||
|
||||
docker/build-tag:
|
||||
docker/build/tag:
|
||||
docker build -t registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:$(shell git describe --tags) .
|
||||
|
Loading…
Reference in New Issue
Block a user