-
Notifications
You must be signed in to change notification settings - Fork 93
/
Makefile
46 lines (36 loc) · 1.04 KB
/
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
.PHONY: image test citest integration yarn.lock release
IMAGE_NAME ?= codeclimate/codeclimate-eslint
RELEASE_REGISTRY ?= codeclimate
ifndef RELEASE_TAG
override RELEASE_TAG = latest
endif
NPM_TEST_TARGET ?= test
NPM_INTEGRATION_TARGET ?= integration
DEBUG ?= false
ifeq ($(DEBUG),true)
NPM_TEST_TARGET = test.debug
NPM_INTEGRATION_TARGET = integration.debug
endif
image:
docker build --rm -t $(IMAGE_NAME) .
integration: yarn.lock
docker run -ti --rm \
-v $(PWD):/usr/src/app \
--workdir /usr/src/app \
$(IMAGE_NAME) npm run $(NPM_INTEGRATION_TARGET)
test: yarn.lock
docker run -ti --rm \
-v $(PWD):/usr/src/app \
--workdir /usr/src/app \
$(IMAGE_NAME) npm run $(NPM_TEST_TARGET)
citest:
docker run --rm \
--workdir /usr/src/app \
$(IMAGE_NAME) sh -c "npm run test && npm run integration"
yarn.lock: package.json Dockerfile
$(MAKE) image
./bin/yarn install
touch yarn.lock
release:
docker tag $(IMAGE_NAME) $(RELEASE_REGISTRY)/codeclimate-eslint:$(RELEASE_TAG)
docker push $(RELEASE_REGISTRY)/codeclimate-eslint:$(RELEASE_TAG)