From d7c0127f97f3d20c10438af5554f964a29b94f6d Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Wed, 25 Dec 2019 15:46:28 -0500 Subject: [PATCH 1/2] Allow to run Makefile for another directory It is possible for a user to run make from outside of the acceptance-testing directory. For example $ cd /tmp $ make -f $GOPATH/src/helm.sh/acceptance-testing/Makefile To support this, the Makefile must use the ROOT_DIR of where the Makefile resides, so as to find all other files. Signed-off-by: Marc Khouzam --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e175d6b..a63353a 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,19 @@ -SHELL = /bin/bash +SHELL = /bin/bash +ROOT_DIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) .PHONY: acceptance acceptance: - @scripts/acceptance.sh + @$(ROOT_DIR)/scripts/acceptance.sh .PHONY: github-actions-ci github-actions-ci: - @scripts/github-actions-ci.sh + @$(ROOT_DIR)/scripts/github-actions-ci.sh .PHONY: github-actions-ci-local github-actions-ci-local: docker run -it --rm \ - -v $(shell pwd):/tmp/acceptance-testing \ + -v $(ROOT_DIR):/tmp/acceptance-testing \ -w /tmp/acceptance-testing \ --privileged -v /var/run/docker.sock:/var/run/docker.sock \ --entrypoint=/bin/bash ubuntu:latest \ - -c 'set +e; scripts/github-actions-ci.sh; echo "Exited $?. (Ctrl+D to exit shell)"; bash' \ No newline at end of file + -c 'set +e; scripts/github-actions-ci.sh; echo "Exited $?. (Ctrl+D to exit shell)"; bash' From 39f4458a7d73713adc41b48a9a39a1efa428a9db Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Wed, 25 Dec 2019 15:58:48 -0500 Subject: [PATCH 2/2] Add clean target to make file The installation of some tools has hard-code paths in them. For example: $ head -1 .acceptance/.venv/bin/robot #!/Users/marckhouzam/git/acceptance-testing/.acceptance/.venv/bin/python3.7 If I want to move the acceptance-testing repo to a new directory on my computer, the installed tools will no longer work due to these hard-coded paths. The simplest solution is to cleanup and re-install them. This commit as a 'make clean' target to easily remove the entire .acceptance directory. Signed-off-by: Marc Khouzam --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index a63353a..f966f1f 100644 --- a/Makefile +++ b/Makefile @@ -17,3 +17,7 @@ github-actions-ci-local: --privileged -v /var/run/docker.sock:/var/run/docker.sock \ --entrypoint=/bin/bash ubuntu:latest \ -c 'set +e; scripts/github-actions-ci.sh; echo "Exited $?. (Ctrl+D to exit shell)"; bash' + +.PHONY: clean +clean: + /bin/rm -rf $(ROOT_DIR)/.acceptance