You've already forked db-wait
227a94b0d7
Lint Golang files / Run golang CI linter (stable, ubuntu-latest-amd64) (push) Successful in 14s
Run Golang tests / Run unit tests (stable, ubuntu-latest-amd64) (push) Successful in 9s
Lint Markdown files / Run markdown linter (push) Successful in 4s
Lint Golang files / Run golang CI linter (stable, ubuntu-latest-arm64) (push) Successful in 36s
Run Golang tests / Run unit tests (stable, ubuntu-latest-arm64) (push) Successful in 21s
75 lines
2.3 KiB
Makefile
75 lines
2.3 KiB
Makefile
EXECUTABLE=db-wait
|
|
VERSION?=$(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD)
|
|
|
|
# Destination directory and prefix to place the compiled binaries, documentaions
|
|
# and other files.
|
|
DESTDIR?=
|
|
PREFIX?=/usr/local
|
|
|
|
# BIN
|
|
# ==============================================================================
|
|
db-wait:
|
|
CGO_ENABLED=1 \
|
|
GOPROXY=$(shell go env GOPROXY) \
|
|
go build -ldflags "-X 'main.version=${VERSION}'" -o ${@} main.go
|
|
|
|
# CLEAN
|
|
# ==============================================================================
|
|
PHONY+=clean
|
|
clean:
|
|
rm --force --recursive db-wait
|
|
|
|
# TESTS
|
|
# ==============================================================================
|
|
PHONY+=test/unit
|
|
test/unit:
|
|
CGO_ENABLED=0 \
|
|
GOPROXY=$(shell go env GOPROXY) \
|
|
go test -v -p 1 -coverprofile=coverage.txt -covermode=count -timeout 1200s ./pkg/...
|
|
|
|
PHONY+=test/integration
|
|
test/integration:
|
|
CGO_ENABLED=0 \
|
|
GOPROXY=$(shell go env GOPROXY) \
|
|
go test -v -p 1 -count=1 -timeout 1200s ./it/...
|
|
|
|
PHONY+=test/coverage
|
|
test/coverage:
|
|
CGO_ENABLED=0 \
|
|
GOPROXY=$(shell go env GOPROXY) \
|
|
go tool cover -func=coverage.txt
|
|
|
|
# GOLANGCI-LINT
|
|
# ==============================================================================
|
|
PHONY+=golangci-lint
|
|
golangci-lint:
|
|
golangci-lint run --concurrency=$(shell nproc)
|
|
|
|
# INSTALL
|
|
# ==============================================================================
|
|
PHONY+=uninstall
|
|
install: db-wait
|
|
install --directory ${DESTDIR}/etc/bash_completion.d
|
|
./db-wait completion bash > ${DESTDIR}/etc/bash_completion.d/${EXECUTABLE}
|
|
|
|
install --directory ${DESTDIR}${PREFIX}/bin
|
|
install --mode 0755 ${EXECUTABLE} ${DESTDIR}${PREFIX}/bin/${EXECUTABLE}
|
|
|
|
install --directory ${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}
|
|
install --mode 0644 LICENSE ${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}/LICENSE
|
|
|
|
# UNINSTALL
|
|
# ==============================================================================
|
|
PHONY+=uninstall
|
|
uninstall:
|
|
-rm --force --recursive \
|
|
${DESTDIR}/etc/bash_completion.d/${EXECUTABLE} \
|
|
${DESTDIR}${PREFIX}/bin/${EXECUTABLE} \
|
|
${DESTDIR}${PREFIX}/share/licenses/${EXECUTABLE}
|
|
|
|
# PHONY
|
|
# ==============================================================================
|
|
# Declare the contents of the PHONY variable as phony. We keep that information
|
|
# in a variable so we can use it in if_changed.
|
|
.PHONY: ${PHONY}
|