Skip to content

Commit

Permalink
fix: update makefile to run only on file changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaitanyabsprip committed Jun 13, 2024
1 parent 172df24 commit 2d64cb1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.test_sessions
test/.ran-build-docker
test/.ran-docker
19 changes: 12 additions & 7 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
.PHONY: test

INSTALL_PATH?=/usr/bin/harpoon
IMAGE_NAME=harpoon-test

install: ./harpoon
@install -m 0555 -C ./harpoon $(INSTALL_PATH)

uninstall:
@rm $(INSTALL_PATH)

test: docker
@docker run -h harpoon-test --name harpoon-test harpoon-test
test: | test/.ran-build-docker
@docker run -h $(IMAGE_NAME) --name $(IMAGE_NAME) $(IMAGE_NAME)
@docker rm $(IMAGE_NAME)

docker: test/Dockerfile harpoon test/driver.sh --clean
@docker build -t harpoon-test -f test/Dockerfile .
test/.ran-build-docker: test/Dockerfile harpoon test/driver.sh
@$(MAKE) -- --clean >/dev/null
@docker build -t $(IMAGE_NAME) -f test/Dockerfile .
@touch $@

--clean:
@docker ps -a --format '{{.Image}}' | grep -w "harpoon-test" \
@docker ps -a --format '{{.Image}}' | grep -w "$(IMAGE_NAME)" \
| xargs -I {} docker rm {} >/dev/null 2>&1 || :;
@docker images -a --format '{{.Repository}}' | grep -w "harpoon-test" \
@docker images -a --format '{{.Repository}}' | grep -w "$(IMAGE_NAME)" \
| xargs -I {} docker rmi {} >/dev/null 2>&1 || :;

0 comments on commit 2d64cb1

Please sign in to comment.