-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
66 lines (57 loc) · 1.52 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
55
56
57
58
59
60
61
62
63
64
65
66
PROVIDER = virtualbox
GITHUB_WORKFLOW = asdf
.PHONY: usage
usage:
@echo "Basic usage"
@echo ""
@echo "Targets:"
@echo " setup Starts and provisions the vagrant environment. Time can be saved by parallel execution (use -j)."
@echo " tests Execute tests (do not use -j!)"
@echo " clean Destroys the vagrant environment"
@echo ""
vms := ns sut client mail-sink
.PHONY: setup $(vms)
setup: $(vms)
$(vms): ns
vagrant up --provision --provider=$(PROVIDER) $@
.PHONY: clean
clean:
vagrant destroy -f
all-tests := $(wildcard tests/*/*Test.yml) $(wildcard unittests/*_tests.yml)
.PHONY: $(all-tests)
$(all-tests):
ifeq ($(TRAVIS), true)
@echo "travis_fold:start:$@"
$(call travis_time_start)
else ifeq ($(GITHUB_ACTIONS), true)
@echo "::group::$@"
endif
ansible-playbook $@
ifeq ($(TRAVIS), true)
$(call travis_time_end)
@echo "travis_fold:end:$@"
else ifeq ($(GITHUB_ACTIONS), true)
@echo "::endgroup::"
endif
.PHONY: tests
tests: $(all-tests)
# Helper for Travis-CI
DATE :=
ifeq ($(shell uname -s), Darwin)
# brew install coreutils
DATE = gdate
else
DATE = date
endif
define travis_time_start
$(eval TRAVIS_TIMER_START_TIME := $$(shell $(DATE) +%s%N))
$(eval TRAVIS_TIMER_ID := $(shell bash -c 'printf %08x $$(( RANDOM * RANDOM ))'))
@echo "travis_time:start:$(TRAVIS_TIMER_ID)"
endef
define travis_time_end
@ \
START=$(TRAVIS_TIMER_START_TIME); \
END=$$($(DATE) +%s%N); \
DURATION=$$(( $${END} - $${START} )); \
echo "travis_time:end:$(TRAVIS_TIMER_ID):start=$${START},finish=$${END},duration=$${DURATION}";
endef