forked from camptocamp/docker-qgis-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (52 loc) · 2.81 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
55
56
57
58
59
60
61
62
63
64
65
66
QGIS_BRANCH = master
DOCKER_TAG ?= latest
DOCKER_BASE = camptocamp/qgis-server
ROOT = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
export DOCKER_BUILDKIT = 1
DOCKER_COMPOSE_TTY := $(shell [ ! -t 0 ] && echo -T)
BUILD_OPTIONS = build
.PHONY: help
help: ## Display this help message
@echo "Usage: make <target>"
@echo
@echo "Available targets:"
@grep --extended-regexp --no-filename '^[a-zA-Z_-]+:.*## ' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf " %-20s%s\n", $$1, $$2}'
.PHONY: all
all: build acceptance ## Build and run acceptance tests
.PHONY: build-server
build-server: ## Build the server Docker image
DOCKER_BUILDKIT=1 docker $(BUILD_OPTIONS) --target=runner-server --tag=$(DOCKER_BASE):$(DOCKER_TAG) --build-arg=QGIS_BRANCH=$(QGIS_BRANCH) .
.PHONY: build-server-debug
build-server-debug: ## Build the server Docker debug image
DOCKER_BUILDKIT=1 docker $(BUILD_OPTIONS) --target=runner-server-debug --tag=$(DOCKER_BASE):$(DOCKER_TAG)-debug --build-arg=QGIS_BRANCH=$(QGIS_BRANCH) .
.PHONY: build-desktop
build-desktop: ## Build the desktop Docker image
DOCKER_BUILDKIT=1 docker $(BUILD_OPTIONS) --target=runner-desktop --tag=$(DOCKER_BASE):$(DOCKER_TAG)-desktop --build-arg=QGIS_BRANCH=$(QGIS_BRANCH) .
.PHONY: build-cache
build-cache:
DOCKER_BUILDKIT=1 docker $(BUILD_OPTIONS) --target=cache --tag=qgis-cache --build-arg=QGIS_BRANCH=$(QGIS_BRANCH) .
.PHONY: build ## Build all the Docker images
build: build-server build-server-debug build-desktop
.PHONY: build-acceptance-config
build-acceptance-config:
DOCKER_BUILDKIT=1 docker build --tag=$(DOCKER_BASE)-acceptance_config:$(DOCKER_TAG) acceptance_tests/config
.PHONY: build-acceptance
build-acceptance: build-acceptance-config
DOCKER_BUILDKIT=1 docker build --tag=$(DOCKER_BASE)-acceptance:$(DOCKER_TAG) acceptance_tests
.PHONY: run
run: build-acceptance
mkdir -p acceptance_tests/junitxml && touch acceptance_tests/junitxml/results.xml
cd acceptance_tests; docker compose up -d
.PHONY: acceptance
acceptance: run ## Run the acceptance tests
cd acceptance_tests; docker compose exec $(DOCKER_COMPOSE_TTY) run pytest -vv --color=yes --junitxml=/tmp/junitxml/results.xml
cd acceptance_tests; docker compose exec $(DOCKER_COMPOSE_TTY) qgis python3 -c 'from qgis import *'
cd acceptance_tests; docker compose exec $(DOCKER_COMPOSE_TTY) qgis python3 -c 'from qgis.core import *'
cd acceptance_tests; docker compose exec $(DOCKER_COMPOSE_TTY) qgis python3 -c 'from qgis.server import *'
cd acceptance_tests; docker compose exec $(DOCKER_COMPOSE_TTY) qgis python3 -c 'from qgis._gui import *'
.PHONY: run-client
run-client: ## Run the desktop application
docker run --rm -ti -e DISPLAY=unix${DISPLAY} --volume=/tmp/.X11-unix:/tmp/.X11-unix --volume=${HOME}:${HOME} $(DOCKER_BASE):$(DOCKER_TAG)-desktop
clean:
rm -rf acceptance_tests/junitxml/ server/build server/target