Basic Makefile CI steps

Create general ci and lint goals for running things with and without docker, and specific ci/* and lint/* goals for individual checks:

#-------------------------------------------------------------------------------
# CI
#-------------------------------------------------------------------------------

# Absolute path to the directory of this Makefile.
HERE = $(realpath $(dir $(realpath $(firstword $(MAKEFILE_LIST)))))

# Run a docker container with the current directory mounted.
DOCKER_HERE := docker run --rm -it -u `id -u`:`id -g` -v "$(PWD)":/here -w /here

.PHONY: ci
ci: ci/eclint ci/hadolint ci/yamllint

.PHONY: ci/eclint
ci/eclint:
	@$(DOCKER_HERE) sdwolfz/eclint:latest make lint/eclint

.PHONY: ci/hadolint
ci/hadolint:
	@$(DOCKER_HERE) sdwolfz/hadolint:latest make lint/hadolint

.PHONY: ci/yamllint
ci/yamllint:
	@$(DOCKER_HERE) sdwolfz/yamllint:latest make lint/yamllint

#-------------------------------------------------------------------------------
# Lint

.PHONY: lint
lint: lint/eclint lint/hadolint lint/yamllint

.PHONY: lint/eclint
lint/eclint:
	@eclint check $$(git ls-files)

.PHONY: lint/hadolint
lint/hadolint:
	@hadolint $$(git ls-files | grep Dockerfile)

.PHONY: lint/yamllint
lint/yamllint:
	@yamllint $$(git ls-files | grep -E \.ya?ml$$)