forked from docker-mailserver/docker-mailserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (40 loc) · 1.76 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
SHELL := /bin/bash
.SHELLFLAGS += -e -u -o pipefail
export IMAGE_NAME := mailserver-testing:ci
export NAME ?= $(IMAGE_NAME)
# -----------------------------------------------
# --- Generic Targets ---------------------------
# -----------------------------------------------
all: lint build backup generate-accounts tests clean
build:
@ DOCKER_BUILDKIT=1 docker build \
--tag $(IMAGE_NAME) \
--build-arg VCS_VERSION=$(shell git rev-parse --short HEAD) \
--build-arg VCS_REVISION=$(shell cat VERSION) \
.
generate-accounts:
@ cp test/config/templates/postfix-accounts.cf test/config/postfix-accounts.cf
@ cp test/config/templates/dovecot-masters.cf test/config/dovecot-masters.cf
backup:
# if backup directory exist, clean hasn't been called, therefore
# we shouldn't overwrite it. It still contains the original content.
-@ [[ ! -d testconfig.bak ]] && cp -rp test/config testconfig.bak || :
clean:
# remove test containers and restore test/config directory
-@ [[ -d testconfig.bak ]] && { sudo rm -rf test/config ; mv testconfig.bak test/config ; } || :
-@ for CONTAINER in $$(docker ps -a --filter name='^dms-test-.*|^mail_.*|^hadolint$$|^eclint$$|^shellcheck$$' | sed 1d | cut -f 1-1 -d ' '); do docker rm -f $${CONTAINER}; done
-@ while read -r LINE; do [[ $${LINE} =~ test/.+ ]] && sudo rm -rf $${LINE}; done < .gitignore
# -----------------------------------------------
# --- Tests & Lints ----------------------------
# -----------------------------------------------
tests:
@ ./test/bats/bin/bats --timing test/*.bats
test/%:
@ ./test/bats/bin/bats --timing [email protected]
lint: eclint hadolint shellcheck
hadolint:
@ ./test/linting/lint.sh hadolint
shellcheck:
@ ./test/linting/lint.sh shellcheck
eclint:
@ ./test/linting/lint.sh eclint