blob: 9e835015fcc5164aeaf28ae9b1b5df2d0435cd56 [file] [log] [blame]
Zack Williams90726642021-03-30 18:10:09 -07001# edgemonagent Makefile
2#
3# SPDX-FileCopyrightText: © 2021 Open Networking Foundation <support@opennetworking.org>
4# SPDX-License-Identifier: Apache-2.0
5
6SHELL = bash -eu -o pipefail
7
8.DEFAULT_GOAL := help
9.PHONY: test lint yamllint ansiblelint license help
10
11test: ## run tests on the playbook with molecule
12 molecule --version
13 molecule test
14
15lint: yamllint ansiblelint black pylint ## run all lint checks
16
17# all YAML files
18YAML_FILES ?= $(shell find . -type f \( -name '*.yaml' -o -name '*.yml' \) -print )
19
20yamllint: ## lint check with yamllint
21 yamllint --version
22 yamllint \
23 -d "{extends: default, rules: {line-length: {max: 99}}}" \
24 -s $(YAML_FILES)
25
26ansiblelint: ## lint check with ansible-lint
27 ansible-lint --version
28 ansible-lint -v .
29 ansible-lint -v molecule/*/*
30
31black:
32 black --check files/*py
33
34pylint:
35 pylint files/*py
36
37license: ## Check license with the reuse tool
38 reuse --version
39 reuse --root . lint
40
41help: ## Print help for each target
42 @echo edgemonagent test targets
43 @echo
44 @grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
45 | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'