|
| 1 | +FORMULA_NAME = "node" |
| 2 | +PWD = $(shell pwd) |
| 3 | + |
| 4 | +# --------------------------------------------------------------- |
| 5 | +define render_dockerfile |
| 6 | + python $(PWD)/tools/filltmpl.py $(FORMULA_NAME) $(1) |
| 7 | +endef |
| 8 | + |
| 9 | +define docker_build |
| 10 | + docker build --force-rm -t $(FORMULA_NAME):salt-testing-$(1) -f Dockerfile.$(1) . |
| 11 | +endef |
| 12 | + |
| 13 | +define docker_run_local |
| 14 | + 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 |
| 15 | +endef |
| 16 | + |
| 17 | +define run_tests |
| 18 | + ./tools/run-tests.sh $(FORMULA_NAME) $(1) |
| 19 | +endef |
| 20 | + |
| 21 | +# --- convenience functions ------------------------------------- |
| 22 | +define build_thing |
| 23 | + $(call render_dockerfile,$(1)) && $(call docker_build,$(1)) |
| 24 | +endef |
| 25 | + |
| 26 | +define run_local_tests |
| 27 | + $(call build_thing,$(1)) && $(call run_tests,$(1)) |
| 28 | +endef |
| 29 | + |
| 30 | +define run_local |
| 31 | + $(call build_thing,$(1)) && $(call docker_run_local,$(1)) |
| 32 | +endef |
| 33 | + |
| 34 | +# --------------------------------------------------------------- |
| 35 | +setup: |
| 36 | + pip install Jinja2 |
| 37 | + |
| 38 | +clean: |
| 39 | + find . -name '*.pyc' -exec rm '{}' ';' |
| 40 | + rm -rf Dockerfile.* |
| 41 | + # delete pytest caches... |
| 42 | + # rm -rf tests/pytests/*/.pytest_cache |
| 43 | + # rm -rf tests/pytests/*/__pycache__ |
| 44 | + rm -rf tests/pytests/apply-all-tests/.pytest_cache |
| 45 | + rm -rf tests/pytests/apply-all-tests/__pycache__ |
| 46 | + |
| 47 | +# --- centos_master_2017.7.2 ------------------------------------ |
| 48 | +test-centos_master_2017.7.2: clean |
| 49 | + $(call run_local_tests,centos_master_2017.7.2) |
| 50 | + |
| 51 | +local-centos_master_2017.7.2: clean |
| 52 | + $(call run_local,centos_master_2017.7.2) |
| 53 | + |
| 54 | +# --- debian_master_2017.7.2 ------------------------------------ |
| 55 | +test-debian_master_2017.7.2: clean |
| 56 | + $(call run_local_tests,debian_master_2017.7.2) |
| 57 | + |
| 58 | +local-debian_master_2017.7.2: clean |
| 59 | + $(call run_local,debian_master_2017.7.2) |
| 60 | + |
| 61 | +# --- opensuse_master_2017.7.2 ------------------------------------ |
| 62 | +test-opensuse_master_2017.7.2: clean |
| 63 | + $(call run_local_tests,opensuse_master_2017.7.2) |
| 64 | + |
| 65 | +local-opensuse_master_2017.7.2: clean |
| 66 | + $(call run_local,opensuse_master_2017.7.2) |
| 67 | + |
| 68 | +# --- ubuntu_master_2016.11.3 ------------------------------------ |
| 69 | +test-ubuntu_master_2016.11.3: clean |
| 70 | + $(call run_local_tests,ubuntu_master_2016.11.3) |
| 71 | + |
| 72 | +local-ubuntu_master_2016.11.3: clean |
| 73 | + $(call run_local,ubuntu_master_2016.11.3) |
| 74 | + |
| 75 | +# --- ubuntu_master_2017.7.2 ------------------------------------ |
| 76 | +test-ubuntu_master_2017.7.2: clean |
| 77 | + $(call run_local_tests,ubuntu_master_2017.7.2) |
| 78 | + |
| 79 | +local-ubuntu_master_2017.7.2: clean |
| 80 | + $(call run_local,ubuntu_master_2017.7.2) |
0 commit comments