Created
May 12, 2016 18:48
-
-
Save ahawkins/30a3ab7f8843173b448139466a0c3494 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PACKAGE:=vendor/node_modules.tar.gz | |
| DOCKER_IMAGE:=slashdeploy/kpis | |
| NODE_VERSION:=$(shell cat Dockerfile | head -n 1 | cut -d ' ' -f 2) | |
| IMAGE:=tmp/image | |
| NODE_MODULES:=tmp/node_modules | |
| .PHONY: check | |
| check: | |
| docker --version > /dev/null | |
| zip --version > /dev/null | |
| unzip -v > /dev/null | |
| ansible --version > /dev/null | |
| .PHONY: foo | |
| $(PACKAGE): package.json | |
| mkdir -p $(@D) | |
| docker run --rm -it -v $(CURDIR):/data -w /data $(NODE_VERSION) \ | |
| npm install | |
| tar -czf $@ node_modules | |
| rm -rf node_modules | |
| $(NODE_MODULES): $(PACKAGE) | |
| tar xzf $< | |
| mkdir -p $(@D) | |
| touch $@ | |
| $(IMAGE): $(NODE_MODULES) | |
| docker build -t $(DOCKER_IMAGE) . | |
| mkdir -p $(@D) | |
| touch $@ | |
| .PHONY: test | |
| test: $(IMAGE) | |
| docker run --rm -it -v $(CURDIR):/data -w /data $(DOCKER_IMAGE) \ | |
| npm test | |
| .PHONY: test-shellcheck | |
| test-shellcheck: | |
| docker run --rm -v $(CURDIR):/data:ro -w /data jrotter/shellcheck \ | |
| shellcheck -s bash \ | |
| $(shell find script -type f -exec test -x {} \; -print | paste -s -d ' ' -) | |
| .PHONY: test-application | |
| test-application: $(IMAGE) | |
| docker run --rm $(DOCKER_IMAGE) npm run lint | |
| docker run --rm $(DOCKER_IMAGE) npm test | |
| .PHONY: test-ci | |
| test-ci: test-shellcheck test-application | |
| .PHONY: clean | |
| clean: | |
| rm -rf $(DOCKER_IMAGE) $(NODE_MODULES) node_modules |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment