generated from racklet/base-repo-layout
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
39 lines (32 loc) · 1.08 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
REGISTRY ?= ghcr.io
OWNER ?= racklet
IMAGE_NAME ?= render-drawio-action
IMAGE := $(REGISTRY)/$(OWNER)/$(IMAGE_NAME)
TAG ?=
# Test using a file with a whitespace in it
TEST_FILE_BASE ?= "test/foo 1"
GIT_VERSION := $(shell git describe --tags HEAD 2>/dev/null || echo "v0.0.0")
GIT_STATUS := $(if $(shell git status -s),-dirty)
GIT_TAG := $(GIT_VERSION)$(GIT_STATUS)
GIT_MAJOR := $(shell echo "$(GIT_VERSION)" | cut -d. -f1)
all: build
build:
docker build -t $(IMAGE):$(GIT_TAG) --pull .
push: build
docker push $(IMAGE):$(GIT_TAG)
ifneq ($(TAG),)
docker tag $(IMAGE):$(GIT_TAG) $(IMAGE):$(TAG)
docker push $(IMAGE):$(TAG)
endif
push-major: push
ifeq ($(GIT_STATUS),)
docker tag "$(IMAGE):$(GIT_TAG)" "$(IMAGE):$(GIT_MAJOR)"
docker push "$(IMAGE):$(GIT_MAJOR)"
endif
test: build
docker run -it -v $(shell pwd):/files $(IMAGE):$(GIT_TAG) --formats=png,svg,pdf,jpg
$(MAKE) verify
verify:
[ -f $(TEST_FILE_BASE).svg ] && [ -f $(TEST_FILE_BASE).png ] && \
[ -f $(TEST_FILE_BASE).pdf ] && [ -f $(TEST_FILE_BASE).jpg ] && \
echo "Files generated!" || (echo "e2e files not generated" && false)