Skip to content

Instantly share code, notes, and snippets.

@ericbmerritt
Created April 15, 2019 22:04
Show Gist options
  • Save ericbmerritt/b7280da68695f078cae4368133670411 to your computer and use it in GitHub Desktop.
Save ericbmerritt/b7280da68695f078cae4368133670411 to your computer and use it in GitHub Desktop.
export PROJECT_ROOT := $(shell pwd)
VERSION := $(shell "${PROJECT_ROOT}/docker/src/git-version.sh")
DEV_COMPOSE:="${PROJECT_ROOT}/docker/dev.compose.yml"
SHFMT=shfmt -i 2 -ci
RUN_IN_CONTAINER="${PROJECT_ROOT}/bin/run-in-container.sh" "${DEV_COMPOSE}"
export PROJECT_ROOT := $(shell pwd)
.PHONY: gen-version build-prod clean base-lint lint format unit-test \
integration-tests sql-format \
version local-integration-test deploy shell-lint format \
shell-format sql-format repl \
system-up system-down system-restart \
cbuild-prod cclean shell clint cshell-lint cshell-format \
csql-format cformat logs logs-f crepl \
all-logs cintegration-tests cunit-tests
gen-version:
####################################################################
# Direct functions
####################################################################
version:
@echo "${VERSION}"
shell-lint:
${SHFMT} -d docker/src
${SHFMT} -d bin/
shellcheck docker/src/*.sh
shellcheck bin/*.sh
base-lint:
lein all eastwood
lein all yagni
lein all kibit
lint: gen-version shell-lint
lein all nsorg
lein all cljfmt check
lein all nvd check
lein all ancient check
unit-test: gen-version
lein unit-tests
integration-tests: gen-version
lein integration-tests
build-dev: gen-version
lein dev-only ring uberjar
build-prod: gen-version
lein prod-only ring uberjar
clean:
lein clean
sql-format:
./bin/sql-format-directory.sh "sql/db/migrations"
./bin/sql-format-directory.sh "sql/db/"
shell-format:
${SHFMT} -w docker/src/
${SHFMT} -w bin/
format: shell-format sql-format
lein all nsorg --replace
lein all cljfmt fix
local-integration-tests:
./bin/run-integration-tests-with-server.sh
deploy: build-prod
lein prod-only heroku deploy
repl:
lein cider-repl
####################################################################
# Compose oriented targets
####################################################################
system-down:
docker-compose -f "${DEV_COMPOSE}" down --remove-orphans -v
system-restart:
docker-compose -f "${DEV_COMPOSE}" restart
system-up:
docker-compose -f "${DEV_COMPOSE}" up -d
####################################################################
# `In Container` targets
####################################################################
cbuild-prod: system-up
${RUN_IN_CONTAINER} "make build-prod"
cclean: system-up
${RUN_IN_CONTAINER} "make clean"
shell: system-up
${RUN_IN_CONTAINER} "/bin/bash"
cshell-lint: system-up
${RUN_IN_CONTAINER} "make shell-lint"
clint: system-up
${RUN_IN_CONTAINER} "make lint"
csql-format: system-up
${RUN_IN_CONTAINER} "make sql-format"
cshell-format: system-up
${RUN_IN_CONTAINER} "make shell-format"
cformat: system-up
${RUN_IN_CONTAINER} "make format"
logs: system-up
docker-compose -f "${DEV_COMPOSE}" logs server
logs-f: system-up
docker-compose -f "${DEV_COMPOSE}" logs -f server
all-logs: system-up
docker-compose -f "${DEV_COMPOSE}" logs
cunit-test: system-up
${RUN_IN_CONTAINER} "make unit-test"
cintegration-test: system-up
${RUN_IN_CONTAINER} "make integration-test"
clocal-integration-test: system-up
${RUN_IN_CONTAINER} "make local-integration-test"
crepl: system-up
${RUN_IN_CONTAINER} "make repl"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment