-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
75 lines (60 loc) · 2.26 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
67
68
69
70
71
72
73
74
75
PYTHON := /usr/bin/python3
PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST)))
METADATA_FILE="metadata.yaml"
CHARM_NAME=$(shell cat ${PROJECTPATH}/${METADATA_FILE} | grep -E '^name:' | awk '{print $$2}')
help:
@echo "This project supports the following targets"
@echo ""
@echo " make help - show this text"
@echo " make clean - remove unneeded files"
@echo " make submodules - make sure that the submodules are up-to-date"
@echo " make submodules-update - update submodules to latest changes on remote branch"
@echo " make build - build the charm"
@echo " make release - run clean, submodules and build targets"
@echo " make lint - run flake8 and black --check"
@echo " make black - run black and reformat files"
@echo " make proof - run charm proof"
@echo " make unittests - run the tests defined in the unittest subdirectory"
@echo " make functional - run the tests defined in the functional subdirectory"
@echo " make test - run lint, unittests and functional targets"
@echo ""
clean:
@echo "Cleaning existing build"
@rm -rf ${PROJECTPATH}/${CHARM_NAME}*.charm
@echo "Cleaning charmcraft"
@charmcraft clean
submodules:
@echo "Cloning submodules"
@git submodule update --init --recursive
submodules-update:
@echo "Pulling latest updates for submodules"
@git submodule update --init --recursive --remote --merge
build: clean
@echo "Building charm"
@charmcraft -v pack ${BUILD_ARGS}
@bash -c ./rename.sh
release: clean build
@echo "Charms built:"
@ls -l "${PROJECTPATH}"/*.charm
lint:
@echo "Running lint checks"
@tox -e lint
reformat:
@echo "Reformat files with black and isort"
@tox -e reformat
proof:
# @-charm proof
@echo '"proof" target disabled.'
unittests:
@echo "Executing unittests in ${CHARM_BUILD_DIR}"
@tox -e unit
functional: build
@echo "Executing functional tests with ${PROJECTPATH}/${CHARM_NAME}.charm"
@CHARM_LOCATION=${PROJECTPATH} tox -e func -- ${FUNC_ARGS}
smoke: build
@echo "Executing smoke functional tests with ${PROJECTPATH}/${CHARM_NAME}.charm"
@CHARM_LOCATION=${PROJECTPATH} tox -e func-smoke -- ${FUNC_ARGS}
test: lint unittests functional
@echo "Tests completed for charm ${CHARM_NAME}."
# The targets below don't depend on a file
.PHONY: help submodules submodules-update clean build release lint black proof unittests functional test