-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
54 lines (40 loc) · 1.22 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
47
48
49
50
51
52
53
54
EXTENSION := QRLite
MW_VERSION ?= 1.35
EXTENSION_FOLDER := /var/www/html/extensions/$(EXTENSION)
IMAGE_NAME := $(shell echo $(EXTENSION) | tr A-Z a-z}):test-$(MW_VERSION)-$(SMW_VERSION)
PWD := $(shell bash -c "pwd -W 2>/dev/null || pwd")# this way it works on Windows and Linux
DOCKER_RUN_ARGS := --rm -v $(PWD)/coverage:$(EXTENSION_FOLDER)/coverage -w $(EXTENSION_FOLDER) $(IMAGE_NAME)
docker_run := docker run $(DOCKER_RUN_ARGS)
.PHONY: all
all:
# ======== CI ========
.PHONY: ci
ci: build test
.PHONY: ci-coverage
ci-coverage: build test-coverage
.PHONY: build
build:
docker build --tag $(IMAGE_NAME) \
--build-arg=MW_VERSION=$(MW_VERSION) \
.
.PHONY: test
test: composer-test npm-test
.PHONY: test-coverage
test-coverage: composer-test-coverage
.PHONY: composer-test
composer-test:
$(docker_run) composer test
.PHONY: npm-test
npm-test:
$(docker_run) npm run test
.PHONY: composer-test-coverage
composer-test-coverage:
$(docker_run) composer test-coverage
.PHONY: bash
bash:
docker run -it -v $(PWD):/src $(DOCKER_RUN_ARGS) bash
.PHONY: dev-bash
dev-bash:
docker run -it --rm \
-v $(PWD):$(EXTENSION_FOLDER) -v $(EXTENSION_FOLDER)/node_modules -v $(EXTENSION_FOLDER)/vendor \
-w $(EXTENSION_FOLDER) $(IMAGE_NAME) bash