forked from canonical/charm-nginx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (64 loc) · 2.62 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
76
77
78
79
80
81
# This is a template `Makefile` file for ops charms
# This file is managed by bootstack-charms-spec and should not be modified
# within individual charm repos. https://launchpad.net/bootstack-charms-spec
PYTHON := /usr/bin/python3
PROJECTPATH=$(dir $(realpath $(MAKEFILE_LIST)))
RELEASE_CHANNEL:=edge
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 dev-environment - setup the development environment"
@echo " make pre-commit - run pre-commit checks on all the files"
@echo " make submodules - initialize, fetch, and checkout any nested submodules"
@echo " make submodules-update - update submodules to latest changes on remote branch"
@echo " make clean - remove unneeded files and clean charmcraft environment"
@echo " make build - build the charm"
@echo " make release - run clean, build and upload charm"
@echo " make lint - run flake8, black --check and isort --check"
@echo " make reformat - run black and isort and reformat files"
@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 ""
dev-environment:
@echo "Creating virtualenv with pre-commit installed"
@tox -r -e dev-environment
pre-commit:
@tox -e pre-commit
submodules:
@echo "Cloning submodules"
@git submodule update --init --recursive
submodules-update:
@echo "Pulling latest updates for submodules"
@git submodule update --init --recursive --remote --merge
clean:
@echo "Cleaning existing build"
@rm -rf ${PROJECTPATH}/${CHARM_NAME}*.charm
@echo "Cleaning charmcraft"
@charmcraft clean
build: clean
@echo "Building charm"
@charmcraft -v pack ${BUILD_ARGS}
@bash -c ./rename.sh
release: build
@echo "Releasing charm to ${RELEASE_CHANNEL} channel"
@charmcraft upload ${CHARM_NAME}.charm --release ${RELEASE_CHANNEL}
lint:
@echo "Running lint checks"
@tox -e lint
reformat:
@echo "Reformat files with black and isort"
@tox -e reformat
unittests:
@echo "Running unit tests"
@tox -e unit -- ${UNIT_ARGS}
functional: build
@echo "Executing functional tests using built charm at ${PROJECTPATH}"
@CHARM_LOCATION=${PROJECTPATH} tox -e func -- ${FUNC_ARGS}
test: lint unittests functional
@echo "Tests completed for charm ${CHARM_NAME}."
# The targets below don't depend on a file
.PHONY: help dev-environment pre-commit submodules submodules-update clean build lint reformat unittests functional