capi-v2/Makefile
Andrew Mayorov 14369d48f4
TD-124: Setup CI/CD with GH Actions (#1)
* Drop proprietary CI stuff
* Stop including default secret in release
* Fix io encoding w/ iosetopts
* Bump to valitydev/damsel@dcd92dd
* Implement and test `GetServiceProviderByID` op
* Depend on valitydev/swag-payments@a639270
* Drop geo api handler and tests
* Switch to valitydev upstream
  * valitydev/cowboy_access_log@04da359
  * valitydev/damsel@b25d336
  * valitydev/dmt_client@e9b1961
  * valitydev/dmt_core@910e20e
  * valitydev/party_client_erlang@8fc5595
  * valitydev/woody_erlang@0c2e16d
  * valitydev/woody_api_hay@4c39134
* Drop client url logging
* Setup CI/CD with GH Actions
* Drop dead links

Co-authored-by: ndiezel0 <ndiezel0@gmail.com>
2022-02-04 19:28:33 +03:00

93 lines
1.7 KiB
Makefile

# HINT
# Use this file to override variables here.
# For example, to run with podman put `DOCKER=podman` there.
-include Makefile.env
# NOTE
# Variables specified in `.env` file are used to pick and setup specific
# component versions, both when building a development image and when running
# CI workflows on GH Actions. This ensures that tasks run with `wc-` prefix
# (like `wc-dialyze`) are reproducible between local machine and CI runners.
DOTENV := $(shell grep -v '^\#' .env)
# Development images
DEV_IMAGE_TAG = capi-dev
DEV_IMAGE_ID = $(file < .image.dev)
DOCKER ?= docker
REBAR ?= rebar3
all: compile
.PHONY: dev-image clean-dev-image wc-shell test
dev-image: .image.dev
.image.dev: Dockerfile.dev .env
$(DOCKER) build $(DOTENV:%=--build-arg %) -f Dockerfile.dev -t $(DEV_IMAGE_TAG) .
$(DOCKER) image ls -q -f "reference=$(DEV_IMAGE_ID)" | head -n1 > $@
clean-dev-image:
ifneq ($(DEV_IMAGE_ID),)
$(DOCKER) image rm -f $(DEV_IMAGE_TAG)
rm .image.dev
endif
DOCKER_WC_OPTIONS := -v $(PWD):$(PWD) --workdir $(PWD)
DOCKER_WC_EXTRA_OPTIONS ?= --rm
DOCKER_RUN = $(DOCKER) run -t $(DOCKER_WC_OPTIONS) $(DOCKER_WC_EXTRA_OPTIONS)
# Utility tasks
wc-shell: dev-image
$(DOCKER_RUN) --interactive --tty $(DEV_IMAGE_TAG)
wc-%: dev-image
$(DOCKER_RUN) $(DEV_IMAGE_TAG) make $*
# Rebar tasks
rebar-shell:
$(REBAR) shell
compile:
$(REBAR) compile
xref:
$(REBAR) xref
lint:
$(REBAR) lint
check-format:
$(REBAR) fmt -c
dialyze:
$(REBAR) as test dialyzer
release:
$(REBAR) as prod release
eunit:
$(REBAR) eunit --cover
common-test:
$(REBAR) ct --cover
cover:
$(REBAR) covertool generate
format:
$(REBAR) fmt -w
clean:
$(REBAR) clean
distclean: clean-build-image
rm -rf _build
test: eunit common-test
cover-report:
$(REBAR) cover