-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
25 lines (20 loc) · 823 Bytes
/
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
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
TEST_INVENTORY_FILE ?= tests/inventory.yml
TEST_PLAYBOOK ?= tests/test.yml
DOCKER_IMAGE ?= hannseman/raspbian
.PHONY: lint test docker
lint:
@ansible-playbook -i $(TEST_INVENTORY_FILE) $(TEST_PLAYBOOK) --syntax-check
@yamllint .
docker:
@docker pull $(DOCKER_IMAGE)
@docker start raspbian-deconz || docker run --name raspbian-deconz -d -p 2222:2222 --privileged $(DOCKER_IMAGE)
@sh $(ROOT_DIR)/tests/files/wait-for-healthy.sh
test: docker
@ansible-playbook -i $(TEST_INVENTORY_FILE) $(TEST_PLAYBOOK)
test-idempotence: docker
@ansible-playbook -i $(TEST_INVENTORY_FILE) $(TEST_PLAYBOOK) | \
tee /dev/tty | \
grep -q 'changed=0.*failed=0' \
&& (echo 'Idempotence test: pass' && exit 0) \
|| (echo 'Idempotence test: fail' && exit 1) \