forked from saltstack-formulas/nginx-formula
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
80 lines (61 loc) · 2.36 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
FORMULA_NAME = "nginx"
PWD = $(shell pwd)
# ---------------------------------------------------------------
define render_dockerfile
python $(PWD)/tools/filltmpl.py $(FORMULA_NAME) $(1)
endef
define docker_build
docker build --force-rm -t $(FORMULA_NAME):salt-testing-$(1) -f Dockerfile.$(1) .
endef
define docker_run_local
docker run --rm -v $(PWD):/opt/$(FORMULA_NAME)-formula --env=STAGE=TEST -h salt-testing-$(1) --name salt-testing-$(1) -it $(FORMULA_NAME):salt-testing-$(1) /bin/bash
endef
define run_tests
./tools/run-tests.sh $(FORMULA_NAME) $(1)
endef
# --- convenience functions -------------------------------------
define build_thing
$(call render_dockerfile,$(1)) && $(call docker_build,$(1))
endef
define run_local_tests
$(call build_thing,$(1)) && $(call run_tests,$(1))
endef
define run_local
$(call build_thing,$(1)) && $(call docker_run_local,$(1))
endef
# ---------------------------------------------------------------
setup:
pip install Jinja2
clean:
find . -name '*.pyc' -exec rm '{}' ';'
rm -rf Dockerfile.*
# delete pytest caches...
# rm -rf tests/pytests/*/.pytest_cache
# rm -rf tests/pytests/*/__pycache__
rm -rf tests/pytests/apply-all-tests/.pytest_cache
rm -rf tests/pytests/apply-all-tests/__pycache__
# --- centos_master_2017.7.2 ------------------------------------
test-centos_master_2017.7.2: clean
$(call run_local_tests,centos_master_2017.7.2)
local-centos_master_2017.7.2: clean
$(call run_local,centos_master_2017.7.2)
# --- debian_master_2017.7.2 ------------------------------------
test-debian_master_2017.7.2: clean
$(call run_local_tests,debian_master_2017.7.2)
local-debian_master_2017.7.2: clean
$(call run_local,debian_master_2017.7.2)
# --- opensuse_master_2017.7.2 ------------------------------------
test-opensuse_master_2017.7.2: clean
$(call run_local_tests,opensuse_master_2017.7.2)
local-opensuse_master_2017.7.2: clean
$(call run_local,opensuse_master_2017.7.2)
# --- ubuntu_master_2016.11.3 ------------------------------------
test-ubuntu_master_2016.11.3: clean
$(call run_local_tests,ubuntu_master_2016.11.3)
local-ubuntu_master_2016.11.3: clean
$(call run_local,ubuntu_master_2016.11.3)
# --- ubuntu_master_2017.7.2 ------------------------------------
test-ubuntu_master_2017.7.2: clean
$(call run_local_tests,ubuntu_master_2017.7.2)
local-ubuntu_master_2017.7.2: clean
$(call run_local,ubuntu_master_2017.7.2)